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

Issue 1573943002: sketch hooking into PNG_FILTER_OPTIMIZATIONS (Closed)

Created:
4 years, 11 months ago by mtklein_C
Modified:
4 years, 11 months ago
Reviewers:
msarett, mtklein
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

sketch hooking into PNG_FILTER_OPTIMIZATIONS Local timing says this 4-byte Paeth function takes about 0.3x the time the serial libpng code does, dropping from ~10 cycles per byte to ~2.9. bpp=4 is mainly an easy demo. This approach can work for any bpp up to 16, 1 pixel at a time, at roughly the same cost per pixel. Doing more than 1 pixel at a time is a tricky math problem I have yet to attempt to solve. Everything here can be trivially downgraded to MMX, supporting bpp up to 8. It seems to be a little slower (~3.5 cycles per byte), but it would make the code compatible with every x86 that can still power on. I've tried four approaches: - this way; - doing things naively in 16-bit; - a 16-bit version that requires division by 3 (i.e. mulhi_epu16(..., 0x5580) ); - a mostly 8-bit version of the same. They're all fine, but this one is consistently the fastest I've measured. I'd be happy to settle on the naive 16-bit version too, which would have a very clear implementation that's only minorly slower than this version. The other two are way more complicated, and would require us to draw some serious ASCII diagrams to explain. I have learned that the .skp serialization tests (serialize-8888) have a nice side effect of testing the correctness of these filters! (Since writing the description above, I've bumped things up to {Paeth,Sub,Avg} x { 3 bpp, 4 bpp }.) BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1573943002 Committed: https://skia.googlesource.com/skia/+/372d65cc6ee743944a9fb58a734b3f1eb253b015

Patch Set 1 #

Patch Set 2 : working? #

Patch Set 3 : simpler #

Patch Set 4 : 8-bit #

Patch Set 5 : whoops, ++ #

Patch Set 6 : avoid cmplt_epi8, refine comments #

Patch Set 7 : faster to use correct p for a+b #

Patch Set 8 : missing const #

Patch Set 9 : tweak comments #

Patch Set 10 : start fresh #

Patch Set 11 : typo #

Patch Set 12 : awkwording #

Total comments: 5

Patch Set 13 : move #

Patch Set 14 : quick hackup #

Patch Set 15 : types #

Patch Set 16 : update comments #

Patch Set 17 : another try at 8-bit Avg #

Patch Set 18 : dont bother with Up #

Total comments: 2

Patch Set 19 : bpp=3 #

Patch Set 20 : asserts #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+224 lines, -8 lines) Patch
M gyp/codec.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +1 line, -0 lines 0 comments Download
M src/codec/SkPngCodec.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 7 chunks +26 lines, -8 lines 0 comments Download
A src/codec/SkPngFilters.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +26 lines, -0 lines 0 comments Download
A src/codec/SkPngFilters.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +168 lines, -0 lines 1 comment Download
M third_party/libpng/pnglibconf.h View 1 2 3 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 78 (44 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/1573943002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1573943002/40001
4 years, 11 months ago (2016-01-11 22:55:43 UTC) #3
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared-Trybot on client.skia (JOB_FAILED, http://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared-Trybot/builds/5191)
4 years, 11 months ago (2016-01-11 23:01:28 UTC) #5
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1573943002/170001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1573943002/170001
4 years, 11 months ago (2016-01-26 18:56:36 UTC) #7
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared-Trybot on client.skia (JOB_FAILED, http://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared-Trybot/builds/5566) Build-Ubuntu-Clang-x86_64-Debug-Trybot on ...
4 years, 11 months ago (2016-01-26 18:57:28 UTC) #10
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1573943002/190001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1573943002/190001
4 years, 11 months ago (2016-01-26 18:59:45 UTC) #13
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1573943002/210001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1573943002/210001
4 years, 11 months ago (2016-01-26 19:02:39 UTC) #16
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 11 months ago (2016-01-26 19:13:15 UTC) #21
mtklein_C
Matt, can you run whatever perf tests you do on the other PNG-decoding codec changes? ...
4 years, 11 months ago (2016-01-26 19:15:09 UTC) #24
msarett
Here's a few thoughts. "Matt, can you run whatever perf tests you do on the ...
4 years, 11 months ago (2016-01-26 22:35:02 UTC) #29
mtklein
https://codereview.chromium.org/1573943002/diff/210001/src/codec/SkPngCodec.cpp File src/codec/SkPngCodec.cpp (right): https://codereview.chromium.org/1573943002/diff/210001/src/codec/SkPngCodec.cpp#newcode19 src/codec/SkPngCodec.cpp:19: #if defined(__SSE2__) On 2016/01/26 22:35:02, msarett wrote: > Is ...
4 years, 11 months ago (2016-01-26 22:52:17 UTC) #31
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1573943002/250001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1573943002/250001
4 years, 11 months ago (2016-01-27 00:18:12 UTC) #33
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-Trybot on client.skia (JOB_FAILED, http://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-Trybot/builds/5577) Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared-Trybot on ...
4 years, 11 months ago (2016-01-27 00:19:03 UTC) #35
mtklein_C
https://codereview.chromium.org/1573943002/diff/210001/src/codec/SkPngCodec.cpp File src/codec/SkPngCodec.cpp (right): https://codereview.chromium.org/1573943002/diff/210001/src/codec/SkPngCodec.cpp#newcode19 src/codec/SkPngCodec.cpp:19: #if defined(__SSE2__) I've moved things to a new file, ...
4 years, 11 months ago (2016-01-27 00:21:26 UTC) #36
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1573943002/270001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1573943002/270001
4 years, 11 months ago (2016-01-27 00:22:32 UTC) #38
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 11 months ago (2016-01-27 00:33:34 UTC) #40
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1573943002/290001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1573943002/290001
4 years, 11 months ago (2016-01-27 00:35:31 UTC) #42
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared-Trybot on client.skia (JOB_FAILED, http://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared-Trybot/builds/5574)
4 years, 11 months ago (2016-01-27 00:39:15 UTC) #44
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1573943002/290001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1573943002/290001
4 years, 11 months ago (2016-01-27 00:40:04 UTC) #46
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared-Trybot on client.skia (JOB_FAILED, http://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared-Trybot/builds/5575)
4 years, 11 months ago (2016-01-27 00:43:25 UTC) #48
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1573943002/270001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1573943002/270001
4 years, 11 months ago (2016-01-27 00:43:54 UTC) #51
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 11 months ago (2016-01-27 00:43:57 UTC) #53
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1573943002/310001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1573943002/310001
4 years, 11 months ago (2016-01-27 13:27:30 UTC) #56
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 11 months ago (2016-01-27 13:38:37 UTC) #58
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1573943002/330001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1573943002/330001
4 years, 11 months ago (2016-01-27 13:52:51 UTC) #60
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 11 months ago (2016-01-27 14:03:12 UTC) #62
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1573943002/350001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1573943002/350001
4 years, 11 months ago (2016-01-27 14:13:06 UTC) #64
mtklein_C
I think I've got Paeth, Avg, and Sub all correct and usefully faster than the ...
4 years, 11 months ago (2016-01-27 14:19:27 UTC) #65
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 11 months ago (2016-01-27 14:24:37 UTC) #67
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1573943002/390001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1573943002/390001
4 years, 11 months ago (2016-01-27 20:18:42 UTC) #69
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 11 months ago (2016-01-27 20:31:05 UTC) #71
msarett
LGTM Woohoo! https://codereview.chromium.org/1573943002/diff/350001/src/codec/SkPngFilters.cpp File src/codec/SkPngFilters.cpp (right): https://codereview.chromium.org/1573943002/diff/350001/src/codec/SkPngFilters.cpp#newcode79 src/codec/SkPngFilters.cpp:79: // SSE 4.1+ would be: return _mm_blendv_epi8(e,t,c); ...
4 years, 11 months ago (2016-01-27 20:56:11 UTC) #72
mtklein
https://codereview.chromium.org/1573943002/diff/350001/src/codec/SkPngFilters.cpp File src/codec/SkPngFilters.cpp (right): https://codereview.chromium.org/1573943002/diff/350001/src/codec/SkPngFilters.cpp#newcode79 src/codec/SkPngFilters.cpp:79: // SSE 4.1+ would be: return _mm_blendv_epi8(e,t,c); On 2016/01/27 ...
4 years, 11 months ago (2016-01-27 21:00:16 UTC) #74
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1573943002/390001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1573943002/390001
4 years, 11 months ago (2016-01-27 21:00:52 UTC) #76
commit-bot: I haz the power
4 years, 11 months ago (2016-01-27 21:01:44 UTC) #78
Message was sent while issue was closed.
Committed patchset #20 (id:390001) as
https://skia.googlesource.com/skia/+/372d65cc6ee743944a9fb58a734b3f1eb253b015

Powered by Google App Engine
This is Rietveld 408576698