From af10db4aa47b4c3a26d3cb035355239d767f3822 Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Sun, 29 May 2011 22:35:44 -0700 Subject: [PATCH] little speed up for VP8BitUpdate() 1% faster on average Patch by Somnath Banerjee (somnath at google dot com) Change-Id: I44cbc125024d3b7ba8621643e9161b72f0eac281 --- src/dec/bits.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dec/bits.h b/src/dec/bits.h index e0572e4b..35bd78f3 100644 --- a/src/dec/bits.h +++ b/src/dec/bits.h @@ -61,15 +61,16 @@ static inline uint32_t VP8GetByte(VP8BitReader* const br) { static inline uint32_t VP8BitUpdate(VP8BitReader* const br, uint32_t split) { uint32_t bit; + const uint32_t value_split = (split + 1) << 8; // Make sure we have a least 8 bits in 'value_' if (br->missing_ > 0) { br->value_ |= VP8GetByte(br) << br->missing_; br->missing_ -= 8; } - bit = ((br->value_ >> 8) > split); + bit = (br->value_ >= value_split); if (bit) { br->range_ -= split + 1; - br->value_ -= (split + 1) << 8; + br->value_ -= value_split; } else { br->range_ = split; }