Lines Matching defs:bits

132 /* Decodes WBITS by reading 1 - 7 bits, or 0x11 for "Large Window Brotli".
133 Precondition: bit-reader accumulator has at least 8 bits. */
180 /* Decodes a number in the range [0..255], by reading 1 - 11 bits. */
183 uint32_t bits;
186 if (BROTLI_PREDICT_FALSE(!BrotliSafeReadBits(br, 1, &bits))) {
189 if (bits == 0) {
196 if (BROTLI_PREDICT_FALSE(!BrotliSafeReadBits(br, 3, &bits))) {
200 if (bits == 0) {
206 *value = bits;
210 if (BROTLI_PREDICT_FALSE(!BrotliSafeReadBits(br, *value, &bits))) {
214 *value = (1U << *value) + bits;
224 /* Decodes a metablock length and flags by reading 2 - 31 bits. */
227 uint32_t bits;
232 if (!BrotliSafeReadBits(br, 1, &bits)) {
235 s->is_last_metablock = bits ? 1 : 0;
247 if (!BrotliSafeReadBits(br, 1, &bits)) {
250 if (bits) {
258 if (!BrotliSafeReadBits(br, 2, &bits)) {
261 s->size_nibbles = (uint8_t)(bits + 4);
263 if (bits == 3) {
274 if (!BrotliSafeReadBits(br, 4, &bits)) {
279 bits == 0) {
282 s->meta_block_remaining_len |= (int)(bits << (i * 4));
290 if (!BrotliSafeReadBits(br, 1, &bits)) {
293 s->is_uncompressed = bits ? 1 : 0;
300 if (!BrotliSafeReadBits(br, 1, &bits)) {
303 if (bits != 0) {
310 if (!BrotliSafeReadBits(br, 2, &bits)) {
313 if (bits == 0) {
317 s->size_nibbles = (uint8_t)bits;
324 if (!BrotliSafeReadBits(br, 8, &bits)) {
329 bits == 0) {
333 s->meta_block_remaining_len |= (int)(bits << (i * 8));
348 bits that correspond to the decoded symbol.
349 bits MUST contain at least 15 (BROTLI_HUFFMAN_MAX_CODE_LENGTH) valid bits. */
350 static BROTLI_INLINE uint32_t DecodeSymbol(uint32_t bits,
354 BROTLI_HC_ADJUST_TABLE_INDEX(table, bits & HUFFMAN_TABLE_MASK);
360 ((bits >> HUFFMAN_TABLE_BITS) & BitMask(nbits)));
367 This method peeks 16 bits of input and drops 0 - 15 of them. */
373 /* Same as DecodeSymbol, but it is known that there is less than 15 bits of
385 return BROTLI_FALSE; /* No valid bits at all. */
395 return BROTLI_FALSE; /* Not enough bits for the first level. */
399 return BROTLI_FALSE; /* Not enough bits to move to the second level. */
407 return BROTLI_FALSE; /* Not enough bits for the second level. */
425 /* Makes a look-up in first level Huffman table. Peeks 8 bits. */
429 uint32_t* bits,
436 *bits = BROTLI_HC_FAST_LOAD_BITS(table);
441 Reads 0 - 15 bits. Also peeks 8 following bits. */
444 uint32_t* bits,
447 if (BROTLI_PREDICT_FALSE(*bits > HUFFMAN_TABLE_BITS)) {
450 uint32_t mask = BitMask((*bits - HUFFMAN_TABLE_BITS));
457 BrotliDropBits(br, *bits);
459 PreloadSymbol(0, table, br, bits, value);
473 Totally 1..4 symbols are read, 1..11 bits each.
478 /* max_bits == 1..11; symbol == 0..3; 1..44 bits will be read. */
623 BrotliDropBits(br, BROTLI_HC_FAST_LOAD_BITS(p)); /* Use 1..5 bits. */
652 uint32_t bits = 0;
658 bits = (uint32_t)BrotliGetBitsUnmasked(br);
661 bits & BitMask(BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH));
674 uint32_t repeat_delta = (bits >> BROTLI_HC_FAST_LOAD_BITS(p)) &
691 Each code is 2..4 bits long. In total 30..72 bits are used. */
741 For this scenario 4 - 49 bits will be read.
745 encoded with predefined entropy code. 32 - 74 bits are used.
747 Huffman table. In worst case 3520 bits are read. */
799 uint32_t bits;
800 if (!BrotliSafeReadBits(br, 1, &bits)) {
804 h->symbol += bits;
872 /* Decodes a block length by reading 3..39 bits. */
896 uint32_t bits;
899 if (!BrotliSafeReadBits(br, nbits, &bits)) {
904 *result = offset + bits;
985 1) Read auxiliary information (6..16 bits) and allocate memory.
1022 uint32_t bits;
1023 /* In next stage ReadHuffmanCode uses at least 4 bits, so it is safe
1024 to peek 4 bits ahead. */
1025 if (!BrotliSafeGetBits(br, 5, &bits)) {
1028 if ((bits & 1) != 0) { /* Use RLE for zeros. */
1029 h->max_run_length_prefix = (bits >> 1) + 1;
1100 uint32_t bits;
1101 if (!BrotliSafeReadBits(br, 1, &bits)) {
1105 if (bits != 0) {
1119 Reads 3..54 bits. */
1134 /* Read 0..15 + 3..39 bits. */
1196 Reads 3..54 bits. */
1216 Reads 3..54 bits. */
1236 Reads 3..54 bits. */
1457 uint32_t bits;
1458 if (!BrotliSafeReadBits(br, 2, &bits)) {
1462 s->context_modes[i] = (uint8_t)bits;
1519 Each distance ... is represented with a pair <distance code, extra bits>...
1520 The distance code is encoded using a prefix code... The number of extra bits
1526 [For] distance symbols 16 + NDIRECT and greater ... the number of extra bits
1539 four-bit number by NPOSTFIX bits ...
1559 - XXX represent the number of extra distance bits
1590 uint32_t bits = 1;
1605 uint32_t base = ndirect + ((((2 + half) << bits) - 4) << npostfix) + 1;
1608 b->dist_extra_bits[i] = (uint8_t)bits;
1612 bits = bits + half;
1622 uint32_t bits;
1643 bits = BrotliReadBits32(br, b->dist_extra_bits[code]);
1645 if (!SafeReadBits32(br, b->dist_extra_bits[code], &bits)) {
1652 (int)(b->dist_offset[code] + (bits << s->distance_postfix_bits));
1766 if (!CheckInputAmount(safe, br, 28)) { /* 156 bits + 7 bytes */
1790 uint32_t bits;
1792 PreloadSymbol(safe, s->literal_htree, br, &bits, &value);
1794 if (!CheckInputAmount(safe, br, 28)) { /* 162 bits + 7 bytes */
1801 PreloadSymbol(safe, s->literal_htree, br, &bits, &value);
1806 (uint8_t)ReadPreloadedSymbol(s->literal_htree, br, &bits, &value);
1830 if (!CheckInputAmount(safe, br, 28)) { /* 162 bits + 7 bytes */
2065 hold more than 7 bits in bit reader; this saves client from swapping input
2114 Accumulator contains less than 8 bits, because internal buffer
2159 stream it has less than 8 bits in accumulator, so it is safe to
2160 return unused accumulator bits there. */
2175 result = DecodeWindowBits(s, br); /* Reads 1..8 bits. */
2225 result = DecodeMetaBlockLength(s, br); /* Reads 2 - 31 bits. */
2275 /* Reads 1..11 bits. */
2334 uint32_t bits;
2336 if (!BrotliSafeReadBits(br, 8, &bits)) {
2347 uint32_t bits;
2348 if (!BrotliSafeReadBits(br, 6, &bits)) {
2352 s->distance_postfix_bits = bits & BitMask(2);
2353 bits >>= 2;
2354 s->num_direct_distance_codes = bits << s->distance_postfix_bits;