comparison ac3dec.c @ 6953:64504967b891 libavcodec

get_transform_coeffs() never returns an error, so make the function and its children return void.
author jbr
date Sat, 31 May 2008 16:04:41 +0000
parents 4c1b8b50313c
children 57797b6c9d59
comparison
equal deleted inserted replaced
6952:51708e7f3274 6953:64504967b891
464 464
465 /** 465 /**
466 * Get the transform coefficients for a particular channel 466 * Get the transform coefficients for a particular channel
467 * reference: Section 7.3 Quantization and Decoding of Mantissas 467 * reference: Section 7.3 Quantization and Decoding of Mantissas
468 */ 468 */
469 static int get_transform_coeffs_ch(AC3DecodeContext *s, int ch_index, mant_groups *m) 469 static void get_transform_coeffs_ch(AC3DecodeContext *s, int ch_index, mant_groups *m)
470 { 470 {
471 GetBitContext *gbc = &s->gbc; 471 GetBitContext *gbc = &s->gbc;
472 int i, gcode, tbap, start, end; 472 int i, gcode, tbap, start, end;
473 uint8_t *exps; 473 uint8_t *exps;
474 uint8_t *bap; 474 uint8_t *bap;
534 break; 534 break;
535 } 535 }
536 } 536 }
537 coeffs[i] >>= exps[i]; 537 coeffs[i] >>= exps[i];
538 } 538 }
539
540 return 0;
541 } 539 }
542 540
543 /** 541 /**
544 * Remove random dithering from coefficients with zero-bit mantissas 542 * Remove random dithering from coefficients with zero-bit mantissas
545 * reference: Section 7.3.4 Dither for Zero Bit Mantissas (bap=0) 543 * reference: Section 7.3.4 Dither for Zero Bit Mantissas (bap=0)
574 } 572 }
575 573
576 /** 574 /**
577 * Get the transform coefficients. 575 * Get the transform coefficients.
578 */ 576 */
579 static int get_transform_coeffs(AC3DecodeContext *s) 577 static void get_transform_coeffs(AC3DecodeContext *s)
580 { 578 {
581 int ch, end; 579 int ch, end;
582 int got_cplchan = 0; 580 int got_cplchan = 0;
583 mant_groups m; 581 mant_groups m;
584 582
585 m.b1ptr = m.b2ptr = m.b4ptr = 3; 583 m.b1ptr = m.b2ptr = m.b4ptr = 3;
586 584
587 for (ch = 1; ch <= s->channels; ch++) { 585 for (ch = 1; ch <= s->channels; ch++) {
588 /* transform coefficients for full-bandwidth channel */ 586 /* transform coefficients for full-bandwidth channel */
589 if (get_transform_coeffs_ch(s, ch, &m)) 587 get_transform_coeffs_ch(s, ch, &m);
590 return -1;
591 /* tranform coefficients for coupling channel come right after the 588 /* tranform coefficients for coupling channel come right after the
592 coefficients for the first coupled channel*/ 589 coefficients for the first coupled channel*/
593 if (s->channel_in_cpl[ch]) { 590 if (s->channel_in_cpl[ch]) {
594 if (!got_cplchan) { 591 if (!got_cplchan) {
595 if (get_transform_coeffs_ch(s, CPL_CH, &m)) { 592 get_transform_coeffs_ch(s, CPL_CH, &m);
596 av_log(s->avctx, AV_LOG_ERROR, "error in decoupling channels\n");
597 return -1;
598 }
599 uncouple_channels(s); 593 uncouple_channels(s);
600 got_cplchan = 1; 594 got_cplchan = 1;
601 } 595 }
602 end = s->end_freq[CPL_CH]; 596 end = s->end_freq[CPL_CH];
603 } else { 597 } else {
609 } 603 }
610 604
611 /* if any channel doesn't use dithering, zero appropriate coefficients */ 605 /* if any channel doesn't use dithering, zero appropriate coefficients */
612 if(!s->dither_all) 606 if(!s->dither_all)
613 remove_dithering(s); 607 remove_dithering(s);
614
615 return 0;
616 } 608 }
617 609
618 /** 610 /**
619 * Stereo rematrixing. 611 * Stereo rematrixing.
620 * reference: Section 7.5.4 Rematrixing : Decoding Technique 612 * reference: Section 7.5.4 Rematrixing : Decoding Technique
1056 skip_bits(gbc, 8); 1048 skip_bits(gbc, 8);
1057 } 1049 }
1058 1050
1059 /* unpack the transform coefficients 1051 /* unpack the transform coefficients
1060 this also uncouples channels if coupling is in use. */ 1052 this also uncouples channels if coupling is in use. */
1061 if (get_transform_coeffs(s)) { 1053 get_transform_coeffs(s);
1062 av_log(s->avctx, AV_LOG_ERROR, "Error in routine get_transform_coeffs\n");
1063 return -1;
1064 }
1065 1054
1066 /* recover coefficients if rematrixing is in use */ 1055 /* recover coefficients if rematrixing is in use */
1067 if(s->channel_mode == AC3_CHMODE_STEREO) 1056 if(s->channel_mode == AC3_CHMODE_STEREO)
1068 do_rematrixing(s); 1057 do_rematrixing(s);
1069 1058