comparison flac.c @ 5871:83554c0e9ce6 libavcodec

Add support for FLAC's new RICE2 entropy coding method. Patch by Josh Coalson.
author jbr
date Sat, 03 Nov 2007 23:54:50 +0000
parents 154b02065699
children cd4b72a32517
comparison
equal deleted inserted replaced
5870:b56df7a7204c 5871:83554c0e9ce6
215 { 215 {
216 int i, tmp, partition, method_type, rice_order; 216 int i, tmp, partition, method_type, rice_order;
217 int sample = 0, samples; 217 int sample = 0, samples;
218 218
219 method_type = get_bits(&s->gb, 2); 219 method_type = get_bits(&s->gb, 2);
220 if (method_type != 0){ 220 if (method_type > 1){
221 av_log(s->avctx, AV_LOG_DEBUG, "illegal residual coding method %d\n", method_type); 221 av_log(s->avctx, AV_LOG_DEBUG, "illegal residual coding method %d\n", method_type);
222 return -1; 222 return -1;
223 } 223 }
224 224
225 rice_order = get_bits(&s->gb, 4); 225 rice_order = get_bits(&s->gb, 4);
232 232
233 sample= 233 sample=
234 i= pred_order; 234 i= pred_order;
235 for (partition = 0; partition < (1 << rice_order); partition++) 235 for (partition = 0; partition < (1 << rice_order); partition++)
236 { 236 {
237 tmp = get_bits(&s->gb, 4); 237 tmp = get_bits(&s->gb, method_type == 0 ? 4 : 5);
238 if (tmp == 15) 238 if (tmp == (method_type == 0 ? 15 : 31))
239 { 239 {
240 av_log(s->avctx, AV_LOG_DEBUG, "fixed len partition\n"); 240 av_log(s->avctx, AV_LOG_DEBUG, "fixed len partition\n");
241 tmp = get_bits(&s->gb, 5); 241 tmp = get_bits(&s->gb, 5);
242 for (; i < samples; i++, sample++) 242 for (; i < samples; i++, sample++)
243 s->decoded[channel][sample] = get_sbits(&s->gb, tmp); 243 s->decoded[channel][sample] = get_sbits(&s->gb, tmp);