TranscodingStreams.jl icon indicating copy to clipboard operation
TranscodingStreams.jl copied to clipboard

Support libaec?

Open milankl opened this issue 1 year ago • 2 comments

Just checking whether there's any interest here to support libaec as a codec. It's made primarily for 16/32bit unsigned integers with low entropy and in that sense somewhat specific (but a lot of big data applications fall into this category) but it doesn't look too hard to create a jll for it and write a CodecLibaec.jl wrapper for it.

milankl avatar May 01 '24 15:05 milankl

There's a jll for libaec https://juliahub.com/ui/Packages/General/libaec_jll already, and it seems to have a similar API to zlib.

IIUC when decoding the parameters need to be set the exact same way they were for encoding, so things like: transcode(AECDecompressor, compressed_buffer) won't work, instead you can do something like:

codec = AECDecompressor(;aec_parameters)
TranscodingStreams.initialize(codec)
try
    data = transcode(codec, compressed_buffer)
finally
    TranscodingStreams.finalize(codec)
end

nhz2 avatar May 01 '24 17:05 nhz2

I'm making a package that uses libaec to support the szip HDF5 filter.

https://github.com/JuliaIO/ChunkCodecs.jl/pull/51

There are some padding and byte-shuffling differences between aec and szip, but at the core, they seem similar:

https://github.com/MathisRosenhauer/libaec/blob/v1.1.3/src/sz_compat.c

The HDF5 szip filter also prepends the encoded data with the decoded size.

nhz2 avatar Jun 07 '25 18:06 nhz2