aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2008-08-31 03:01:56 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2008-08-31 03:01:56 +0000
commitf07fe6e78a6b3974b5fd00599b23f17734d6b4c8 (patch)
treec25ce6b3c250e7dc20d4e401f7352f4ef5e1b705
parent7d5fdf900b2078d71ebeb0470fbe012c1486e1a2 (diff)
downloadffmpeg-f07fe6e78a6b3974b5fd00599b23f17734d6b4c8.tar.gz
simplify code and comment regarding determination whether or not AHT is used.
Originally committed as revision 15101 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/eac3dec.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/libavcodec/eac3dec.c b/libavcodec/eac3dec.c
index 7f43e6307f..0b10b41848 100644
--- a/libavcodec/eac3dec.c
+++ b/libavcodec/eac3dec.c
@@ -420,21 +420,21 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
/* determine which channels use AHT */
if (parse_aht_info) {
- /* AHT is only available when there are 6 blocks in the frame.
- The coupling channel can only use AHT when coupling is in use for
- all blocks.
- reference: Section E3.3.2 Bit Stream Helper Variables */
+ /* For AHT to be used, all non-zero blocks must reuse exponents from
+ the first block. Furthermore, for AHT to be used in the coupling
+ channel, all blocks must use coupling and use the same coupling
+ strategy. */
s->channel_uses_aht[CPL_CH]=0;
for (ch = (num_cpl_blocks != 6); ch <= s->channels; ch++) {
- int nchregs = 0;
- for (blk = 0; blk < 6; blk++) {
- if (ch)
- nchregs += (s->exp_strategy[blk][ch] != EXP_REUSE);
- else
- nchregs += s->cpl_strategy_exists[blk] ||
- (s->exp_strategy[blk][CPL_CH] != EXP_REUSE);
+ int use_aht = 1;
+ for (blk = 1; blk < 6; blk++) {
+ if ((s->exp_strategy[blk][ch] != EXP_REUSE) ||
+ (!ch && s->cpl_strategy_exists[blk])) {
+ use_aht = 0;
+ break;
+ }
}
- s->channel_uses_aht[ch] = (nchregs == 1) && get_bits1(gbc);
+ s->channel_uses_aht[ch] = use_aht && get_bits1(gbc);
}
} else {
memset(s->channel_uses_aht, 0, sizeof(s->channel_uses_aht));