mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
remove FLAC__SYMMETRIC_RICE code
This commit is contained in:
@@ -908,127 +908,6 @@ unsigned FLAC__bitbuffer_golomb_bits_unsigned(unsigned uval, unsigned parameter)
|
||||
}
|
||||
#endif /* UNUSED */
|
||||
|
||||
#ifdef FLAC__SYMMETRIC_RICE
|
||||
FLAC__bool FLAC__bitbuffer_write_symmetric_rice_signed(FLAC__BitBuffer *bb, int val, unsigned parameter)
|
||||
{
|
||||
unsigned total_bits, interesting_bits, msbs;
|
||||
FLAC__uint32 pattern;
|
||||
|
||||
FLAC__ASSERT(0 != bb);
|
||||
FLAC__ASSERT(0 != bb->buffer);
|
||||
FLAC__ASSERT(parameter <= 31);
|
||||
|
||||
/* init pattern with the unary end bit and the sign bit */
|
||||
if(val < 0) {
|
||||
pattern = 3;
|
||||
val = -val;
|
||||
}
|
||||
else
|
||||
pattern = 2;
|
||||
|
||||
msbs = val >> parameter;
|
||||
interesting_bits = 2 + parameter;
|
||||
total_bits = interesting_bits + msbs;
|
||||
pattern <<= parameter;
|
||||
pattern |= (val & ((1<<parameter)-1)); /* the binary LSBs */
|
||||
|
||||
if(total_bits <= 32) {
|
||||
if(!FLAC__bitbuffer_write_raw_uint32(bb, pattern, total_bits))
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
/* write the unary MSBs */
|
||||
if(!FLAC__bitbuffer_write_zeroes(bb, msbs))
|
||||
return false;
|
||||
/* write the unary end bit, the sign bit, and binary LSBs */
|
||||
if(!FLAC__bitbuffer_write_raw_uint32(bb, pattern, interesting_bits))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#if 0 /* UNUSED */
|
||||
FLAC__bool FLAC__bitbuffer_write_symmetric_rice_signed_guarded(FLAC__BitBuffer *bb, int val, unsigned parameter, unsigned max_bits, FLAC__bool *overflow)
|
||||
{
|
||||
unsigned total_bits, interesting_bits, msbs;
|
||||
FLAC__uint32 pattern;
|
||||
|
||||
FLAC__ASSERT(0 != bb);
|
||||
FLAC__ASSERT(0 != bb->buffer);
|
||||
FLAC__ASSERT(parameter <= 31);
|
||||
|
||||
*overflow = false;
|
||||
|
||||
/* init pattern with the unary end bit and the sign bit */
|
||||
if(val < 0) {
|
||||
pattern = 3;
|
||||
val = -val;
|
||||
}
|
||||
else
|
||||
pattern = 2;
|
||||
|
||||
msbs = val >> parameter;
|
||||
interesting_bits = 2 + parameter;
|
||||
total_bits = interesting_bits + msbs;
|
||||
pattern <<= parameter;
|
||||
pattern |= (val & ((1<<parameter)-1)); /* the binary LSBs */
|
||||
|
||||
if(total_bits <= 32) {
|
||||
if(!FLAC__bitbuffer_write_raw_uint32(bb, pattern, total_bits))
|
||||
return false;
|
||||
}
|
||||
else if(total_bits > max_bits) {
|
||||
*overflow = true;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
/* write the unary MSBs */
|
||||
if(!FLAC__bitbuffer_write_zeroes(bb, msbs))
|
||||
return false;
|
||||
/* write the unary end bit, the sign bit, and binary LSBs */
|
||||
if(!FLAC__bitbuffer_write_raw_uint32(bb, pattern, interesting_bits))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif /* UNUSED */
|
||||
|
||||
FLAC__bool FLAC__bitbuffer_write_symmetric_rice_signed_escape(FLAC__BitBuffer *bb, int val, unsigned parameter)
|
||||
{
|
||||
unsigned total_bits, val_bits;
|
||||
FLAC__uint32 pattern;
|
||||
|
||||
FLAC__ASSERT(0 != bb);
|
||||
FLAC__ASSERT(0 != bb->buffer);
|
||||
FLAC__ASSERT(parameter <= 31);
|
||||
|
||||
val_bits = FLAC__bitmath_silog2(val);
|
||||
total_bits = 2 + parameter + 5 + val_bits;
|
||||
|
||||
if(total_bits <= 32) {
|
||||
pattern = 3;
|
||||
pattern <<= (parameter + 5);
|
||||
pattern |= val_bits;
|
||||
pattern <<= val_bits;
|
||||
pattern |= (val & ((1 << val_bits) - 1));
|
||||
if(!FLAC__bitbuffer_write_raw_uint32(bb, pattern, total_bits))
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
/* write the '-0' escape code first */
|
||||
if(!FLAC__bitbuffer_write_raw_uint32(bb, 3u << parameter, 2+parameter))
|
||||
return false;
|
||||
/* write the length */
|
||||
if(!FLAC__bitbuffer_write_raw_uint32(bb, val_bits, 5))
|
||||
return false;
|
||||
/* write the value */
|
||||
if(!FLAC__bitbuffer_write_raw_int32(bb, val, val_bits))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif /* ifdef FLAC__SYMMETRIC_RICE */
|
||||
|
||||
FLAC__bool FLAC__bitbuffer_write_rice_signed(FLAC__BitBuffer *bb, int val, unsigned parameter)
|
||||
{
|
||||
unsigned total_bits, interesting_bits, msbs, uval;
|
||||
@@ -2086,36 +1965,6 @@ FLaC__INLINE FLAC__bool FLAC__bitbuffer_read_unary_unsigned(FLAC__BitBuffer *bb,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FLAC__SYMMETRIC_RICE
|
||||
FLAC__bool FLAC__bitbuffer_read_symmetric_rice_signed(FLAC__BitBuffer *bb, int *val, unsigned parameter, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data)
|
||||
{
|
||||
FLAC__uint32 sign = 0, lsbs = 0, msbs = 0;
|
||||
|
||||
FLAC__ASSERT(0 != bb);
|
||||
FLAC__ASSERT(0 != bb->buffer);
|
||||
FLAC__ASSERT(parameter <= 31);
|
||||
|
||||
/* read the unary MSBs and end bit */
|
||||
if(!FLAC__bitbuffer_read_unary_unsigned(bb, &msbs, read_callback, client_data))
|
||||
return false;
|
||||
|
||||
/* read the sign bit */
|
||||
if(!FLAC__bitbuffer_read_bit_to_uint32(bb, &sign, read_callback, client_data))
|
||||
return false;
|
||||
|
||||
/* read the binary LSBs */
|
||||
if(!FLAC__bitbuffer_read_raw_uint32(bb, &lsbs, parameter, read_callback, client_data))
|
||||
return false;
|
||||
|
||||
/* compose the value */
|
||||
*val = (msbs << parameter) | lsbs;
|
||||
if(sign)
|
||||
*val = -(*val);
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif /* ifdef FLAC__SYMMETRIC_RICE */
|
||||
|
||||
FLAC__bool FLAC__bitbuffer_read_rice_signed(FLAC__BitBuffer *bb, int *val, unsigned parameter, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data)
|
||||
{
|
||||
FLAC__uint32 lsbs = 0, msbs = 0;
|
||||
|
||||
Reference in New Issue
Block a user