Frommi / miniz_oxide

Rust replacement for miniz
MIT License
168 stars 48 forks source link

Add decompress_slice_iter_to_slice function. #112

Closed Lokathor closed 2 years ago

Lokathor commented 2 years ago

This adds a function for decompressing an iterator over source slices into a single output slice.

Mostly this lets you decompress the IDAT chunks of a PNG, but I'm sure there's other uses for this too.

Notably, this lets us decompress without an allocation just for the decompression step. When decompressing many PNGs, the caller could reuse their temporary buffer to speed up the process. Because of how PNG works, the decompressed data can't be directly used as a the final data buffer, so making the decompression buffer be reusable across parsing work is a useful gain.

oyvindln commented 2 years ago

Ok, seems good.