From 86ad4c7e1b79c7721aa254933d69757adc185ee5 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sat, 5 Jan 2008 17:04:57 +0000 Subject: [PATCH] remove unneeded variables from AC3HeaderInfo Originally committed as revision 11419 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/ac3.h | 5 ----- libavcodec/ac3_parser.c | 17 +++++++++-------- libavcodec/ac3dec.c | 6 ++---- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/libavcodec/ac3.h b/libavcodec/ac3.h index 4f11d103ef..b5fa789c49 100644 --- a/libavcodec/ac3.h +++ b/libavcodec/ac3.h @@ -81,13 +81,8 @@ typedef struct { uint16_t sync_word; uint16_t crc1; uint8_t sr_code; - uint8_t frame_size_code; uint8_t bitstream_id; - uint8_t bitstream_mode; uint8_t channel_mode; - uint8_t center_mix_level; - uint8_t surround_mix_level; - uint8_t dolby_surround_mode; uint8_t lfe_on; /** @} */ diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c index f2bc299175..1b396bf6ac 100644 --- a/libavcodec/ac3_parser.c +++ b/libavcodec/ac3_parser.c @@ -37,6 +37,7 @@ static const uint8_t eac3_blocks[4] = { int ff_ac3_parse_header(const uint8_t buf[7], AC3HeaderInfo *hdr) { GetBitContext gbc; + int frame_size_code; memset(hdr, 0, sizeof(*hdr)); @@ -56,30 +57,30 @@ int ff_ac3_parse_header(const uint8_t buf[7], AC3HeaderInfo *hdr) if(hdr->sr_code == 3) return AC3_PARSE_ERROR_SAMPLE_RATE; - hdr->frame_size_code = get_bits(&gbc, 6); - if(hdr->frame_size_code > 37) + frame_size_code = get_bits(&gbc, 6); + if(frame_size_code > 37) return AC3_PARSE_ERROR_FRAME_SIZE; skip_bits(&gbc, 5); // skip bsid, already got it - hdr->bitstream_mode = get_bits(&gbc, 3); + skip_bits(&gbc, 3); // skip bitstream mode hdr->channel_mode = get_bits(&gbc, 3); if((hdr->channel_mode & 1) && hdr->channel_mode != AC3_CHMODE_MONO) { - hdr->center_mix_level = get_bits(&gbc, 2); + skip_bits(&gbc, 2); // skip center mix level } if(hdr->channel_mode & 4) { - hdr->surround_mix_level = get_bits(&gbc, 2); + skip_bits(&gbc, 2); // skip surround mix level } if(hdr->channel_mode == AC3_CHMODE_STEREO) { - hdr->dolby_surround_mode = get_bits(&gbc, 2); + skip_bits(&gbc, 2); // skip dolby surround mode } hdr->lfe_on = get_bits1(&gbc); hdr->sr_shift = FFMAX(hdr->bitstream_id, 8) - 8; hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code] >> hdr->sr_shift; - hdr->bit_rate = (ff_ac3_bitrate_tab[hdr->frame_size_code>>1] * 1000) >> hdr->sr_shift; + hdr->bit_rate = (ff_ac3_bitrate_tab[frame_size_code>>1] * 1000) >> hdr->sr_shift; hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on; - hdr->frame_size = ff_ac3_frame_size_tab[hdr->frame_size_code][hdr->sr_code] * 2; + hdr->frame_size = ff_ac3_frame_size_tab[frame_size_code][hdr->sr_code] * 2; return 0; } diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 8512c179dd..660d8f64d5 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -341,8 +341,6 @@ static int ac3_parse_header(AC3DecodeContext *s) /* get decoding parameters from header info */ s->bit_alloc_params.sr_code = hdr.sr_code; s->channel_mode = hdr.channel_mode; - center_mix_level = gain_levels[center_levels[hdr.center_mix_level]]; - surround_mix_level = gain_levels[surround_levels[hdr.surround_mix_level]]; s->lfe_on = hdr.lfe_on; s->bit_alloc_params.sr_shift = hdr.sr_shift; s->sample_rate = hdr.sample_rate; @@ -367,9 +365,9 @@ static int ac3_parse_header(AC3DecodeContext *s) skip_bits(gbc, 2); // skip dsurmod } else { if((s->channel_mode & 1) && s->channel_mode != AC3_CHMODE_MONO) - skip_bits(gbc, 2); // skip cmixlev + center_mix_level = gain_levels[center_levels[get_bits(gbc, 2)]]; if(s->channel_mode & 4) - skip_bits(gbc, 2); // skip surmixlev + surround_mix_level = gain_levels[surround_levels[get_bits(gbc, 2)]]; } skip_bits1(gbc); // skip lfeon