jxl decoder doesn't handle files that are premult alpha correctly
Categories
(Core :: Graphics: ImageLib, defect)
Tracking
()
People
(Reporter: tnikkel, Assigned: tnikkel)
References
Details
Attachments
(9 external files)
| Assignee | ||
Comment 1•1 month ago
|
||
The name says what type it holds rather than what it is for. The next patch
adds a second row buffer, so name this one after its role: the row we hand to
the surface pipe when it can't read mPixelBuffer directly.
| Assignee | ||
Comment 2•1 month ago
|
||
We assume jxl-rs always outputs unpremultiplied alpha, but for images with
premultiplied (associated) alpha it outputs the premultiplied values stored in
the file. We then premultiply them again, so semi-transparent areas come out
too dark. Color management and surfaces that want unpremultiplied data
(NO_PREMULTIPLY_ALPHA) also got premultiplied data.
Now we unpremultiply when color management or the surface needs it, and
otherwise tell the surface pipe not to premultiply. The spec doesn't say what
color values larger than alpha mean; we clamp them to alpha so the result
doesn't depend on whether color management runs.
| Assignee | ||
Comment 3•1 month ago
|
||
Premultiplied and non-premultiplied versions of the same RGB and gray grids,
each compared against one PNG, plus the conformance suite's
alpha_premultiplied image compared against its reference PNG. cjxl
--premultiply=1 only marks the pixels as premultiplied, so the premultiplied
grids are encoded from PNGs that were premultiplied first.
Comment 5•1 month ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/d495883d79a7
https://hg.mozilla.org/mozilla-central/rev/cda3ed9c9aaa
https://hg.mozilla.org/mozilla-central/rev/895ec42d7aba
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/63495 for changes under testing/web-platform/tests
| Assignee | ||
Comment 7•1 month ago
|
||
The name says what type it holds rather than what it is for. The next patch
adds a second row buffer, so name this one after its role: the row we hand to
the surface pipe when it can't read mPixelBuffer directly.
Original Revision: https://phabricator.services.mozilla.com/D331947
Updated•1 month ago
|
| Assignee | ||
Comment 8•1 month ago
|
||
We assume jxl-rs always outputs unpremultiplied alpha, but for images with
premultiplied (associated) alpha it outputs the premultiplied values stored in
the file. We then premultiply them again, so semi-transparent areas come out
too dark. Color management and surfaces that want unpremultiplied data
(NO_PREMULTIPLY_ALPHA) also got premultiplied data.
Now we unpremultiply when color management or the surface needs it, and
otherwise tell the surface pipe not to premultiply. The spec doesn't say what
color values larger than alpha mean; we clamp them to alpha so the result
doesn't depend on whether color management runs.
Original Revision: https://phabricator.services.mozilla.com/D331951
Updated•1 month ago
|
| Assignee | ||
Comment 9•1 month ago
|
||
Premultiplied and non-premultiplied versions of the same RGB and gray grids,
each compared against one PNG, plus the conformance suite's
alpha_premultiplied image compared against its reference PNG. cjxl
--premultiply=1 only marks the pixels as premultiplied, so the premultiplied
grids are encoded from PNGs that were premultiplied first.
Original Revision: https://phabricator.services.mozilla.com/D331952
Updated•1 month ago
|
Comment 10•1 month ago
|
||
firefox-beta Uplift Approval Request
- User impact if declined/Reason for urgency: incorrect rendering of premultiplied alpha jpeg xl files
- Code covered by automated testing?: yes
- Fix verified in Nightly?: no
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: The change only affects JPEG XL images with premultiplied (associated) alpha, which are uncommon. For all other JPEG XL images the decoding path is unchanged. I've added good test coverage for premult files with new WPT reftests cover the RGB and grayscale cases and the JPEG XL conformance image.
- String changes made/needed?: none
- Is Android affected?: yes
Upstream PR merged by moz-wptsync-bot
Updated•1 month ago
|
Updated•1 month ago
|
Updated•1 month ago
|
Updated•1 month ago
|
Updated•1 month ago
|
Comment 12•1 month ago
|
||
| uplift | ||
| Assignee | ||
Comment 13•1 month ago
|
||
The name says what type it holds rather than what it is for. The next patch
adds a second row buffer, so name this one after its role: the row we hand to
the surface pipe when it can't read mPixelBuffer directly.
Original Revision: https://phabricator.services.mozilla.com/D331947
Updated•1 month ago
|
| Assignee | ||
Comment 14•1 month ago
|
||
We assume jxl-rs always outputs unpremultiplied alpha, but for images with
premultiplied (associated) alpha it outputs the premultiplied values stored in
the file. We then premultiply them again, so semi-transparent areas come out
too dark. Color management and surfaces that want unpremultiplied data
(NO_PREMULTIPLY_ALPHA) also got premultiplied data.
Now we unpremultiply when color management or the surface needs it, and
otherwise tell the surface pipe not to premultiply. The spec doesn't say what
color values larger than alpha mean; we clamp them to alpha so the result
doesn't depend on whether color management runs.
Original Revision: https://phabricator.services.mozilla.com/D331951
Updated•1 month ago
|
| Assignee | ||
Comment 15•1 month ago
|
||
Premultiplied and non-premultiplied versions of the same RGB and gray grids,
each compared against one PNG, plus the conformance suite's
alpha_premultiplied image compared against its reference PNG. cjxl
--premultiply=1 only marks the pixels as premultiplied, so the premultiplied
grids are encoded from PNGs that were premultiplied first.
Original Revision: https://phabricator.services.mozilla.com/D331952
Updated•1 month ago
|
Comment 16•1 month ago
|
||
firefox-release Uplift Approval Request
- User impact if declined/Reason for urgency: incorrect rendering of premultiplied alpha jpeg xl files
- Code covered by automated testing?: yes
- Fix verified in Nightly?: no
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: The change only affects JPEG XL images with premultiplied (associated) alpha, which are uncommon. For all other JPEG XL images the decoding path is unchanged. I've added good test coverage for premult files with new WPT reftests cover the RGB and grayscale cases and the JPEG XL conformance image.
- String changes made/needed?: none
- Is Android affected?: yes
Updated•29 days ago
|
Comment 17•29 days ago
|
||
| uplift | ||
Updated•29 days ago
|
Updated•29 days ago
|
Updated•29 days ago
|
Updated•25 days ago
|
Description
•