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

Using my modified version of ImageDecodeBench (see,
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, I still see a speed improvement, although it is
very small. (See sheet 2 of the above spreadsheet).



Review URL:

git-svn-id: svn:// bbb929c8-8fbe-4397-9dbb-9b2b20218538
7 files changed
tree: 1b1f0157428117436f4a32c88d9b98ff9dafcf7c
  1. third_party/