-
Notifications
You must be signed in to change notification settings - Fork 468
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
opj_compress
sometimes loses data when encoding in lossless mode
#1575
Comments
Jasper does not have this problem: Jasper's output attached: jasper-tile3x2-res5.zip |
nico
added a commit
to nico/serenity
that referenced
this issue
Feb 3, 2025
The test image added in SerenityOS#25678 had wonky borders, due to uclouvain/openjpeg#1575. Recreate it using jasper instead of openjpeg, which doesn't have this problem. jasper does have the problem that it doesn't write a cdef box, which I think is invalid, so I built jasper with this local hack to work around that: jasper-software/jasper#392 (comment) Image created using build/src/app/jasper --input \ Tests/LibGfx/test-inputs/jpeg2000/kakadu-lossless-*.jp2 \ --output jasper-tile3x2-res5.jp2 \ -O tilewidth=39 -O tileheight=53 -O numrlvls=5 I verified that the new image still triggers the crash without the code change in SerenityOS#25678.
nico
added a commit
to SerenityOS/serenity
that referenced
this issue
Feb 4, 2025
The test image added in #25678 had wonky borders, due to uclouvain/openjpeg#1575. Recreate it using jasper instead of openjpeg, which doesn't have this problem. jasper does have the problem that it doesn't write a cdef box, which I think is invalid, so I built jasper with this local hack to work around that: jasper-software/jasper#392 (comment) Image created using build/src/app/jasper --input \ Tests/LibGfx/test-inputs/jpeg2000/kakadu-lossless-*.jp2 \ --output jasper-tile3x2-res5.jp2 \ -O tilewidth=39 -O tileheight=53 -O numrlvls=5 I verified that the new image still triggers the crash without the code change in #25678.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Repro:
It looks like so (in png form, for github's preview):
Download osx-arm64 version from https://github.com/uclouvain/openjpeg/releases/tag/v2.5.3, fix up the rpath with
install_name_tool -add_rpath "@loader_path/../lib" ~/Downloads/openjpeg-v2.5.3-osx-arm64/bin/opj_compress
Compress ref.bmp losslessly like so:
~/Downloads/openjpeg-v2.5.3-osx-arm64/bin/opj_compress -i ref.bmp -o openjpeg-lossless-rgba-u8-prog0-tile3x2-res5.jp2 -n 5 -t 39,53 -C "opj_compress -n 5 -t 39,53"
Uncompress it again (or look at it in Preview.app):
~/Downloads/openjpeg-v2.5.3-osx-arm64/bin/opj_decompress -i openjpeg-lossless-rgba-u8-prog0-tile3x2-res5.jp2 -o out.png
The output looks like so:
Note the two white stripes at the far right. (This is a true effect in the color channels, not an alpha handling effect.)
This is probably related to the rightmost tiles being just 2 pixels wide. Since we have 4 decompositions, the LL band and the first decomposition after it are empty, which might confuse something.
The text was updated successfully, but these errors were encountered: