-
-
Notifications
You must be signed in to change notification settings - Fork 887
Closed
Milestone
Description
Currently, Huffmann decoding (done by HuffmanScanDecoder) is strictly separated from postprocessing/color conversion (done by JpegImagePostProcessor) for simplicity. This means that JpegComponent.SpectralBlocks are allocated upfront for the whole image.
I did a second round of memory profiling using SimpleGcMemoryAllocator to get rid of pooling for more auditable results. This shows that SpectralBlocks are responsible for the majority of our memory allocation:
This can be eliminated with some non-trivial, but still limited refactoring:
JpegDecoderCoreandHuffmanScanDecoderneeds a mode whereJpegComponent.SpectralBlocksis interpreted as a sliding window of blocks instead of full set of decoded spectral blocksHuffmanScanDecodercan then push the rows of the sliding window, directly calling an instance ofJpegComponentPostprocessorin the end of it's MCU-row decoding loop
