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

Issue 15466004: Make image decoders faster by refactoring hot loops that fills the lines of ImageFrame. (Closed)

Created:
7 years, 7 months ago by kbalazs_
Modified:
7 years, 6 months ago
CC:
blink-reviews, jamesr, loislo+blink_chromium.org, eae+blinkwatch, yurys+blink_chromium.org, abarth-chromium, danakj, Rik, adamk+blink_chromium.org, Stephen Chennney, jeez, pdr.
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

The original idea came from the work of Allan Jensen landed in WebKit as r150252. He eliminated the branches in PNGImageDecoder::rowAvailable to make it benefit from auto vectorization. I was refactoring that to a more general form by adding helpers into ImageDecoder.h. Also I was changing the loops so that this change is a performance win without auto vectorization as well (which we do not use by default, only with -O3 or -ftree-vectorize). I measured the performance gain with callgrind by comparing the inclusive cost of the affected function. I used simple local pages with a few image for benchmarking. These are the performance gain for differet image formats: * opaque PNG: 7.8% faster * PNG with alpha: 24% faster * JPG (without jpeg-turbo or with non-RGB/BGR format, like CMYK): 24% faster

Patch Set 1 #

Total comments: 5

Patch Set 2 : Make image decoders faster by refactoring hot loops that fills the lines of ImageFrame. #

Total comments: 4

Patch Set 3 : Make image decoders faster by refactoring hot loops that fills the lines of ImageFrame. #

Total comments: 1

Patch Set 4 : Make image decoders faster by refactoring hot loops that fills the lines of ImageFrame. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+67 lines, -25 lines) Patch
M Source/core/platform/image-decoders/ImageDecoder.h View 1 2 3 1 chunk +37 lines, -5 lines 0 comments Download
M Source/core/platform/image-decoders/jpeg/JPEGImageDecoder.cpp View 1 2 1 chunk +1 line, -11 lines 0 comments Download
M Source/core/platform/image-decoders/png/PNGImageDecoder.cpp View 1 2 1 chunk +19 lines, -7 lines 1 comment Download
M Source/core/platform/image-decoders/webp/WEBPImageDecoder.cpp View 1 2 1 chunk +10 lines, -2 lines 0 comments Download

Messages

Total messages: 32 (0 generated)
jochen (gone - plz use gerrit)
lgtm
7 years, 7 months ago (2013-05-24 06:48:52 UTC) #1
Peter Kasting
When you post a patch for review, please use the publish+mail button to send a ...
7 years, 7 months ago (2013-05-24 19:03:12 UTC) #2
Peter Kasting
The idea of this patch is fine, but the execution isn't. First, it's not correct ...
7 years, 7 months ago (2013-05-24 22:39:01 UTC) #3
Noel Gordon
https://chromiumcodereview.appspot.com/15466004/diff/1/Source/core/platform/graphics/Color.cpp File Source/core/platform/graphics/Color.cpp (right): https://chromiumcodereview.appspot.com/15466004/diff/1/Source/core/platform/graphics/Color.cpp#newcode439 Source/core/platform/graphics/Color.cpp:439: WTF::fastDivideBy255(color.blue() * alpha + 254), The Color.cpp change should ...
7 years, 7 months ago (2013-05-25 04:40:56 UTC) #4
Noel Gordon
https://chromiumcodereview.appspot.com/15466004/diff/1/Source/core/platform/image-decoders/png/PNGImageDecoder.cpp File Source/core/platform/image-decoders/png/PNGImageDecoder.cpp (right): https://chromiumcodereview.appspot.com/15466004/diff/1/Source/core/platform/image-decoders/png/PNGImageDecoder.cpp#newcode421 Source/core/platform/image-decoders/png/PNGImageDecoder.cpp:421: unsigned char r = WTF::fastDivideBy255(pixel[0] * a); Agree with ...
7 years, 7 months ago (2013-05-25 05:58:26 UTC) #5
kbalazs_
Looking at crbug.com/234071 it seems like you did not get to an agreement yet. For ...
7 years, 6 months ago (2013-05-28 23:39:34 UTC) #6
Peter Kasting
On 2013/05/28 23:39:34, kbalazs wrote: > The main purpose of this patch is to turn ...
7 years, 6 months ago (2013-05-29 00:01:42 UTC) #7
kbalazs_
> > OK... I'm not sure I follow that and it sounds like a bigger ...
7 years, 6 months ago (2013-05-29 11:18:12 UTC) #8
Peter Kasting
On 2013/05/29 11:18:12, kbalazs wrote: > Forget about the template thing, it was a silly ...
7 years, 6 months ago (2013-05-29 18:21:11 UTC) #9
kbalazs_
I have to redefine the purpose of this change. Auto vectorization is only available if ...
7 years, 6 months ago (2013-05-30 18:50:30 UTC) #10
kbalazs_
Hm, I did not even notice I already got an lgtml on this. Can I ...
7 years, 6 months ago (2013-05-31 09:55:52 UTC) #11
Peter Kasting
Cool, this is more what I was thinking. Some comments below on minor issues. I ...
7 years, 6 months ago (2013-06-01 01:22:12 UTC) #12
Noel Gordon
The current change appears to break webp decoding of alpha images with color profiles. It's ...
7 years, 6 months ago (2013-06-03 15:08:23 UTC) #13
kbalazs_
On 2013/06/01 01:22:12, Peter Kasting wrote: > Cool, this is more what I was thinking. ...
7 years, 6 months ago (2013-06-05 11:04:35 UTC) #14
kbalazs_
You are right Noel, the patch has been grown too huge. I am going to ...
7 years, 6 months ago (2013-06-05 11:05:56 UTC) #15
kbalazs_
On 2013/06/03 15:08:23, Noel Gordon (Google) wrote: > The current change appears to break webp ...
7 years, 6 months ago (2013-06-05 11:24:46 UTC) #16
kbalazs_
On 2013/06/03 15:08:23, Noel Gordon (Google) wrote: > The current change appears to break webp ...
7 years, 6 months ago (2013-06-05 11:29:26 UTC) #17
kbalazs_
On 2013/06/05 11:29:26, kbalazs wrote: > On 2013/06/03 15:08:23, Noel Gordon (Google) wrote: > > ...
7 years, 6 months ago (2013-06-05 12:28:29 UTC) #18
Noel Gordon
On 2013/06/05 12:28:29, kbalazs wrote: > Nevermind, I see, I should take care of premultiply. ...
7 years, 6 months ago (2013-06-05 13:57:40 UTC) #19
Noel Gordon
On 2013/06/05 11:24:46, kbalazs wrote: > On 2013/06/03 15:08:23, Noel Gordon (Google) wrote: < > ...
7 years, 6 months ago (2013-06-05 14:20:15 UTC) #20
Noel Gordon
Another way to think about it: for jpeg images, the premultiplied pixels are equal to ...
7 years, 6 months ago (2013-06-05 14:28:19 UTC) #21
kbalazs_
On 2013/06/05 14:20:15, Noel Gordon (Google) wrote: > On 2013/06/05 11:24:46, kbalazs wrote: > > ...
7 years, 6 months ago (2013-06-05 21:20:33 UTC) #22
kbalazs_
ping
7 years, 6 months ago (2013-06-12 10:18:29 UTC) #23
Peter Kasting
I don't know if you were waiting on me here. I basically defer to Noel. ...
7 years, 6 months ago (2013-06-12 18:47:06 UTC) #24
kbalazs_
> https://codereview.chromium.org/15466004/diff/27001/Source/core/platform/image-decoders/ImageDecoder.h#newcode244 > Source/core/platform/image-decoders/ImageDecoder.h:244: void > checkAddress(PixelData* address) > I would just omit this. The ...
7 years, 6 months ago (2013-06-15 09:02:52 UTC) #25
kbalazs_
I'm going to land it if there is no opposition.
7 years, 6 months ago (2013-06-18 19:35:51 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/b.kelemen@sisa.samsung.com/15466004/35001
7 years, 6 months ago (2013-06-19 08:03:15 UTC) #27
commit-bot: I haz the power
Retried try job too often on linux_layout_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_layout_rel&number=13287
7 years, 6 months ago (2013-06-19 08:23:05 UTC) #28
Noel Gordon
On 2013/06/18 19:35:51, kbalazs wrote: > I'm going to land it if there is no ...
7 years, 6 months ago (2013-06-19 13:22:54 UTC) #29
Noel Gordon
Here's my proposal: 1) As mentioned before, could we remove the webp changes form this ...
7 years, 6 months ago (2013-06-19 13:34:59 UTC) #30
Noel Gordon
https://codereview.chromium.org/15466004/diff/35001/Source/core/platform/image-decoders/png/PNGImageDecoder.cpp File Source/core/platform/image-decoders/png/PNGImageDecoder.cpp (right): https://codereview.chromium.org/15466004/diff/35001/Source/core/platform/image-decoders/png/PNGImageDecoder.cpp#newcode500 Source/core/platform/image-decoders/png/PNGImageDecoder.cpp:500: buffer.setRGBAPremultiply(address + x, pixel[3], pixel[0], pixel[1], pixel[2]); This and ...
7 years, 6 months ago (2013-06-19 13:39:28 UTC) #31
kbalazs_
7 years, 6 months ago (2013-06-19 14:22:14 UTC) #32
On 2013/06/19 13:39:28, Noel Gordon (Google) wrote:
>
https://codereview.chromium.org/15466004/diff/35001/Source/core/platform/imag...
> File Source/core/platform/image-decoders/png/PNGImageDecoder.cpp (right):
> 
>
https://codereview.chromium.org/15466004/diff/35001/Source/core/platform/imag...
> Source/core/platform/image-decoders/png/PNGImageDecoder.cpp:500:
> buffer.setRGBAPremultiply(address + x, pixel[3], pixel[0], pixel[1],
pixel[2]);
> This and (line 505) can't be right and it's the cause of the test failures.

D'oh, finally I messed it up. Let's then go with just png first (which was my
original intent btw). I'm going to close this and upload it to a clean one.

Powered by Google App Engine
This is Rietveld 408576698