add support for raw encoding within a Rice partition

This commit is contained in:
Josh Coalson
2001-04-12 22:22:34 +00:00
parent c5d08e03bc
commit 2051dd49a5
5 changed files with 145 additions and 54 deletions

View File

@@ -1217,7 +1217,7 @@ bool stream_decoder_read_subframe_lpc_(FLAC__StreamDecoder *decoder, unsigned ch
/* read qlp coeff precision */
if(!FLAC__bitbuffer_read_raw_uint32(&decoder->guts->input, &u32, FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN, read_callback_, decoder))
return false; /* the read_callback_ sets the state for us */
if(u32 == 15) {
if(u32 == (1 << FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN) - 1) {
decoder->guts->error_callback(decoder, FLAC__STREAM_DECODER_ERROR_LOST_SYNC, decoder->guts->client_data);
decoder->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
return true;
@@ -1302,15 +1302,26 @@ bool stream_decoder_read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder
for(partition = 0; partition < partitions; partition++) {
if(!FLAC__bitbuffer_read_raw_uint32(&decoder->guts->input, &rice_parameter, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN, read_callback_, decoder))
return false; /* the read_callback_ sets the state for us */
for(u = (partition_order == 0 || partition > 0)? 0 : predictor_order; u < partition_samples; u++, sample++) {
if(rice_parameter < FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER) {
for(u = (partition_order == 0 || partition > 0)? 0 : predictor_order; u < partition_samples; u++, sample++) {
#ifdef SYMMETRIC_RICE
if(!FLAC__bitbuffer_read_symmetric_rice_signed(&decoder->guts->input, &i, rice_parameter, read_callback_, decoder))
return false; /* the read_callback_ sets the state for us */
if(!FLAC__bitbuffer_read_symmetric_rice_signed(&decoder->guts->input, &i, rice_parameter, read_callback_, decoder))
return false; /* the read_callback_ sets the state for us */
#else
if(!FLAC__bitbuffer_read_rice_signed(&decoder->guts->input, &i, rice_parameter, read_callback_, decoder))
return false; /* the read_callback_ sets the state for us */
if(!FLAC__bitbuffer_read_rice_signed(&decoder->guts->input, &i, rice_parameter, read_callback_, decoder))
return false; /* the read_callback_ sets the state for us */
#endif
residual[sample] = i;
residual[sample] = i;
}
}
else {
if(!FLAC__bitbuffer_read_raw_uint32(&decoder->guts->input, &rice_parameter, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN, read_callback_, decoder))
return false; /* the read_callback_ sets the state for us */
for(u = (partition_order == 0 || partition > 0)? 0 : predictor_order; u < partition_samples; u++, sample++) {
if(!FLAC__bitbuffer_read_raw_int32(&decoder->guts->input, &i, rice_parameter, read_callback_, decoder))
return false; /* the read_callback_ sets the state for us */
residual[sample] = i;
}
}
}