Home | History | Annotate | Download | only in utils

Lines Matching refs:BITS

30 // However, since range_ is only 8bit, we only need an active window of 8 bits
31 // for value_. Left bits (MSB) gets zeroed and shifted away when value_ falls
32 // below 128, range_ is updated, and fresh bits read from the bitstream are
34 // To avoid reading the fresh bits one by one (slow), we cache a few of them
35 // ahead (actually, we cache BITS of them ahead. See below). There's two
36 // strategies regarding how to shift these looked-ahead fresh bits into the
39 // bits at a fixed, right-justified, position.
41 // Example, for BITS=16: here is the content of value_ for both strategies:
45 // <- 8b -><- 8b -><- BITS bits -> || <- 8b+3b -><- 8b -><- 13 bits ->
46 // [unused][value_][cached bits][0] || [unused...][value_][cached bits]
58 // -> we're back to height active 'value_' bits (marked 'v') and BITS cached
59 // bits (marked 'B')
64 // BITS can be any multiple of 8 from 8 to 56 (inclusive).
72 #define BITS 16
74 #define BITS 56
76 #define BITS 24
78 #define BITS 24
84 #define BITS 8
94 #if (BITS > 32)
97 #elif (BITS == 32)
100 #elif (BITS == 24)
103 #elif (BITS == 16)
113 #define MASK ((((bit_t)1) << (BITS)) - 1)
115 typedef uint32_t range_t; // range_ only uses 8bits here. No need for bit_t.
130 int bits_; // number of valid bits left
137 // return the next value made of 'num_bits' bits
154 // Read 'BITS' bits at a time if possible.
157 bit_t bits;
159 br->buf_ += (BITS) >> 3;
161 #if (BITS > 32)
165 bits = (bit_t)__builtin_bswap64(in_bits);
167 bits = (bit_t)_byteswap_uint64(in_bits);
169 __asm__ volatile("bswapq %0" : "=r"(bits) : "0"(in_bits));
171 bits = (bit_t)in_bits;
172 bits = ((bits & 0xffffffff00000000ull) >> 32) |
173 ((bits & 0x00000000ffffffffull) << 32);
174 bits = ((bits & 0xffff0000ffff0000ull) >> 16) |
175 ((bits & 0x0000ffff0000ffffull) << 16);
176 bits = ((bits & 0xff00ff00ff00ff00ull) >> 8) |
177 ((bits & 0x00ff00ff00ff00ffull) << 8);
179 bits >>= 64 - BITS;
180 #elif (BITS >= 24)
183 bits = (bit_t)in_bits; // 24b/32b -> 32b/64b zero-extension
185 bits = (bit_t)_byteswap_ulong(in_bits);
187 bits = (bit_t)(in_bits >> 24) | ((in_bits >> 8) & 0xff00)
190 bits >>= (32 - BITS);
191 #elif (BITS == 16)
193 bits = (bit_t)(in_bits >> 8) | ((in_bits & 0xff) << 8);
194 #else // BITS == 8
195 bits = (bit_t)in_bits;
198 bits = (bit_t)in_bits;
199 if (BITS != 8 * sizeof(bit_t)) bits >>= (8 * sizeof(bit_t) - BITS);
202 br->value_ |= bits << (-br->bits_);
204 br->value_ = bits | (br->value_ << (BITS));
206 br->bits_ += (BITS);
213 if (br->bits_ < 0) { // Make sure we have a least BITS bits in 'value_'
245 const bit_t idx = br->range_ >> (BITS);
262 (range_t)((uint32_t)(br->range_ >> (BITS)) * prob) << ((BITS) - 8);
264 if (br->range_ <= (((range_t)0x7e << (BITS)) | (MASK))) {
292 vp8l_val_t val_; // pre-fetched bits
309 // Reads the specified number of bits from Read Buffer.
314 // Return the prefetched bits, so they can be looked up.
319 // Discard 'num_bits' bits from the cache.
324 // Advances the Read buffer by 4 bytes to make room for reading next 32 bits.