As the development of blosc2 gains speed, it might be worth considering to play around with their new plugin API. See https://github.com/Blosc/c-blosc2/blob/main/examples/udcodecs.c for an early example.