mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 13:48:21 +01:00
little speed up for VP8BitUpdate()
1% faster on average Patch by Somnath Banerjee (somnath at google dot com) Change-Id: I44cbc125024d3b7ba8621643e9161b72f0eac281
This commit is contained in:
parent
e71418f899
commit
af10db4aa4
@ -61,15 +61,16 @@ static inline uint32_t VP8GetByte(VP8BitReader* const br) {
|
|||||||
|
|
||||||
static inline uint32_t VP8BitUpdate(VP8BitReader* const br, uint32_t split) {
|
static inline uint32_t VP8BitUpdate(VP8BitReader* const br, uint32_t split) {
|
||||||
uint32_t bit;
|
uint32_t bit;
|
||||||
|
const uint32_t value_split = (split + 1) << 8;
|
||||||
// Make sure we have a least 8 bits in 'value_'
|
// Make sure we have a least 8 bits in 'value_'
|
||||||
if (br->missing_ > 0) {
|
if (br->missing_ > 0) {
|
||||||
br->value_ |= VP8GetByte(br) << br->missing_;
|
br->value_ |= VP8GetByte(br) << br->missing_;
|
||||||
br->missing_ -= 8;
|
br->missing_ -= 8;
|
||||||
}
|
}
|
||||||
bit = ((br->value_ >> 8) > split);
|
bit = (br->value_ >= value_split);
|
||||||
if (bit) {
|
if (bit) {
|
||||||
br->range_ -= split + 1;
|
br->range_ -= split + 1;
|
||||||
br->value_ -= (split + 1) << 8;
|
br->value_ -= value_split;
|
||||||
} else {
|
} else {
|
||||||
br->range_ = split;
|
br->range_ = split;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user