image-rs / jpeg-decoder

JPEG decoder written in Rust
Apache License 2.0
148 stars 87 forks source link

Bugfix non interleaved mcus #176

Closed quilan1 closed 3 years ago

quilan1 commented 3 years ago

As detailed in the commits, the issue had to do with the way the old code treated MCUs in non-interleaved streams, with channels having a greater-than-1 sampling factor. In a non-interleaved stream, MCUs should be treated as single blocks instead of as the group of HxV blocks.

Future work might be considered to simplify the coding of batching rows together for the worker threads; currently it only accepts the full HxV set of blocks for a 'row', instead of an image row, and I didn't touch that code.

Solves #173 and addresses #89

quilan1 commented 3 years ago

It occurs to me that the created jpeg file causes an error (bad huffman decode), not a panic; would this be better placed in the reftest images?

HeroicKatora commented 3 years ago

Yes, crashtest is for regressions that previously panicked and ignores the result. If you want to test success or a particular decoding response then the reftests are the appropriate place.

HeroicKatora commented 3 years ago

Thank you!