mirror of
https://github.com/webmproject/libwebp.git
synced 2025-02-13 15:32:53 +01:00
move RemapBitReader() from idec.c to bit_reader code
mostly for coherency and later patch. Change-Id: Ica8352d67845b6c5b3153435edfb4646c6f24341
This commit is contained in:
parent
34168ecbe4
commit
54bfffcabc
@ -86,13 +86,6 @@ typedef struct {
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// MemBuffer: incoming data handling
|
// MemBuffer: incoming data handling
|
||||||
|
|
||||||
static void RemapBitReader(VP8BitReader* const br, ptrdiff_t offset) {
|
|
||||||
if (br->buf_ != NULL) {
|
|
||||||
br->buf_ += offset;
|
|
||||||
br->buf_end_ += offset;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static WEBP_INLINE size_t MemDataSize(const MemBuffer* mem) {
|
static WEBP_INLINE size_t MemDataSize(const MemBuffer* mem) {
|
||||||
return (mem->end_ - mem->start_);
|
return (mem->end_ - mem->start_);
|
||||||
}
|
}
|
||||||
@ -129,12 +122,12 @@ static void DoRemap(WebPIDecoder* const idec, ptrdiff_t offset) {
|
|||||||
if (offset != 0) {
|
if (offset != 0) {
|
||||||
int p;
|
int p;
|
||||||
for (p = 0; p <= last_part; ++p) {
|
for (p = 0; p <= last_part; ++p) {
|
||||||
RemapBitReader(dec->parts_ + p, offset);
|
VP8RemapBitReader(dec->parts_ + p, offset);
|
||||||
}
|
}
|
||||||
// Remap partition #0 data pointer to new offset, but only in MAP
|
// Remap partition #0 data pointer to new offset, but only in MAP
|
||||||
// mode (in APPEND mode, partition #0 is copied into a fixed memory).
|
// mode (in APPEND mode, partition #0 is copied into a fixed memory).
|
||||||
if (mem->mode_ == MEM_MODE_MAP) {
|
if (mem->mode_ == MEM_MODE_MAP) {
|
||||||
RemapBitReader(&dec->br_, offset);
|
VP8RemapBitReader(&dec->br_, offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(last_part >= 0);
|
assert(last_part >= 0);
|
||||||
|
@ -35,6 +35,13 @@ void VP8InitBitReader(VP8BitReader* const br,
|
|||||||
br->eof_ = 0;
|
br->eof_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VP8RemapBitReader(VP8BitReader* const br, ptrdiff_t offset) {
|
||||||
|
if (br->buf_ != NULL) {
|
||||||
|
br->buf_ += offset;
|
||||||
|
br->buf_end_ += offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const uint8_t kVP8Log2Range[128] = {
|
const uint8_t kVP8Log2Range[128] = {
|
||||||
7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
|
7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||||
|
@ -141,6 +141,10 @@ struct VP8BitReader {
|
|||||||
void VP8InitBitReader(VP8BitReader* const br,
|
void VP8InitBitReader(VP8BitReader* const br,
|
||||||
const uint8_t* const start, const uint8_t* const end);
|
const uint8_t* const start, const uint8_t* const end);
|
||||||
|
|
||||||
|
// Update internal pointers to displace the byte buffer by the
|
||||||
|
// relative offset 'offset'.
|
||||||
|
void VP8RemapBitReader(VP8BitReader* const br, ptrdiff_t offset);
|
||||||
|
|
||||||
// return the next value made of 'num_bits' bits
|
// return the next value made of 'num_bits' bits
|
||||||
uint32_t VP8GetValue(VP8BitReader* const br, int num_bits);
|
uint32_t VP8GetValue(VP8BitReader* const br, int num_bits);
|
||||||
static WEBP_INLINE uint32_t VP8Get(VP8BitReader* const br) {
|
static WEBP_INLINE uint32_t VP8Get(VP8BitReader* const br) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user