oculante icon indicating copy to clipboard operation
oculante copied to clipboard

Consider using `zune-jpeg` in place of `turbojpeg`

Open Shnatsel opened this issue 2 years ago • 1 comments

zune-jpeg is an extremely fast JPEG decoder written in safe Rust. It is generally on par with libjpeg-turbo in terms of performance (some files are slightly faster, some slightly slower). You can find the benchmarks here.

It would be great to use the memory-safe decoder now that a performant option is available.

For reference, a PR integrating it with image can be found here: https://github.com/image-rs/image/pull/1877 It is expected to be landed in the next API break, replacing the jpeg-decoder crate, but it's not clear when that is going to happen.

Shnatsel avatar Jan 08 '24 03:01 Shnatsel

Thank you!

I think this is fantastic - I believe I looked at this option before and the only thing that held me back is that I am using turbojpeg for lossless transformations as well. As long as we want to support these, turbojpeg needs to stay. Although zune-jpeg could be used for decoding, this would probably not get rid of turbojpeg itself - but I guess memory safety would be worth it.

woelper avatar Jan 09 '24 20:01 woelper

Hey! Zune-jpeg is now the default in the image library. As such, oculante will use it if you disable the turbo flag, so you can easily build a version without turbojpeg. I will leave turbojpeg as default until there is a way to do lossless transformations with zune-jpeg.

woelper avatar May 12 '24 17:05 woelper