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

Issue 2801413002: color: Enable color conversion in image decoder caches (Closed)

Created:
3 years, 8 months ago by ccameron
Modified:
3 years, 7 months ago
Reviewers:
msarett1, vmpstr
CC:
chromium-reviews, krit, drott+blinkwatch_chromium.org, blink-reviews-platform-graphics_chromium.org, dshwang, pdr+graphicswatchlist_chromium.org, fmalita+watch_chromium.org, Rik, Stephen Chennney, Justin Novosad, blink-reviews, cc-bugs_chromium.org, ajuma+watch_chromium.org, kinuko+watch, rwlbuis
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

color: Enable color conversion in image decoder caches In SoftwareImageDecodeCache, specify the color space for readPixels(). In the case of scalePixels, don't specify a color space, but interpret the colors as being in this space at the end. Make DecodingImageGenerator::onGetPixels() respect this color space by performing conversion if needed. In GpuImageDecodeCache, call makeColorSpace on the decoder-backed image before uploading pixels. Add TODOs to make this call after upload. BUG=706613 CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel Review-Url: https://codereview.chromium.org/2801413002 Cr-Commit-Position: refs/heads/master@{#464581} Committed: https://chromium.googlesource.com/chromium/src/+/11694bf1f0daf864723ed81304720ba949db4517

Patch Set 1 #

Total comments: 9

Patch Set 2 : Review feedback #

Patch Set 3 : Rebase #

Total comments: 5

Patch Set 4 : Dont use readPixels #

Patch Set 5 : Rebase #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+56 lines, -33 lines) Patch
M cc/tiles/gpu_image_decode_cache.cc View 1 2 3 3 chunks +9 lines, -5 lines 0 comments Download
M cc/tiles/software_image_decode_cache.h View 1 2 3 4 1 chunk +12 lines, -10 lines 0 comments Download
M cc/tiles/software_image_decode_cache.cc View 1 2 3 4 9 chunks +35 lines, -18 lines 2 comments Download

Messages

Total messages: 24 (11 generated)
ccameron
The software solution here is what I'd like to keep it at (it doesn't do ...
3 years, 8 months ago (2017-04-07 23:52:09 UTC) #6
msarett1
General idea looks good to me. Would prefer to consider this after https://codereview.chromium.org/2787053004/ lands. https://codereview.chromium.org/2801413002/diff/1/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp ...
3 years, 8 months ago (2017-04-10 15:27:21 UTC) #9
ccameron
Good point -- there's no point in playing diff-pasta -- I've rebased this to be ...
3 years, 8 months ago (2017-04-10 20:04:06 UTC) #10
msarett1
nit: Update commit message. Some general questions about the software implementation... It looks like you ...
3 years, 8 months ago (2017-04-10 21:02:53 UTC) #11
ccameron
Updated to use readPixels. I also added a TRACE_EVENT for the conversion -- feel free ...
3 years, 8 months ago (2017-04-10 23:18:30 UTC) #12
msarett1
I'm still not sure I understand where the conversion is happening for scaled/subrect decodes. Is ...
3 years, 8 months ago (2017-04-12 12:59:17 UTC) #13
msarett1
> I also added a TRACE_EVENT for the conversion -- feel free to roll that ...
3 years, 8 months ago (2017-04-13 17:45:17 UTC) #14
ccameron
Rebased off of your patch. On 2017/04/12 12:59:17, msarett1 wrote: > I'm still not sure ...
3 years, 8 months ago (2017-04-13 21:25:13 UTC) #15
msarett1
On 2017/04/13 21:25:13, ccameron wrote: > Rebased off of your patch. > > On 2017/04/12 ...
3 years, 8 months ago (2017-04-13 21:26:16 UTC) #16
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/2801413002/80001
3 years, 8 months ago (2017-04-13 21:30:57 UTC) #18
commit-bot: I haz the power
Committed patchset #5 (id:80001) as https://chromium.googlesource.com/chromium/src/+/11694bf1f0daf864723ed81304720ba949db4517
3 years, 8 months ago (2017-04-13 22:44:04 UTC) #21
vmpstr
https://codereview.chromium.org/2801413002/diff/80001/cc/tiles/software_image_decode_cache.cc File cc/tiles/software_image_decode_cache.cc (right): https://codereview.chromium.org/2801413002/diff/80001/cc/tiles/software_image_decode_cache.cc#newcode584 cc/tiles/software_image_decode_cache.cc:584: if (target_color_space) { Is this the right spot to ...
3 years, 7 months ago (2017-04-27 22:49:45 UTC) #23
ccameron
3 years, 7 months ago (2017-05-03 21:17:14 UTC) #24
Message was sent while issue was closed.
https://codereview.chromium.org/2801413002/diff/80001/cc/tiles/software_image...
File cc/tiles/software_image_decode_cache.cc (right):

https://codereview.chromium.org/2801413002/diff/80001/cc/tiles/software_image...
cc/tiles/software_image_decode_cache.cc:584: if (target_color_space) {
On 2017/04/27 22:49:45, vmpstr wrote:
> Is this the right spot to do this?
> 
> From my understanding doing this conversion will essentially decode the image
> into malloc'ed memory and return a new image for that. In the block below,
we'll
> then call read pixels which will just copy the data into discardable.
> 
> Is there a way to first read the pixels and then convert them? Or is there a
way
> to specify our own memory in the makeColorSpace function? I'm trying to avoid
a
> full decoded copy here if possible.

This understanding is correct.

So, if (target_color_space) then
- the call to makeColorSpace will trigger the decode and color conversion
- readPixels will copy that to the buffer

If (!target_color_space) then
- the call to readPixels will trigger the decode into the buffer

It's true, we're doing an extra copy. A more direct scheme would be to have
something like "SkImage::readPixelsIntoColorSpace".

I'll need to do a power analysis of all of this to see what the problematic
areas are. IIRC, the color conversion cost is 2-3x the decode (even when done at
the same time as the decode), so this may be more marginal.

Of note is that in the case of GPU raster, doing the color conversion this way
(uploading the original pixels to the GPU and then doing a conversion into a new
buffer on the GPU) proves cheaper.

Also of note is that we should be saying "if target_color_space and
target_color_space isn't approximately equal to the image color's space".

Powered by Google App Engine
This is Rietveld 408576698