simplify code and comment regarding determination whether or not AHT is used.

Originally committed as revision 15101 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Justin Ruggles 2008-08-31 03:01:56 +00:00
parent 7d5fdf900b
commit f07fe6e78a
1 changed files with 12 additions and 12 deletions

View File

@ -420,21 +420,21 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
/* determine which channels use AHT */ /* determine which channels use AHT */
if (parse_aht_info) { if (parse_aht_info) {
/* AHT is only available when there are 6 blocks in the frame. /* For AHT to be used, all non-zero blocks must reuse exponents from
The coupling channel can only use AHT when coupling is in use for the first block. Furthermore, for AHT to be used in the coupling
all blocks. channel, all blocks must use coupling and use the same coupling
reference: Section E3.3.2 Bit Stream Helper Variables */ strategy. */
s->channel_uses_aht[CPL_CH]=0; s->channel_uses_aht[CPL_CH]=0;
for (ch = (num_cpl_blocks != 6); ch <= s->channels; ch++) { for (ch = (num_cpl_blocks != 6); ch <= s->channels; ch++) {
int nchregs = 0; int use_aht = 1;
for (blk = 0; blk < 6; blk++) { for (blk = 1; blk < 6; blk++) {
if (ch) if ((s->exp_strategy[blk][ch] != EXP_REUSE) ||
nchregs += (s->exp_strategy[blk][ch] != EXP_REUSE); (!ch && s->cpl_strategy_exists[blk])) {
else use_aht = 0;
nchregs += s->cpl_strategy_exists[blk] || break;
(s->exp_strategy[blk][CPL_CH] != EXP_REUSE);
} }
s->channel_uses_aht[ch] = (nchregs == 1) && get_bits1(gbc); }
s->channel_uses_aht[ch] = use_aht && get_bits1(gbc);
} }
} else { } else {
memset(s->channel_uses_aht, 0, sizeof(s->channel_uses_aht)); memset(s->channel_uses_aht, 0, sizeof(s->channel_uses_aht));