From da04be10a2814db1bfdd0adafaf8d909e2f48cbe Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sat, 7 Jun 2008 22:30:47 +0000 Subject: [PATCH] store exp_strategy for all blocks in decode context Originally committed as revision 13704 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/ac3dec.c | 20 ++++++++++---------- libavcodec/ac3dec.h | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 1aebbee3b6..a621873a1f 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -843,18 +843,18 @@ static int ac3_parse_audio_block(AC3DecodeContext *s, int blk) } /* exponent strategies for each channel */ - s->exp_strategy[CPL_CH] = EXP_REUSE; - s->exp_strategy[s->lfe_ch] = EXP_REUSE; + s->exp_strategy[blk][CPL_CH] = EXP_REUSE; + s->exp_strategy[blk][s->lfe_ch] = EXP_REUSE; for (ch = !cpl_in_use; ch <= s->channels; ch++) { - s->exp_strategy[ch] = get_bits(gbc, 2 - (ch == s->lfe_ch)); - if(s->exp_strategy[ch] != EXP_REUSE) + s->exp_strategy[blk][ch] = get_bits(gbc, 2 - (ch == s->lfe_ch)); + if(s->exp_strategy[blk][ch] != EXP_REUSE) bit_alloc_stages[ch] = 3; } /* channel bandwidth */ for (ch = 1; ch <= fbw_channels; ch++) { s->start_freq[ch] = 0; - if (s->exp_strategy[ch] != EXP_REUSE) { + if (s->exp_strategy[blk][ch] != EXP_REUSE) { int group_size; int prev = s->end_freq[ch]; if (s->channel_in_cpl[ch]) @@ -867,22 +867,22 @@ static int ac3_parse_audio_block(AC3DecodeContext *s, int blk) } s->end_freq[ch] = bandwidth_code * 3 + 73; } - group_size = 3 << (s->exp_strategy[ch] - 1); + group_size = 3 << (s->exp_strategy[blk][ch] - 1); s->num_exp_groups[ch] = (s->end_freq[ch]+group_size-4) / group_size; if(blk > 0 && s->end_freq[ch] != prev) memset(bit_alloc_stages, 3, AC3_MAX_CHANNELS); } } - if (cpl_in_use && s->exp_strategy[CPL_CH] != EXP_REUSE) { + if (cpl_in_use && s->exp_strategy[blk][CPL_CH] != EXP_REUSE) { s->num_exp_groups[CPL_CH] = (s->end_freq[CPL_CH] - s->start_freq[CPL_CH]) / - (3 << (s->exp_strategy[CPL_CH] - 1)); + (3 << (s->exp_strategy[blk][CPL_CH] - 1)); } /* decode exponents for each channel */ for (ch = !cpl_in_use; ch <= s->channels; ch++) { - if (s->exp_strategy[ch] != EXP_REUSE) { + if (s->exp_strategy[blk][ch] != EXP_REUSE) { s->dexps[ch][0] = get_bits(gbc, 4) << !ch; - decode_exponents(gbc, s->exp_strategy[ch], + decode_exponents(gbc, s->exp_strategy[blk][ch], s->num_exp_groups[ch], s->dexps[ch][0], &s->dexps[ch][s->start_freq[ch]+!!ch]); if(ch != CPL_CH && ch != s->lfe_ch) diff --git a/libavcodec/ac3dec.h b/libavcodec/ac3dec.h index f4986f6a9e..086ebb5fe1 100644 --- a/libavcodec/ac3dec.h +++ b/libavcodec/ac3dec.h @@ -102,7 +102,7 @@ typedef struct { ///@defgroup exponents exponents int num_exp_groups[AC3_MAX_CHANNELS]; ///< Number of exponent groups (nexpgrp) int8_t dexps[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< decoded exponents - int exp_strategy[AC3_MAX_CHANNELS]; ///< exponent strategies (expstr) + int exp_strategy[MAX_BLOCKS][AC3_MAX_CHANNELS]; ///< exponent strategies (expstr) ///@} ///@defgroup bitalloc bit allocation