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

Issue 2335723002: Reduce overhead for linear color xforms (Closed)

Created:
4 years, 3 months ago by msarett
Modified:
4 years, 3 months ago
Reviewers:
Brian Osman, mtklein
CC:
reviews_skia.org
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Reduce overhead for linear color xforms We used to build src and dst transfer fn tables every time a new xform was created with linear src and dst. Now we don't compute them because we don't need them. This will make SkColorSpaceXform a far better option for any xforms with float or half-float inputs or outputs, particularly on a small number of pixels. This CL also moves SkColorSpaceXform closer to what I anticipate will be the eventual 'API design'. I think apply() will want to take a SrcColorType enum (not created yet because it's not necessary yet) and a DstColorType enum (still using SkColorType because there's not yet a reason not to). Performance changes: toSRGB 341us -> 366us to2Dot2 404us -> 403us toF16 318us -> 304us There's no reason for toSRGB or to2Dot2 to change. The refactor seems to have caused the compiler to order the instructions a little differently... This is something to come back to if we need to squeeze more performance out of sRGB. For now, let's not be held up by something we don't control. F16 likely improves because we are no longer (unnecessarily) building the linear tables. Code size gets a little bigger. Measuring SkColorSpaceXform size as a percentage of src/ size, we go from 0.8% to 1.4%. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2335723002 Committed: https://skia.googlesource.com/skia/+/8bbcd5aab81dc0742c3367479c0c9d97363b1203

Patch Set 1 #

Patch Set 2 : Fix bench #

Total comments: 11

Patch Set 3 : Response to comments #

Patch Set 4 : More refactoring #

Unified diffs Side-by-side diffs Delta from patch set Stats (+384 lines, -152 lines) Patch
M bench/ColorCodecBench.cpp View 1 1 chunk +2 lines, -1 line 0 comments Download
M src/core/SkColorSpaceXform.h View 2 chunks +24 lines, -4 lines 0 comments Download
M src/core/SkColorSpaceXform.cpp View 1 2 3 21 chunks +358 lines, -147 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 22 (15 generated)
msarett
4 years, 3 months ago (2016-09-12 21:23:07 UTC) #6
Brian Osman
https://codereview.chromium.org/2335723002/diff/60001/src/core/SkColorSpaceXform.cpp File src/core/SkColorSpaceXform.cpp (right): https://codereview.chromium.org/2335723002/diff/60001/src/core/SkColorSpaceXform.cpp#newcode454 src/core/SkColorSpaceXform.cpp:454: if (srcSpace->gammaIsLinear()) { Seems impossible? https://codereview.chromium.org/2335723002/diff/60001/src/core/SkColorSpaceXform.cpp#newcode464 src/core/SkColorSpaceXform.cpp:464: if (srcSpace->gammaIsLinear()) ...
4 years, 3 months ago (2016-09-13 13:39:30 UTC) #9
msarett
https://codereview.chromium.org/2335723002/diff/60001/src/core/SkColorSpaceXform.cpp File src/core/SkColorSpaceXform.cpp (right): https://codereview.chromium.org/2335723002/diff/60001/src/core/SkColorSpaceXform.cpp#newcode454 src/core/SkColorSpaceXform.cpp:454: if (srcSpace->gammaIsLinear()) { On 2016/09/13 13:39:30, Brian Osman wrote: ...
4 years, 3 months ago (2016-09-13 15:55:57 UTC) #10
msarett
Alright I'm happy with this again... https://codereview.chromium.org/2335723002/diff/60001/src/core/SkColorSpaceXform.cpp File src/core/SkColorSpaceXform.cpp (right): https://codereview.chromium.org/2335723002/diff/60001/src/core/SkColorSpaceXform.cpp#newcode1076 src/core/SkColorSpaceXform.cpp:1076: On 2016/09/13 15:55:57, ...
4 years, 3 months ago (2016-09-13 17:19:29 UTC) #13
Brian Osman
lgtm
4 years, 3 months ago (2016-09-14 13:22:24 UTC) #14
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/2335723002/120001
4 years, 3 months ago (2016-09-14 14:04:57 UTC) #20
commit-bot: I haz the power
4 years, 3 months ago (2016-09-14 14:06:11 UTC) #22
Message was sent while issue was closed.
Committed patchset #4 (id:120001) as
https://skia.googlesource.com/skia/+/8bbcd5aab81dc0742c3367479c0c9d97363b1203

Powered by Google App Engine
This is Rietveld 408576698