Lines Matching refs:br
134 void VP8InitBitReader(VP8BitReader* const br,
138 uint32_t VP8GetValue(VP8BitReader* const br, int num_bits);
139 static WEBP_INLINE uint32_t VP8Get(VP8BitReader* const br) {
140 return VP8GetValue(br, 1);
144 int32_t VP8GetSignedValue(VP8BitReader* const br, int num_bits);
150 void VP8LoadFinalBytes(VP8BitReader* const br); // special case for the tail
152 static WEBP_INLINE void VP8LoadNewBytes(VP8BitReader* const br) {
153 assert(br != NULL && br->buf_ != NULL);
155 if (br->buf_ + sizeof(lbit_t) <= br->buf_end_) {
158 lbit_t in_bits = *(lbit_t*)br->buf_;
159 br->buf_ += (BITS) >> 3;
202 br->value_ |= bits << (-br->bits_);
204 br->value_ = bits | (br->value_ << (BITS));
206 br->bits_ += (BITS);
208 VP8LoadFinalBytes(br); // no need to be inlined
212 static WEBP_INLINE int VP8BitUpdate(VP8BitReader* const br, range_t split) {
213 if (br->bits_ < 0) { // Make sure we have a least BITS bits in 'value_'
214 VP8LoadNewBytes(br);
218 if (br->value_ > split) {
219 br->range_ -= split + 1;
220 br->value_ -= split + 1;
223 br->range_ = split;
228 const int pos = br->bits_;
229 const range_t value = (range_t)(br->value_ >> pos);
231 br->range_ -= split + 1;
232 br->value_ -= (bit_t)(split + 1) << pos;
235 br->range_ = split;
242 static WEBP_INLINE void VP8Shift(VP8BitReader* const br) {
245 const bit_t idx = br->range_ >> (BITS);
247 br->range_ = kVP8NewRange[idx];
248 br->value_ <<= shift;
249 br->bits_ -= shift;
251 const int shift = kVP8Log2Range[br->range_];
252 assert(br->range_ < (range_t)128);
253 br->range_ = kVP8NewRange[br->range_];
254 br->bits_ -= shift;
257 static WEBP_INLINE int VP8GetBit(VP8BitReader* const br, int prob) {
262 (range_t)((uint32_t)(br->range_ >> (BITS)) * prob) << ((BITS) - 8);
263 const int bit = VP8BitUpdate(br, split);
264 if (br->range_ <= (((range_t)0x7e << (BITS)) | (MASK))) {
265 VP8Shift(br);
269 const range_t split = (br->range_ * prob) >> 8;
270 const int bit = VP8BitUpdate(br, split);
271 if (br->range_ <= (range_t)0x7e) {
272 VP8Shift(br);
278 static WEBP_INLINE int VP8GetSigned(VP8BitReader* const br, int v) {
279 const range_t split = (br->range_ >> 1);
280 const int bit = VP8BitUpdate(br, split);
281 VP8Shift(br);
301 void VP8LInitBitReader(VP8LBitReader* const br,
306 void VP8LBitReaderSetBuffer(VP8LBitReader* const br,
312 uint32_t VP8LReadBits(VP8LBitReader* const br, int n_bits);
315 static WEBP_INLINE uint32_t VP8LPrefetchBits(VP8LBitReader* const br) {
316 return (uint32_t)(br->val_ >> br->bit_pos_);
320 static WEBP_INLINE void VP8LDiscardBits(VP8LBitReader* const br, int num_bits) {
321 br->bit_pos_ += num_bits;
325 void VP8LFillBitWindow(VP8LBitReader* const br);