nothings/stb — pull request #59 by rygorous (2014-12-18 16:43:40+00:00)
Title: Fastjpeg

stb_image faster JPEG decoder and stock SIMD support.

This removes the old STBI_SIMD API, adds some basic optimizations to the
Huffman decoding path, and adds new built-in SIMD support (which you can
disable using STBI_NO_SIMD). Currently only SSE2, although NEON might
happen later.

Tested with VC++ 2012 and GCC 4.8.3 on Linux. It's more than 2x faster than
the original stb_image (when decoding "anemones.jpg" to RGBA) on two
machines that I tested on (Windows desktop PC and Linux laptop).

Known issues:
- The IDCT matches the C version exactly, but the YCbCr->RGB code doesn't. I think.
(There's some theoretical rounding issues that might never materialize in practice;
need to check, there's only 256^2 chroma value pairs to test!)
- YCbCr->RGB only has SSE2 path for step=4 (decode to RGBA), decode to RGB
is still scalar. The shuffling to pack planar to interleaved RGB without a fourth
component is relatively nasty, and it didn't seem worthwhile to spend time on
writing one since it's not actually useful if you want to put the results in, say,
a GL texture. (Shuffles are a lot easier with SSSE3, but eh, having another
path for a pretty marginal feature - I don't think so.)
- h2v2 resampler is in there, but no h2v1 resampler yet (the other common mode).
- SSE2 detection in Linux could be better. (What's in there is good for GCC >=4.8,
but there should be something for older versions too.)
- Not tested with VC6 - you'll have to do that on your own. :)