Closed Bug 1255106 Opened 9 years ago Closed 6 years ago

Add a SurfaceFilter for color space conversion

Categories

(Core :: Graphics: ImageLib, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla69
Tracking Status
firefox69 --- fixed

People

(Reporter: seth, Assigned: aosmond)

References

Details

(Whiteboard: gfx-noted)

Attachments

(4 files, 5 obsolete files)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
The PNG and JPEG decoders transform data in place to implement color space conversion with QCMS. This is exactly the type of thing that should be implemented as a SurfaceFilter.
Blocks: 1255107
Blocks: 1255108
No longer blocks: 1255107
Depends on: 1255107

We actually do color management on the native sized image. It would be good if we write such a filter, and place it to the end of the filter chain, so that we color manage fewer pixels. I've put together patches which does this, as well as brings nsJPEGDecoder into the surface pipe fold. Theoretically this brings us closer to color managing everything on non-mobile, if it really does lower the decode time. I still need to assess the performance delta (especially since we have seen regressions with SurfacePipe before with the GIF decoder). My current work probably does regress grayscale JPEGs (surface pipe works with BGRAm not grayscale), but I'm not convinced I should care about them too much relative to ones with color.

Assignee: nobody → aosmond
Status: NEW → ASSIGNED

GIF images should not apply CMS transforms if disabled by caller via
SurfaceFlags::NO_COLORSPACE_CONVERSION. WebP images should reject any
non-RGB ICC profiles, not just grayscale profiles.

I made some small changes to part 4 to use the color management filter even for interlaced PNG images. This seems to fix most/all of the failing reftests -- the interlacing filter is a somewhat complicated filter, so it would be best to color manage afterwards.

try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=06a5fc5bf49032345539d846f31292f0b3181895

Depends on: 1551084

GIF images should not apply CMS transforms if disabled by caller via
SurfaceFlags::NO_COLORSPACE_CONVERSION. WebP images should reject any
non-RGB ICC profiles, not just grayscale profiles.

Attachment #9064322 - Attachment is obsolete: true
Attachment #9064323 - Attachment is obsolete: true
Attachment #9064324 - Attachment is obsolete: true
Attachment #9064325 - Attachment is obsolete: true
Attachment #9056219 - Attachment description: Bug 1255106 - Part 2. Move color transform state to image decoder base class. → Bug 1255106 - Part 1. Move color transform state to image decoder base class.
Attachment #9056220 - Attachment description: Bug 1255106 - Part 3. Implement color management filter for SurfacePipe. → Bug 1255106 - Part 2. Implement color management filter for SurfacePipe.
Attachment #9056221 - Attachment description: Bug 1255106 - Part 4. Use color management filter with decoders using SurfacePipe. → Bug 1255106 - Part 3. Use color management filter with decoders using SurfacePipe.
Attachment #9056222 - Attachment description: Bug 1255106 - Part 5. Ensure we don't apply CMS transforms in cases we missed. → Bug 1255106 - Part 4. Ensure we don't apply CMS transforms in cases we missed.
Attachment #9056218 - Attachment is obsolete: true
Pushed by aosmond@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/524f61bca438 Part 1. Move color transform state to image decoder base class. r=tnikkel https://hg.mozilla.org/integration/mozilla-inbound/rev/3a7b422645b7 Part 2. Implement color management filter for SurfacePipe. r=tnikkel https://hg.mozilla.org/integration/mozilla-inbound/rev/85eb83a6f313 Part 3. Use color management filter with decoders using SurfacePipe. r=tnikkel https://hg.mozilla.org/integration/mozilla-inbound/rev/aed0c5da0ce0 Part 4. Ensure we don't apply CMS transforms in cases we missed. r=tnikkel
Regressions: 1555329
Regressions: 1555934
Regressions: 1557239
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: