Lines Matching refs:bits

71 #define FLAC__TOTAL_BITS(bw) (FLAC__WORDS_TO_BITS((bw)->words) + (bw)->bits)
78 unsigned bits; /* # of used bits in accum */ member
94 …new_capacity = bw->words + ((bw->bits + bits_to_add + FLAC__BITS_PER_WORD - 1) / FLAC__BITS_PER_WO… in bitwriter_grow_()
108 …FLAC__ASSERT(new_capacity >= bw->words + ((bw->bits + bits_to_add + FLAC__BITS_PER_WORD - 1) / FLA… in bitwriter_grow_()
150 bw->words = bw->bits = 0; in FLAC__bitwriter_init()
167 bw->words = bw->bits = 0; in FLAC__bitwriter_free()
172 bw->words = bw->bits = 0; in FLAC__bitwriter_clear()
182 …pacity=%u words=%u bits=%u total_bits=%u\n", bw->capacity, bw->words, bw->bits, FLAC__TOTAL_BITS(b… in FLAC__bitwriter_dump()
190 if(bw->bits > 0) { in FLAC__bitwriter_dump()
192 for(j = 0; j < bw->bits; j++) in FLAC__bitwriter_dump()
193 fprintf(out, "%01u", bw->accum & (1 << (bw->bits-j-1)) ? 1:0); in FLAC__bitwriter_dump()
204 FLAC__ASSERT((bw->bits & 7) == 0); /* assert that we're byte-aligned */ in FLAC__bitwriter_get_write_crc16()
219 FLAC__ASSERT((bw->bits & 7) == 0); /* assert that we're byte-aligned */ in FLAC__bitwriter_get_write_crc8()
231 return ((bw->bits & 7) == 0); in FLAC__bitwriter_is_byte_aligned()
241 FLAC__ASSERT((bw->bits & 7) == 0); in FLAC__bitwriter_get_buffer()
243 if(bw->bits & 7) in FLAC__bitwriter_get_buffer()
246 if(bw->bits) { in FLAC__bitwriter_get_buffer()
251 bw->buffer[bw->words] = SWAP_BE_WORD_TO_HOST(bw->accum << (FLAC__BITS_PER_WORD-bw->bits)); in FLAC__bitwriter_get_buffer()
255 *bytes = (FLAC__BYTES_PER_WORD * bw->words) + (bw->bits >> 3); in FLAC__bitwriter_get_buffer()
267 inline FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, unsigned bits) in FLAC__bitwriter_write_zeroes() argument
274 if(bits == 0) in FLAC__bitwriter_write_zeroes()
277 if(bw->capacity <= bw->words + bits && !bitwriter_grow_(bw, bits)) in FLAC__bitwriter_write_zeroes()
280 if(bw->bits) { in FLAC__bitwriter_write_zeroes()
281 n = flac_min(FLAC__BITS_PER_WORD - bw->bits, bits); in FLAC__bitwriter_write_zeroes()
283 bits -= n; in FLAC__bitwriter_write_zeroes()
284 bw->bits += n; in FLAC__bitwriter_write_zeroes()
285 if(bw->bits == FLAC__BITS_PER_WORD) { in FLAC__bitwriter_write_zeroes()
287 bw->bits = 0; in FLAC__bitwriter_write_zeroes()
293 while(bits >= FLAC__BITS_PER_WORD) { in FLAC__bitwriter_write_zeroes()
295 bits -= FLAC__BITS_PER_WORD; in FLAC__bitwriter_write_zeroes()
298 if(bits > 0) { in FLAC__bitwriter_write_zeroes()
300 bw->bits = bits; in FLAC__bitwriter_write_zeroes()
305 …e FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FLAC__uint32 val, unsigned bits) in FLAC__bitwriter_write_raw_uint32() argument
315 FLAC__ASSERT(bits <= 32); in FLAC__bitwriter_write_raw_uint32()
316 if(bits == 0) in FLAC__bitwriter_write_raw_uint32()
320 if(bw->capacity <= bw->words + bits && !bitwriter_grow_(bw, bits)) in FLAC__bitwriter_write_raw_uint32()
323 left = FLAC__BITS_PER_WORD - bw->bits; in FLAC__bitwriter_write_raw_uint32()
324 if(bits < left) { in FLAC__bitwriter_write_raw_uint32()
325 bw->accum <<= bits; in FLAC__bitwriter_write_raw_uint32()
327 bw->bits += bits; in FLAC__bitwriter_write_raw_uint32()
329 …else if(bw->bits) { /* WATCHOUT: if bw->bits == 0, left==FLAC__BITS_PER_WORD and bw->accum<<=left … in FLAC__bitwriter_write_raw_uint32()
331 bw->accum |= val >> (bw->bits = bits - left); in FLAC__bitwriter_write_raw_uint32()
337 bw->bits = 0; in FLAC__bitwriter_write_raw_uint32()
344 …ine FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, unsigned bits) in FLAC__bitwriter_write_raw_int32() argument
347 if(bits < 32) in FLAC__bitwriter_write_raw_int32()
348 val &= (~(0xffffffff << bits)); in FLAC__bitwriter_write_raw_int32()
350 return FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, bits); in FLAC__bitwriter_write_raw_int32()
353 …e FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, unsigned bits) in FLAC__bitwriter_write_raw_uint64() argument
356 if(bits > 32) { in FLAC__bitwriter_write_raw_uint64()
358 FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)(val>>32), bits-32) && in FLAC__bitwriter_write_raw_uint64()
362 return FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, bits); in FLAC__bitwriter_write_raw_uint64()
419 unsigned bits, msbs, uval;
435 bits = 1 + k + msbs;
444 bits = 1 + q + k;
446 bits++;
448 return bits;
453 unsigned bits, msbs;
463 bits = 1 + k + msbs;
472 bits = 1 + q + k;
474 bits++;
476 return bits;
527 …if(bw->bits && bw->bits + msbits + lsbits < FLAC__BITS_PER_WORD) { /* i.e. if the whole thing fits… in FLAC__bitwriter_write_rice_signed_block()
529 bw->bits = bw->bits + msbits + lsbits; in FLAC__bitwriter_write_rice_signed_block()
538 …if(bw->capacity <= bw->words + bw->bits + msbits + 1/*lsbits always fit in 1 uint32_t*/ && !bitwri… in FLAC__bitwriter_write_rice_signed_block()
543 if(bw->bits) { in FLAC__bitwriter_write_rice_signed_block()
544 left = FLAC__BITS_PER_WORD - bw->bits; in FLAC__bitwriter_write_rice_signed_block()
547 bw->bits += msbits; in FLAC__bitwriter_write_rice_signed_block()
554 bw->bits = 0; in FLAC__bitwriter_write_rice_signed_block()
565 bw->bits = msbits; in FLAC__bitwriter_write_rice_signed_block()
572 left = FLAC__BITS_PER_WORD - bw->bits; in FLAC__bitwriter_write_rice_signed_block()
576 bw->bits += lsbits; in FLAC__bitwriter_write_rice_signed_block()
583 FLAC__ASSERT(bw->bits); in FLAC__bitwriter_write_rice_signed_block()
586 bw->accum |= uval >> (bw->bits = lsbits - left); in FLAC__bitwriter_write_rice_signed_block()
825 if(bw->bits & 7u) in FLAC__bitwriter_zero_pad_to_byte_boundary()
826 return FLAC__bitwriter_write_zeroes(bw, 8 - (bw->bits & 7u)); in FLAC__bitwriter_zero_pad_to_byte_boundary()
839 extern FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, unsigned bits);
840 …rn FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, unsigned bits);
841 … FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, unsigned bits);