# HG changeset patch # User jbr # Date 1212877809 0 # Node ID 81d5c68233e55cdd76f2603d10312caf4e5ae67e # Parent 885cad616170378637002374b21bd5870aa4c3a4 move mix level tables from parser to decoder. have parser read bitstream value instead of using an index to a table in the decoder. diff -r 885cad616170 -r 81d5c68233e5 ac3_parser.c --- a/ac3_parser.c Sat Jun 07 22:30:03 2008 +0000 +++ b/ac3_parser.c Sat Jun 07 22:30:09 2008 +0000 @@ -33,18 +33,6 @@ 1, 2, 3, 6 }; -/** - * Table for center mix levels - * reference: Section 5.4.2.4 cmixlev - */ -static const uint8_t center_levels[4] = { 4, 5, 6, 5 }; - -/** - * Table for surround mix levels - * reference: Section 5.4.2.5 surmixlev - */ -static const uint8_t surround_levels[4] = { 4, 6, 7, 6 }; - int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) { @@ -64,8 +52,8 @@ hdr->num_blocks = 6; /* set default mix levels */ - hdr->center_mix_level = 3; // -4.5dB - hdr->surround_mix_level = 4; // -6.0dB + hdr->center_mix_level = 1; // -4.5dB + hdr->surround_mix_level = 1; // -6.0dB if(hdr->bitstream_id <= 10) { /* Normal AC-3 */ @@ -87,9 +75,9 @@ skip_bits(gbc, 2); // skip dsurmod } else { if((hdr->channel_mode & 1) && hdr->channel_mode != AC3_CHMODE_MONO) - hdr->center_mix_level = center_levels[get_bits(gbc, 2)]; + hdr->center_mix_level = get_bits(gbc, 2); if(hdr->channel_mode & 4) - hdr->surround_mix_level = surround_levels[get_bits(gbc, 2)]; + hdr->surround_mix_level = get_bits(gbc, 2); } hdr->lfe_on = get_bits1(gbc); diff -r 885cad616170 -r 81d5c68233e5 ac3dec.c --- a/ac3dec.c Sat Jun 07 22:30:03 2008 +0000 +++ b/ac3dec.c Sat Jun 07 22:30:09 2008 +0000 @@ -95,6 +95,18 @@ }; /** + * Table for center mix levels + * reference: Section 5.4.2.4 cmixlev + */ +static const uint8_t center_levels[4] = { 4, 5, 6, 5 }; + +/** + * Table for surround mix levels + * reference: Section 5.4.2.5 surmixlev + */ +static const uint8_t surround_levels[4] = { 4, 6, 7, 6 }; + +/** * Table for default stereo downmixing coefficients * reference: Section 7.8.2 Downmixing Into Two Channels */ @@ -383,8 +395,8 @@ static void set_downmix_coeffs(AC3DecodeContext *s) { int i; - float cmix = gain_levels[s->center_mix_level]; - float smix = gain_levels[s->surround_mix_level]; + float cmix = gain_levels[center_levels[s->center_mix_level]]; + float smix = gain_levels[surround_levels[s->surround_mix_level]]; for(i=0; ifbw_channels; i++) { s->downmix_coeffs[i][0] = gain_levels[ac3_default_coeffs[s->channel_mode][i][0]];