-
-
Notifications
You must be signed in to change notification settings - Fork 891
Description
Prerequisites
- I have written a descriptive issue title
- I have verified that I am running the latest version of ImageSharp
- I have verified if the problem exist in both
DEBUGandRELEASEmode - I have searched open and closed issues to ensure it has not already been reported
Description
With #571 now included in the codebase we have an opportunity to further enhance the performance of our jpeg decoder.
There is one obvious candidate for improvement within the decoder: The decoding of the SOS (Start of Scan) segment.
Our approach works but is naïve. We only read/decode one byte at a time and do not use optimized tables for Huffman code lookup. There are further optimizations available with AC Huffman decoding that we also do not do.
I believe that with the correct implementation we can reduce our decoding time by at least 10ms when compared to our current benchmarks.
Inspiration for better code
- MozJpeg - (LibJpeg-Turbo port)
- StbImage - (https://github.com/nothings/stb/blob/e6afb9cbae4064da8c3e69af3ff5c4629579c1d2/stb_image.h#L1680)
- Rust Jpeg Decoder
I'm looking for help here. I've made several attempts to port from both sources but have failed miserably so far.
Update
@bitbank2 Has kindly written some information with pointers to demonstrate how to optimise entropy decoding.
http://bitbanksoftware.blogspot.com/2018/06/optimizing-jpeg-entropy-decoding.html