You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had asked about this issue on the mailing list, but got no reply.
How to reproduce:
Save the attached file as "gradient.trailingzeros.jp2" (file was attached as .jpg file because GitHub doesn't know JPEG 2000 files):
The file was created by appending a block of zero bytes to an existing JPEG 2000 file.
Run opj_decompress:
$ bin/opj_decompress -i gradient.trailingzeros.jp2 -o gradient.trailingzeros.tif
[INFO] Start to read j2k main header (85).
[INFO] Main header has been correctly decoded.
[INFO] No decoded area parameters, set the decoded area to the whole image
[INFO] Header of tile 1 / 1 has been read.
[INFO] Tile 1/1 has been decoded.
[INFO] Image data has been updated with tile 1.
[ERROR] Cannot handle box of undefined sizes
ERROR -> opj_decompress: failed to decode image!
The claim is that the test file is a valid JPEG 2000 file according to 15444-1. From ISO 15444-1, "I.8 Dealing with unknown boxes":
"An unknown box is a box that is not defined in this Recommendation | International Standard. A conforming JP2 file may contain unknown boxes. If a conforming reader finds an unknown box, it shall skip and ignore that box."
The zeroes after the last box in the original file can be interpreted as another box with LBox=0000 and TBox=0000, meaning a box of unspecified length with type 0000. As the box with unspecified length appears at the end of the file, and the original file has a "jp2c" Contiguous Code-Stream box as the last box with an explicit size, this is allowed. Type 0000 is unknown, so the box should be ignored.
jpylyzer recognizes the file as a valid JPEG 2000 file, and shows the trailing zeros as an unknown box:
<unknownBox>
<boxType/>
</unknownBox>
Expected result: OpenJPEG should interpret the trailing zeros as a box of unknown size with an unknown type, and should successfully decompress the test file.
The text was updated successfully, but these errors were encountered:
@smuehlst, this is indeed a bug.
Section I.4 of 15444-1 also states how to handle 0 length box.
It sums up as, this is the last box of the file and as such contains all data up to the end of the file. It doesn't matter if the box is known or unknown. I guess tests shall be added with such data.
I had asked about this issue on the mailing list, but got no reply.
How to reproduce:
Save the attached file as "gradient.trailingzeros.jp2" (file was attached as .jpg file because GitHub doesn't know JPEG 2000 files):
The file was created by appending a block of zero bytes to an existing JPEG 2000 file.
Run opj_decompress:
The claim is that the test file is a valid JPEG 2000 file according to 15444-1. From ISO 15444-1, "I.8 Dealing with unknown boxes":
"An unknown box is a box that is not defined in this Recommendation | International Standard. A conforming JP2 file may contain unknown boxes. If a conforming reader finds an unknown box, it shall skip and ignore that box."
The zeroes after the last box in the original file can be interpreted as another box with LBox=0000 and TBox=0000, meaning a box of unspecified length with type 0000. As the box with unspecified length appears at the end of the file, and the original file has a "jp2c" Contiguous Code-Stream box as the last box with an explicit size, this is allowed. Type 0000 is unknown, so the box should be ignored.
jpylyzer recognizes the file as a valid JPEG 2000 file, and shows the trailing zeros as an unknown box:
Expected result: OpenJPEG should interpret the trailing zeros as a box of unknown size with an unknown type, and should successfully decompress the test file.
The text was updated successfully, but these errors were encountered: