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

Issue 1308903003: Templatize SkPMFloat to support both 1 and 255 biases. (Closed)

Created:
5 years, 3 months ago by mtklein_C
Modified:
5 years, 3 months ago
Reviewers:
reed1, Noel Gordon
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Templatize SkPMFloat to support both 1 and 255 biases. We used to use a 255 bias. It was fast to convert up and down, but weird to multiply (must remember to /255) and is just generally weird to think about. We now use a 1 bias. That's a multiply slower on each side of SkPMColor conversion, but makes future multiplies cheaper, and is easier to think about. I think there a places where both are valuable, particularly in code where we can either isolate the div 255 weirdness to one or two spots, or in code that involves no component multiplication at all. Most code stays <1>. PS2 is about a 15% speedup for the "colorcube" bench on my x86 desktop, and about a 10% speedup on my ARMv7 Nexus 7 Mk.2. The <255> roundtrip bench runs about 20% faster than the <1> bench on my desktop, and about 30% faster on that N7. No GM or SKP pixels change on my desktop. BUG=skia:4117

Patch Set 1 #

Patch Set 2 : use 255 #

Patch Set 3 : misc #

Patch Set 4 : pump the loops for Android #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+117 lines, -73 lines) Patch
M bench/PMFloatBench.cpp View 1 2 3 4 chunks +16 lines, -12 lines 0 comments Download
M src/core/SkPMFloat.h View 2 chunks +6 lines, -3 lines 0 comments Download
M src/core/SkXfermode.cpp View 1 chunk +0 lines, -1 line 0 comments Download
M src/effects/SkColorMatrixFilter.cpp View 4 chunks +8 lines, -8 lines 2 comments Download
M src/opts/SkColorCubeFilter_opts.h View 1 2 2 chunks +9 lines, -6 lines 0 comments Download
M src/opts/SkPMFloat_neon.h View 1 3 chunks +23 lines, -7 lines 0 comments Download
M src/opts/SkPMFloat_none.h View 1 2 chunks +20 lines, -15 lines 0 comments Download
M src/opts/SkPMFloat_sse.h View 1 4 chunks +21 lines, -7 lines 0 comments Download
M src/opts/SkXfermode_opts.h View 6 chunks +10 lines, -10 lines 0 comments Download
M tests/PMFloatTest.cpp View 3 chunks +4 lines, -4 lines 0 comments Download

Messages

Total messages: 13 (4 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1308903003/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1308903003/20001
5 years, 3 months ago (2015-08-27 15:58:03 UTC) #2
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1308903003/40002 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1308903003/40002
5 years, 3 months ago (2015-08-27 16:06:20 UTC) #4
mtklein_C
5 years, 3 months ago (2015-08-27 16:09:47 UTC) #6
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 3 months ago (2015-08-27 16:11:53 UTC) #8
reed1
https://codereview.chromium.org/1308903003/diff/40002/src/effects/SkColorMatrixFilter.cpp File src/effects/SkColorMatrixFilter.cpp (right): https://codereview.chromium.org/1308903003/diff/40002/src/effects/SkColorMatrixFilter.cpp#newcode243 src/effects/SkColorMatrixFilter.cpp:243: float scale = SkPMFloat<1>(x).a(); Hmmm, these use-cases are interesting ...
5 years, 3 months ago (2015-08-27 16:34:42 UTC) #9
mtklein_C
https://codereview.chromium.org/1308903003/diff/40002/src/effects/SkColorMatrixFilter.cpp File src/effects/SkColorMatrixFilter.cpp (right): https://codereview.chromium.org/1308903003/diff/40002/src/effects/SkColorMatrixFilter.cpp#newcode243 src/effects/SkColorMatrixFilter.cpp:243: float scale = SkPMFloat<1>(x).a(); On 2015/08/27 16:34:42, reed1 wrote: ...
5 years, 3 months ago (2015-08-27 17:07:40 UTC) #10
Noel Gordon
Perf-wise, I measured mac air 131ms -> 104ms, Dell win7 151ms -> 125ms
5 years, 3 months ago (2015-08-31 01:12:17 UTC) #11
Noel Gordon
On 2015/08/31 01:12:17, noel gordon wrote: > Perf-wise, I measured mac air 131ms -> 104ms, ...
5 years, 3 months ago (2015-08-31 12:36:37 UTC) #12
mtklein
5 years, 3 months ago (2015-08-31 13:39:36 UTC) #13
On 2015/08/31 12:36:37, noel gordon wrote:
> On 2015/08/31 01:12:17, noel gordon wrote:
> > Perf-wise, I measured mac air 131ms -> 104ms, Dell win7 151ms -> 125ms
> 
> Similar results on hp z620 win7.

Sweet.

Been letting this roll around in the back of my head this weekend.  I think I
can make things simpler, clearer and faster (i.e. both Mikes and Noel all happy)
by collapsing some of the Sk4f / SkPMFloat abstraction.  I'll leave this here
and start a new CL, and hopefully that new CL obsoletes this one.

Powered by Google App Engine
This is Rietveld 408576698