#jpeg #decoder #jpeg-decoder

zune-jpeg

The fastest jpeg decoder in the west

5 releases

Uses new Rust 2021

0.1.4 Jun 16, 2022
0.1.3 May 29, 2022
0.1.2 May 23, 2022
0.1.1 May 19, 2022
0.1.0 May 9, 2022

#79 in Images

Download history 19/week @ 2022-05-07 20/week @ 2022-05-14 23/week @ 2022-05-21 29/week @ 2022-05-28 7/week @ 2022-06-04 27/week @ 2022-06-11 14/week @ 2022-06-18 15/week @ 2022-06-25

63 downloads per month

MIT/Apache

230KB
4K SLoC

Zune-jpeg

An incredibly spicy jpeg decoder.

Features

  • A Pretty fast 8*8 integer IDCT.
  • Fast Huffman Decoding
  • Fast color convert functions.
  • Support for extended colorspaces like GrayScale and RGBA
  • Multi-threaded decoding.

Crate Features

feature on Capabilities
x86 Enables x86 specific instructions, specifically avx and sse for accelerated decoding.

Note that the x86 features are automatically disabled on platforms that aren't x86 during compile time hence there is no need to disable them explicitly if you are targeting such a platform.

Debug vs release

The decoder heavily relies on platform specific intrinsics, namely AVX2 and SSE to gain speed-ups in decoding, but in debug build rust generally doesn't like platform specific intrinsics (try passing -O parameter to see optimized build) hence obviously speeds tank so bad during debug builds, and there is probably nothing we can do about that.

The Decoder.

x86_64 benchmarks

Apple M1 benchmarks

The decoder is blazingly fast, especially on x86_64 with AVX2 enabled CPU's(most cpu's from 2013).

Even with CPU's that don't support these extensions, the code is carefully written to allow the auto-vectorizer to accelerate for whatever platforms in mind.

Furthermore, we take advantage of multi-core CPU's to accelerate post-processing of images to bring 1.5x performance edge over libjpeg-turbo and 2x over image-rs/jpeg-decoder.

For more up-to-date benchmarks, see Benches.md.

Note, we do not try to recover corrupt JPEG's, your best bet is libjpeg-turbo for that, all errors are propagated up to the caller.

TODO

  • Add support for Adobe APP14 images.
  • Support more colorspace options. It would not be too bad if we support all color options libjpeg/mozjpeg supports.

Dependencies