Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DHT marker: no Huffman table found #3597

Open
ilya-fedin opened this issue May 21, 2024 · 7 comments
Open

DHT marker: no Huffman table found #3597

ilya-fedin opened this issue May 21, 2024 · 7 comments
Labels
jpegli Related to jpegli, also cjpegli and djpegli unrelated to 1.0 Things that need not be done before the 1.0 version milestone

Comments

@ilya-fedin
Copy link

Describe the bug
Failing to decode the following image with jpegli: photo_2024-05-21_21-56-01.zip

To Reproduce
Try to decode the mentioned image with jpegli

Expected behavior
Image is decoded

Environment

  • OS: Linux
  • Compiler version: GCC 12
  • CPU type: x86_64
  • cjxl/djxl version string: I don't have cjxl/djxl... But I used v0.10.2 tag to build jpegli.
@j7nj7n
Copy link

j7nj7n commented May 26, 2024

This is the same bug as here: #3604

An empty huffman table seems to mean "use the last".

There are blank tables at 0x00002763 and 0x0000320A for refinement in progressive scans.

@mo271 mo271 added unrelated to 1.0 Things that need not be done before the 1.0 version milestone jpegli Related to jpegli, also cjpegli and djpegli labels May 27, 2024
@eustas
Copy link
Contributor

eustas commented May 27, 2024

Once a quantization table has been defined for a particular destination, it replaces the previous tables stored in that
destination and shall be used, when referenced, in the remaining scans of the current image and in subsequent images
represented in the abbreviated format for compressed image data. If a table has never been defined for a particular
destination, then when this destination is specified in a frame header, the results are unpredictable.

With some fantasy, we can say that not defined Huffman table does nothing, but... Figure B.7 – Huffman table syntax does not allow DHT markers without payload...

@ilya-fedin
Copy link
Author

mozjpeg (which apparently means libjpgeg-turbo too) can decode it just fine

@jonsneyers
Copy link
Member

This is related to #2704

Strictly speaking, the JPEG file is not conforming to the JPEG spec (since DHT needs to have "one or more" tables). The current jbrd spec has no way of representing the reconstruction data for this JPEG file (since our encoding implicitly assumes that there will be at least one).

But many JPEG decoders do allow this case, e.g. libjpeg-turbo djpeg -strict is not even producing a warning for this, let alone refusing to decode it. And we can make it work in jbrd too (see #2704), although it does require an update to the jxl spec and to libjxl.

@veluca93: I made this proposal because #2542 was complaining about this. Back then we decided to take no action yet, since we had only one issue report so we had no idea how common this problem is. Now we also have this report here (#3597) and also #3604. So that's three independent instances of the problem (as far as I know, at least the reports are coming from different people). I would argue that we can now assume that this case happens in enough cases to make it worth addressing the issue. Especially because it can be fixed without causing major interoperability trouble (the worst thing that can happen is that you receive a jxl file that you can view but you cannot reconstruct it to a jpeg file without upgrading your djxl version).

@ilya-fedin
Copy link
Author

Will libjxl fix affect jpegli? As my problem is with jpegli, not jxl.

@filipe-luis
Copy link

I've faced the same issue with jpegli. @jonsneyers Do you know when this is expected to be addressed? Thank you

@ilya-fedin
Copy link
Author

Do you know when this is expected to be addressed?

Looking at the mentioned PR they disagree this is a bug and don't plan addressing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jpegli Related to jpegli, also cjpegli and djpegli unrelated to 1.0 Things that need not be done before the 1.0 version milestone
Projects
None yet
Development

No branches or pull requests

6 participants