-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add ability to enable full JPEG baseline compatibility #3
Comments
I'm assuming this is only about baseline quantization tables, not disabling progressive rendering. It would be good to generate 8-bit tables indeed. If I recall correctly 16-bit tables are generated only when necessary. If values fit in 8 bit, libjpeg-turbo will output 8-bit even if baseline wasn't requested. And values exceed 255 only at qualities lower than 30 or so (depending on qtable), so I'm not sure if that's a widespread problem. I see two solutions:
|
Exactly, this is what I meant. Progressive rendering is not an issue.
I'm not very familiar with
Latter is easy to implement, while I agree that the former may be a better solution. |
Compress::set_quality
callsjpeg_set_quality
withforce_baseline
parameter asFALSE
, which is not an issue as long as a decoder capable of reading non-baseline JPEG, like the IJG decoder, is used. For example, optimised JPEG decoder on macOS and iOS can not decode 16-bit quantization table entries which could be generated whenforce_baseline
parameter isFALSE
. While iOS does uselibjpeg
as a fallback, it is slower and causes performance regressions. (This was an issue a year ago, it is possible that it has been fixed in latest versions of iOS and macOS).Would it be possible to add the ability to set this parameter as
TRUE
? Simply adding another parameter toCompress::set_quality
would be a breaking change, so adding another method likeCompress::set_quality_and_force_baseline
could be a viable solution.Relevant section in libjpeg manual:
https://github.com/mozilla/mozjpeg/blob/master/libjpeg.txt#L903
The text was updated successfully, but these errors were encountered: