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

Issue 1259083003: Do not consolidate data in BMPImageDecoder (Closed)

Created:
5 years, 4 months ago by scroggo_chromium
Modified:
5 years, 3 months ago
CC:
blink-reviews
Base URL:
https://chromium.googlesource.com/chromium/blink.git@SegmentedBuffer
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Do not consolidate data in BMPImageDecoder In BMPImageDecoder, never call SharedBuffer::data(), which potentially copies all the data. Instead, do the following: - Read directly from the SharedBuffer when it is safe to do so. e.g. when only one byte is needed. We already know there is enough data, and getSomeData will return at least a byte if there is enough data. - Use a FastSharedBufferReader when we may be on a segment boundary. As a result, we make fewer copies when decoding BMPs. We never call SharedBuffer::data(), which copies up to the entire encoded data received so far. Occasionally we will make small copies when a two or four byte number is on a segment boundary. Add a setter to FastSharedBufferReader to update its SharedBuffer, so the BMPImageReader can have one as a member, which it will reuse across calls. Remove BIG_ENDIAN, and eliminate another memcpy that was there to support it. Using my modified version of ImageDecodeBench (see crrev.com/1145373003), I see a slight speedup as compared to the old version which relied on SharedBuffer::data(). (My data can be found here: [1].) This matches my expectations, since the new version is copying less data. Using a version of ImageDecodeBench with a premerged buffer (see crrev.com/1318713005), I still see a speed improvement, although it is very small. (See sheet 2 of the above spreadsheet). [1] https://docs.google.com/a/google.com/spreadsheets/d/1GN2FDytKvkdZzV-WF4IEQaYQF65wa4bRxG67bNgpjAE/edit?usp=sharing BUG=467772 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=201811

Patch Set 1 #

Patch Set 2 : Remove some comments. #

Patch Set 3 : Read exactly the amount needed in getConsecutiveData #

Total comments: 14

Patch Set 4 : Make FastSharedBufferReader a member #

Total comments: 18

Patch Set 5 : Respond to Peter's comments in patch set 4 #

Total comments: 2

Patch Set 6 : getByte -> readUint8 #

Patch Set 7 : Consistent inlining #

Total comments: 1

Patch Set 8 : Fix a comment #

Patch Set 9 : Do not use a raw pointer #

Unified diffs Side-by-side diffs Delta from patch set Stats (+73 lines, -52 lines) Patch
M Source/platform/image-decoders/FastSharedBufferReader.h View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -0 lines 0 comments Download
M Source/platform/image-decoders/FastSharedBufferReader.cpp View 1 2 3 4 5 6 7 8 1 chunk +10 lines, -0 lines 0 comments Download
M Source/platform/image-decoders/bmp/BMPImageDecoder.h View 1 chunk +0 lines, -5 lines 0 comments Download
M Source/platform/image-decoders/bmp/BMPImageDecoder.cpp View 1 2 chunks +7 lines, -2 lines 0 comments Download
M Source/platform/image-decoders/bmp/BMPImageReader.h View 1 2 3 4 5 6 6 chunks +35 lines, -31 lines 0 comments Download
M Source/platform/image-decoders/bmp/BMPImageReader.cpp View 1 2 3 4 5 6 7 7 chunks +15 lines, -12 lines 0 comments Download
M Source/platform/image-decoders/ico/ICOImageDecoder.h View 1 chunk +4 lines, -2 lines 0 comments Download

Depends on Patchset:

Dependent Patchsets:

Messages

Total messages: 17 (4 generated)
scroggo_chromium
Noel, I know we discussed updating ImageDecodeBench to have two modes: pre-merged SharedBuffer (imitating the ...
5 years, 3 months ago (2015-08-31 19:07:01 UTC) #2
Peter Kasting
https://chromiumcodereview.appspot.com/1259083003/diff/40001/Source/platform/image-decoders/bmp/BMPImageReader.cpp File Source/platform/image-decoders/bmp/BMPImageReader.cpp (right): https://chromiumcodereview.appspot.com/1259083003/diff/40001/Source/platform/image-decoders/bmp/BMPImageReader.cpp#newcode280 Source/platform/image-decoders/bmp/BMPImageReader.cpp:280: if (m_infoHeader.biSize >= 36) { Nit: No {} https://chromiumcodereview.appspot.com/1259083003/diff/40001/Source/platform/image-decoders/bmp/BMPImageReader.h ...
5 years, 3 months ago (2015-08-31 19:53:42 UTC) #3
scroggo_chromium
I've updated the test to have an option to decode in chunks (see crrev.com/1318713005, which ...
5 years, 3 months ago (2015-09-01 22:50:30 UTC) #4
Peter Kasting
https://codereview.chromium.org/1259083003/diff/40001/Source/platform/image-decoders/bmp/BMPImageReader.h File Source/platform/image-decoders/bmp/BMPImageReader.h (right): https://codereview.chromium.org/1259083003/diff/40001/Source/platform/image-decoders/bmp/BMPImageReader.h#newcode37 Source/platform/image-decoders/bmp/BMPImageReader.h:37: #include <stdint.h> On 2015/09/01 22:50:30, scroggo_chromium wrote: > On ...
5 years, 3 months ago (2015-09-02 22:08:55 UTC) #5
scroggo_chromium
https://chromiumcodereview.appspot.com/1259083003/diff/60001/Source/platform/image-decoders/FastSharedBufferReader.h File Source/platform/image-decoders/FastSharedBufferReader.h (right): https://chromiumcodereview.appspot.com/1259083003/diff/60001/Source/platform/image-decoders/FastSharedBufferReader.h#newcode49 Source/platform/image-decoders/FastSharedBufferReader.h:49: void setData(SharedBuffer*); On 2015/09/02 22:08:54, Peter Kasting wrote: > ...
5 years, 3 months ago (2015-09-02 23:01:08 UTC) #6
Peter Kasting
LGTM https://chromiumcodereview.appspot.com/1259083003/diff/60001/Source/platform/image-decoders/FastSharedBufferReader.h File Source/platform/image-decoders/FastSharedBufferReader.h (right): https://chromiumcodereview.appspot.com/1259083003/diff/60001/Source/platform/image-decoders/FastSharedBufferReader.h#newcode49 Source/platform/image-decoders/FastSharedBufferReader.h:49: void setData(SharedBuffer*); On 2015/09/02 23:01:07, scroggo_chromium wrote: > ...
5 years, 3 months ago (2015-09-02 23:48:44 UTC) #7
scroggo_chromium
https://chromiumcodereview.appspot.com/1259083003/diff/80001/Source/platform/image-decoders/bmp/BMPImageReader.h File Source/platform/image-decoders/bmp/BMPImageReader.h (right): https://chromiumcodereview.appspot.com/1259083003/diff/80001/Source/platform/image-decoders/bmp/BMPImageReader.h#newcode240 Source/platform/image-decoders/bmp/BMPImageReader.h:240: uint8_t getByte(size_t offset) On 2015/09/02 23:48:44, Peter Kasting wrote: ...
5 years, 3 months ago (2015-09-03 15:28:36 UTC) #8
Peter Kasting
Nice. LGTM (again) https://chromiumcodereview.appspot.com/1259083003/diff/120001/Source/platform/image-decoders/bmp/BMPImageReader.cpp File Source/platform/image-decoders/bmp/BMPImageReader.cpp (right): https://chromiumcodereview.appspot.com/1259083003/diff/120001/Source/platform/image-decoders/bmp/BMPImageReader.cpp#newcode547 Source/platform/image-decoders/bmp/BMPImageReader.cpp:547: // Skip padding byte (not present ...
5 years, 3 months ago (2015-09-03 17:20:12 UTC) #9
scroggo_chromium
Florin, would you mind taking a look at the PassRefPtr semantics in FastSharedBufferReader (the difference ...
5 years, 3 months ago (2015-09-03 22:04:19 UTC) #11
f(malita)
On 2015/09/03 22:04:19, scroggo_chromium wrote: > Florin, would you mind taking a look at the ...
5 years, 3 months ago (2015-09-04 13:06:07 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1259083003/160001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1259083003/160001
5 years, 3 months ago (2015-09-04 16:04:12 UTC) #15
commit-bot: I haz the power
Committed patchset #9 (id:160001) as https://src.chromium.org/viewvc/blink?view=rev&revision=201811
5 years, 3 months ago (2015-09-04 18:10:12 UTC) #16
scroggo
5 years, 3 months ago (2015-09-14 13:30:10 UTC) #17
Message was sent while issue was closed.
A revert of this CL (patchset #9 id:160001) has been created in
https://codereview.chromium.org/1337263003/ by scroggo@google.com.

The reason for reverting is: crbug.com/530279

This comment [1] describes what needs to be done to reland.

[1] https://code.google.com/p/chromium/issues/detail?id=530279#c1.

Powered by Google App Engine
This is Rietveld 408576698