mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-19 07:20:02 +02:00
make the bitreader preload at least 8bits, instead of post-load them
(this makes initialization easier and will be helpful for incremental decoding). Modify ParsePartitions() to accommodate for truncated input. Change-Id: I62f52078d6b7a2314a11880a20d9eac5b4714bd0
This commit is contained in:
@ -18,16 +18,17 @@ extern "C" {
|
||||
//-----------------------------------------------------------------------------
|
||||
// VP8BitReader
|
||||
|
||||
void VP8Init(VP8BitReader* const br, const uint8_t* buf, uint32_t size) {
|
||||
void VP8InitBitReader(VP8BitReader* const br,
|
||||
const uint8_t* const start, const uint8_t* const end) {
|
||||
assert(br);
|
||||
assert(buf);
|
||||
br->range_ = 255 - 1;
|
||||
br->buf_ = buf;
|
||||
br->buf_end_ = buf + size;
|
||||
// Need two initial bytes.
|
||||
br->value_ = (VP8GetByte(br) << 8) | VP8GetByte(br);
|
||||
br->left_ = -8;
|
||||
br->eof_ = 0;
|
||||
assert(start);
|
||||
assert(start <= end);
|
||||
br->range_ = 255 - 1;
|
||||
br->buf_ = start;
|
||||
br->buf_end_ = end;
|
||||
br->value_ = 0;
|
||||
br->missing_ = 8;
|
||||
br->eof_ = 0;
|
||||
}
|
||||
|
||||
const uint8_t kVP8Log2Range[128] = {
|
||||
|
Reference in New Issue
Block a user