Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(620)

Issue 2426723005: Use SkColorSpaceXform to handle color conversions in decoders (Closed)

Created:
4 years, 2 months ago by msarett
Modified:
4 years, 2 months ago
CC:
chromium-reviews, blink-reviews, jzern, skal, urvang
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use SkColorSpaceXform to handle color conversions in decoders Note on matching color spaces: *** Roughly 90% of image profiles specify sRGB. Most dsts are also sRGB (and so is our default when we don't know the dst). In the sRGB->sRGB case (and in other cases where the src and dst match), we should skip the xform. QCMS checks for matching profiles, but the check is very weak (only works if profiles have the same text description). SkColorSpace has a robust check for color space equality. Performance Notes: ***Test Srcs: Averaged across 97 images pulled from the top 10k skps. ***Test Dsts: sRGB transfer function, 2.2, other. HP z620 Average Xform Speed-Up (QCMS / SkColorSpaceXform) sRGB 1.51x 2.2 1.61x Other 1.44x (SkColorSpaceXform is actually fastest for sRGB - I just had to drop a bunch of images from the sRGB average, including a few that tripped up QCMS. SkColorSpaceXform was recognizing sRGB->sRGB was a no-op, so including these images skewed the results in its favor - I saw like 17x) Nexus 6P Average Xform Speed-Up (QCMS / SkColorSpaceXform) sRGB 2.08x 2.2 1.42x Other 3.33x (interesting that the fallback code is actually faster than the special cases on Arm - likely this is because the sqrt instructions that we're using to model the curves are slow on this platform - would be interesting to investigate further to see if we can do better) *** Note that turning this on for Android is left to a later CL. Correctness Notes: ***QCMS (and the Skia fallback code path) use a LUT to convert linear floats to the dst transfer function. This results in a loss of accuracy since the float must be rounded to an int before being used as an index into the table. Both Skia and QCMS do not interpolate the table for performance reasons. Skia avoids table-based implementations for two common cases (sRGB, 2.2), guaranteeing a result within 1 (on a 0-255 scale) of the "true" value. QCMS may be off by as much as 5 on the steep 2.2 curve. ***There are several fairly common sRGB profiles that represent the transfer function as a small LUT. QCMS does not recognize that it is sRGB, and interpolates this LUT to build a larger LUT that it then uses. This results in the conversion being off from the "true" value by as much as 9 (on a 0-255 scale). Other Behavior Changes: *** More lenient approval of ICC profiles. QCMS rejects xform matrices that are not "close enough to D50" by some arbitrary measure. We don't have enough data to know that this is or isn't necessary. QCMS also rejects profiles that it thinks are "too big". Again, this seems reasonable, but we'll wait until we understand the motivation better. What ICC profiles are supported? ***SkColorSpaceXform supports the same subset of profiles as QCMS. Adding support for A2B and Lab profiles is a WIP (We had support for a few of these, but we've dropped it as part of a refactor. The plan is to add it back as a part of a more logical, complete design). How does this relate to color correct rendering for Chrome? ***This modifies the legacy path, not the color correct path. ***It's still somewhat interestingly related to color correct rendering, since the color correct renderer will also use SkColorSpaceXform in some cases (likely just to xform scary profiles into linear F16). ***It looks like the color correct rendering path will rely on tagged images being handled inside Skia, but it's worth mentioning that this change makes it simpler to do flexible xforms (ex: to F16) at decode time. NO_DEPENDENCY_CHECKS=true BUG= Committed: https://crrev.com/8602b7fdc54d18aff914b5ddf0bba2a406078797 Committed: https://crrev.com/8de5bb3d8b53791711e7c387dc736817dd8947a7 Cr-Original-Commit-Position: refs/heads/master@{#426588} Cr-Commit-Position: refs/heads/master@{#426858}

Patch Set 1 #

Patch Set 2 : Remove ifdefs - fixes blink_platform_unittests #

Total comments: 12

Patch Set 3 : Fix png decodes #

Patch Set 4 : Response to comments #

Total comments: 8

Patch Set 5 : Refactor a bit for clarity #

Total comments: 1

Patch Set 6 : Rebaselines #

Patch Set 7 : More rebaselines #

Patch Set 8 : Rebase #

Messages

Total messages: 75 (56 generated)
msarett
I anticipate needing to do a bunch of rebaselines and test diagnosing. But I think ...
4 years, 2 months ago (2016-10-19 16:19:34 UTC) #24
scroggo_chromium
> Turns color xforms on for Android I wonder if this should be a separate ...
4 years, 2 months ago (2016-10-19 18:26:25 UTC) #25
ccameron
Awesome! I agree with the suggestion that we should make this change on existing platforms ...
4 years, 2 months ago (2016-10-19 19:03:18 UTC) #26
msarett
> > Turns color xforms on for Android > I wonder if this should be ...
4 years, 2 months ago (2016-10-19 19:55:43 UTC) #28
scroggo_chromium
> > Again, I wonder if we should be conservative. If these *do* cause problems, ...
4 years, 2 months ago (2016-10-20 12:45:05 UTC) #29
msarett
https://codereview.chromium.org/2426723005/diff/90007/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp File third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp (right): https://codereview.chromium.org/2426723005/diff/90007/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp#newcode374 third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp:374: ImageFrame::PixelData* address = buffer.getAddr(0, y); On 2016/10/20 12:45:04, scroggo_chromium ...
4 years, 2 months ago (2016-10-20 13:20:52 UTC) #32
msarett
dpranke@ Can you please take a look at third_party/WebKit/Source/config.gni?
4 years, 2 months ago (2016-10-20 13:23:21 UTC) #34
scroggo_chromium
lgtm https://codereview.chromium.org/2426723005/diff/150001/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp File third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp (right): https://codereview.chromium.org/2426723005/diff/150001/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp#newcode408 third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp:408: for (auto *dstPixel = dstRow; dstPixel < dstRow ...
4 years, 2 months ago (2016-10-20 14:10:28 UTC) #35
Dirk Pranke
config.gni lgtm.
4 years, 2 months ago (2016-10-20 17:28:10 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2426723005/230001
4 years, 2 months ago (2016-10-20 20:41:11 UTC) #51
commit-bot: I haz the power
Committed patchset #7 (id:230001)
4 years, 2 months ago (2016-10-20 20:53:23 UTC) #53
Peter Kasting
A revert of this CL (patchset #7 id:230001) has been created in https://chromiumcodereview.appspot.com/2436223002/ by pkasting@chromium.org. ...
4 years, 2 months ago (2016-10-20 23:30:23 UTC) #54
Dirk Pranke
lgtm
4 years, 2 months ago (2016-10-21 03:14:56 UTC) #55
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/8602b7fdc54d18aff914b5ddf0bba2a406078797 Cr-Commit-Position: refs/heads/master@{#426588}
4 years, 2 months ago (2016-10-21 13:22:16 UTC) #58
msarett
I believe I've made the MSAN fix in Skia. https://skia-review.googlesource.com/c/3800/ Once this rolls into Chrome, ...
4 years, 2 months ago (2016-10-21 13:32:52 UTC) #60
commit-bot: I haz the power
This CL has an open dependency (Issue 2426723005 Patch 230001). Please resolve the dependency and ...
4 years, 2 months ago (2016-10-21 18:35:35 UTC) #68
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2426723005/250001
4 years, 2 months ago (2016-10-21 18:40:51 UTC) #71
commit-bot: I haz the power
Committed patchset #8 (id:250001)
4 years, 2 months ago (2016-10-21 19:09:17 UTC) #73
commit-bot: I haz the power
4 years, 2 months ago (2016-10-21 19:44:49 UTC) #75
Message was sent while issue was closed.
Patchset 8 (id:??) landed as
https://crrev.com/8de5bb3d8b53791711e7c387dc736817dd8947a7
Cr-Commit-Position: refs/heads/master@{#426858}

Powered by Google App Engine
This is Rietveld 408576698