-
Notifications
You must be signed in to change notification settings - Fork 6
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
Quality behaving differently from reference encoder #53
Comments
Yes, the However, jpegxl-rs updated a set_jpeg_quality method to map jpeg quality to distance through the libjxl C-API I will have a check at the Rust side implementation for this. |
OK, I found what is the cause. The issue is the default value of Pluginpillow-jpegxl-plugin/pillow_jxl/JpegXLImagePlugin.py Lines 95 to 96 in d308b3d
cjxl --container=0|1
0 = Avoid the container format unless it is needed (default)
1 = Force using the container format even if it is not needed. Benchmarks after setting
|
Awesome. Will upgrade as soon as you've released a new version. There was no urgency, since I could fall back on the reference encoder, but it's nice to not having to round-trip to a subprocess when using Pillow and numpy. Fewer moving parts :) PS. Very strange that the container had such a large effect. Afaik the storage overhead for the container is just a few bytes unless something besides the bitstream is placed in the container; like gigantic metadata boxes. If you disable the container, keep in mind that you'll probably break the code you have that handles metadata transfer. That's why it's noted as "when not needed" in the reference implementation, since if anything other than the bitstream needs to be stored, a container is required as the bitstream itself has no place for such information. |
In the later releases (and latest: v1.2.5) the interpretation of quality seems to have changed.
As far as I recall, earlier releases followed the reference encoder's interpretation more or less.
When looking at the jpegxl-rs documentation it seems that library is using distance rather than quality, but calling the variable
quality
still. Those two concepts are completely distinct. The latter requires a very specific transformation to the former. Could this explain the divergent behavior from the reference implementation that I observe below for your plugin?Right now, with quality set to
90
for some random test image, I get the following encoding statistics for your plugin vs the reference encoder:The test script so you can reproduce the observation:
Versions used:
The text was updated successfully, but these errors were encountered: