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

OpenJPEG 2.3 (and 2.2?) multi component image fails to decode with KDU v7.10 #1132

Closed
KittyBarnett opened this issue Aug 4, 2018 · 1 comment

Comments

@KittyBarnett
Copy link

If you create the following images:

(1) opj_compress.exe -i temp.bmp -o temp_1.j2c -r 1920
(2) opj_compress.exe -i temp.bmp -o temp_2.j2c -r 1920,480

then the first image can be decoded with KDU v7.10.4 but the second cannot (it will throw an error during decoding and the resulting decoded image will be mostly noise).

However both will decode correctly on KDU v7.9.1.

Looking into it, it seems that while processing the header the new KDU will loop and keep reading until its internal buffer overflows and it throws an exception resulting in the following error: "Packet header contains a representation which is not strictly illegal, but unreasonably large so that it exceeds the dynamic range available for our internal representation! The problem is most likely due to a corrupt or incorrectly constructed code-stream. Try re-opening the image with the resilient mode enabled."

This seems to be due to the following commit: 2609fb8

Reverting it results in images that decode properly with the new KDU version. Since 7.9 decoded it fine but 7.10 does not, it's likely a problem on their end but since I don't own a KDU license I figured I'd report the issue here.

@rouault
Copy link
Collaborator

rouault commented Sep 22, 2018

This change was already reverted in master for another reason per:

commit 07d526e
Author: Even Rouault even.rouault@spatialys.com
Date: Mon Jan 8 09:38:44 2018 +0100

opj_t2_encode_packet(): disable setting empty packet header bit to 1 when there is an empty packet

This effectively reverts commit 2609fb8077125b5b31f1bcc2f98c12ff1e6572d7
since it has been reported that
such packets cause decoding issues with cinema J2K hardware
decoders: https://groups.google.com/forum/#!topic/openjpeg/M7M_fLX_Bco

@rouault rouault closed this as completed Sep 22, 2018
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

No branches or pull requests

2 participants