Skip to content

Conversation

@robert-ancell
Copy link
Contributor

If a scan runs out of arithmetic bits and we are on the start of a line the decoder stops decoding even though the rest of the line may still be valid, just not require any bits.

Instead, when we receive the DNL update the image height and continue processing as normal.

If a scan runs out of arithmetic bits and we are on the start of a line
the decoder stops decoding even though the rest of the line may still be
valid, just not require any bits.

Instead, when we receive the DNL update the image height and continue
processing as normal.
@robert-ancell
Copy link
Contributor Author

Discovered using the following test image which runs out of bits before the last line is started.
32x32x8_dnl

When running it through the libjpeg decoder the bottom line is black:
lossless_dnl_arithmetic

@robert-ancell
Copy link
Contributor Author

I'm not 100% sure I have the logic correct, it's not clear to me if we still need a case where ParseMCU is not called.

@thorfdbg
Copy link
Owner

Hi Robert,
sorry for the long reply, I was on a JPEG meeting last week (really!) and I'm now on vacation, so this will take some time for processing. Yet, from a quick inspection, it looks like your fix is adequate. Unfortunately, the image is so small that the state in the AC decoder lasts for more than one line. This is a quite unlikely case, but possible. I will look into this with a bit more care as soon as I'm back, but thanks for reporting! [This is really a very ugly race condition we have here...]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants