comparison flacdec.c @ 9099:152bee4c0722 libavcodec

flacdec: use get_sbits_long() where needed.
author jbr
date Tue, 03 Mar 2009 02:19:01 +0000
parents 39425084bd5c
children 99ac7c42461f
comparison
equal deleted inserted replaced
9098:66f1dba43a01 9099:152bee4c0722
286 for (partition = 0; partition < (1 << rice_order); partition++) { 286 for (partition = 0; partition < (1 << rice_order); partition++) {
287 tmp = get_bits(&s->gb, method_type == 0 ? 4 : 5); 287 tmp = get_bits(&s->gb, method_type == 0 ? 4 : 5);
288 if (tmp == (method_type == 0 ? 15 : 31)) { 288 if (tmp == (method_type == 0 ? 15 : 31)) {
289 tmp = get_bits(&s->gb, 5); 289 tmp = get_bits(&s->gb, 5);
290 for (; i < samples; i++, sample++) 290 for (; i < samples; i++, sample++)
291 s->decoded[channel][sample] = get_sbits(&s->gb, tmp); 291 s->decoded[channel][sample] = get_sbits_long(&s->gb, tmp);
292 } else { 292 } else {
293 for (; i < samples; i++, sample++) { 293 for (; i < samples; i++, sample++) {
294 s->decoded[channel][sample] = get_sr_golomb_flac(&s->gb, tmp, INT_MAX, 0); 294 s->decoded[channel][sample] = get_sr_golomb_flac(&s->gb, tmp, INT_MAX, 0);
295 } 295 }
296 } 296 }
306 int32_t *decoded = s->decoded[channel]; 306 int32_t *decoded = s->decoded[channel];
307 int av_uninit(a), av_uninit(b), av_uninit(c), av_uninit(d), i; 307 int av_uninit(a), av_uninit(b), av_uninit(c), av_uninit(d), i;
308 308
309 /* warm up samples */ 309 /* warm up samples */
310 for (i = 0; i < pred_order; i++) { 310 for (i = 0; i < pred_order; i++) {
311 decoded[i] = get_sbits(&s->gb, s->curr_bps); 311 decoded[i] = get_sbits_long(&s->gb, s->curr_bps);
312 } 312 }
313 313
314 if (decode_residuals(s, channel, pred_order) < 0) 314 if (decode_residuals(s, channel, pred_order) < 0)
315 return -1; 315 return -1;
316 316
357 int coeffs[pred_order]; 357 int coeffs[pred_order];
358 int32_t *decoded = s->decoded[channel]; 358 int32_t *decoded = s->decoded[channel];
359 359
360 /* warm up samples */ 360 /* warm up samples */
361 for (i = 0; i < pred_order; i++) { 361 for (i = 0; i < pred_order; i++) {
362 decoded[i] = get_sbits(&s->gb, s->curr_bps); 362 decoded[i] = get_sbits_long(&s->gb, s->curr_bps);
363 } 363 }
364 364
365 coeff_prec = get_bits(&s->gb, 4) + 1; 365 coeff_prec = get_bits(&s->gb, 4) + 1;
366 if (coeff_prec == 16) { 366 if (coeff_prec == 16) {
367 av_log(s->avctx, AV_LOG_ERROR, "invalid coeff precision\n"); 367 av_log(s->avctx, AV_LOG_ERROR, "invalid coeff precision\n");
444 s->curr_bps -= wasted; 444 s->curr_bps -= wasted;
445 } 445 }
446 446
447 //FIXME use av_log2 for types 447 //FIXME use av_log2 for types
448 if (type == 0) { 448 if (type == 0) {
449 tmp = get_sbits(&s->gb, s->curr_bps); 449 tmp = get_sbits_long(&s->gb, s->curr_bps);
450 for (i = 0; i < s->blocksize; i++) 450 for (i = 0; i < s->blocksize; i++)
451 s->decoded[channel][i] = tmp; 451 s->decoded[channel][i] = tmp;
452 } else if (type == 1) { 452 } else if (type == 1) {
453 for (i = 0; i < s->blocksize; i++) 453 for (i = 0; i < s->blocksize; i++)
454 s->decoded[channel][i] = get_sbits(&s->gb, s->curr_bps); 454 s->decoded[channel][i] = get_sbits_long(&s->gb, s->curr_bps);
455 } else if ((type >= 8) && (type <= 12)) { 455 } else if ((type >= 8) && (type <= 12)) {
456 if (decode_subframe_fixed(s, channel, type & ~0x8) < 0) 456 if (decode_subframe_fixed(s, channel, type & ~0x8) < 0)
457 return -1; 457 return -1;
458 } else if (type >= 32) { 458 } else if (type >= 32) {
459 if (decode_subframe_lpc(s, channel, (type & ~0x20)+1) < 0) 459 if (decode_subframe_lpc(s, channel, (type & ~0x20)+1) < 0)