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

Issue 1230033004: Allow creating multiple scanline decoders. (Closed)

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

Description

Allow creating multiple scanline decoders. Make getScanlineDecoder return a new object each time, which is owned by the caller, and independent from any existing scanline decoders and the SkCodec itself. Since the SkCodec already contains the entire state machine, and it is used by the scanline decoders, simply create a new SkCodec which is now owned by the scanline decoder. Move code that cleans up after using a scanline decoder into its destructor One side effect is that creating the first scanline decoder requires a duplication of the stream and re-reading the header. (With some more complexity/changes, we could pass the state machine to the scanline decoder and make the SkCodec recreate its own state machine instead.) The typical client of the scanline decoder (region decoder) uses an SkMemoryStream, so the duplication is cheap, although we should consider the extra time to reread the header/recreate the state machine. (If/when we use the scanline decoder for other purposes, where the stream may not be cheaply duplicated, we should consider passing the state machine.) One (intended) result of this change is that a client can create a new scanline decoder in a new thread, and decode different pieces of the image simultaneously. In SkPngCodec::decodePalette, use fBitDepth rather than a parameter. Committed: https://skia.googlesource.com/skia/+/9b2cdbf4811477487f107a78edc130c733b309ea

Patch Set 1 #

Patch Set 2 : Cleanups #

Total comments: 3

Patch Set 3 : Remove outdated comment in SkScanlineDecoder.h #

Patch Set 4 : rebase #

Patch Set 5 : Use fNumberPasses from the correct SkPngCodec. #

Total comments: 1

Patch Set 6 : Progressive scanline decoder needs to handle rewind on first call. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+116 lines, -158 lines) Patch
M bench/nanobench.cpp View 1 2 3 2 chunks +3 lines, -2 lines 0 comments Download
M bench/subset/SubsetSingleBench.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M bench/subset/SubsetTranslateBench.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M bench/subset/SubsetZoomBench.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M dm/DMSrcSink.cpp View 1 4 chunks +7 lines, -7 lines 0 comments Download
M include/codec/SkCodec.h View 1 5 chunks +7 lines, -40 lines 0 comments Download
M include/codec/SkScanlineDecoder.h View 1 2 1 chunk +0 lines, -7 lines 0 comments Download
M src/codec/SkCodec.cpp View 3 chunks +2 lines, -8 lines 0 comments Download
M src/codec/SkCodec_libpng.h View 3 chunks +4 lines, -2 lines 0 comments Download
M src/codec/SkCodec_libpng.cpp View 1 2 3 4 5 11 chunks +37 lines, -39 lines 0 comments Download
M src/codec/SkJpegCodec.h View 1 chunk +0 lines, -6 lines 0 comments Download
M src/codec/SkJpegCodec.cpp View 5 chunks +26 lines, -31 lines 0 comments Download
M tests/CodexTest.cpp View 1 3 chunks +24 lines, -10 lines 0 comments Download

Messages

Total messages: 19 (8 generated)
scroggo
https://codereview.chromium.org/1230033004/diff/20001/src/codec/SkCodec_libpng.cpp File src/codec/SkCodec_libpng.cpp (right): https://codereview.chromium.org/1230033004/diff/20001/src/codec/SkCodec_libpng.cpp#newcode587 src/codec/SkCodec_libpng.cpp:587: // FIXME: Is this necessary? I copied the below ...
5 years, 5 months ago (2015-07-09 20:52:31 UTC) #2
msarett
LGTM! I think this is a great change. Glad we are questioning the need to ...
5 years, 5 months ago (2015-07-09 21:32:26 UTC) #3
scroggo
ping - I'll still need an API review for the changes to SkCodec.h and SkScanlineDecoder.h
5 years, 5 months ago (2015-07-10 15:05:30 UTC) #4
djsollen
api lgtm
5 years, 5 months ago (2015-07-10 15:20:41 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1230033004/40001
5 years, 5 months ago (2015-07-10 17:19:19 UTC) #7
commit-bot: I haz the power
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/1908)
5 years, 5 months ago (2015-07-10 17:31:28 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1230033004/80001
5 years, 5 months ago (2015-07-10 17:38:54 UTC) #12
commit-bot: I haz the power
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/1928)
5 years, 5 months ago (2015-07-10 17:42:37 UTC) #14
scroggo
lgtm Thank you try bots, for catching all my bugs! This version should work... https://codereview.chromium.org/1230033004/diff/80001/src/codec/SkCodec_libpng.cpp ...
5 years, 5 months ago (2015-07-10 18:59:30 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1230033004/100001
5 years, 5 months ago (2015-07-10 18:59:42 UTC) #18
commit-bot: I haz the power
5 years, 5 months ago (2015-07-10 19:07:06 UTC) #19
Message was sent while issue was closed.
Committed patchset #6 (id:100001) as
https://skia.googlesource.com/skia/+/9b2cdbf4811477487f107a78edc130c733b309ea

Powered by Google App Engine
This is Rietveld 408576698