comparison eac3dec.c @ 7755:1c0e498ac7bd libavcodec

simplify code and comment regarding determination whether or not AHT is used.
author jbr
date Sun, 31 Aug 2008 03:01:56 +0000
parents b7c59017beb8
children 3085502c4f33
comparison
equal deleted inserted replaced
7754:b7c59017beb8 7755:1c0e498ac7bd
418 skip_bits(gbc, 5 * s->fbw_channels); // skip converter channel exponent strategy 418 skip_bits(gbc, 5 * s->fbw_channels); // skip converter channel exponent strategy
419 } 419 }
420 420
421 /* determine which channels use AHT */ 421 /* determine which channels use AHT */
422 if (parse_aht_info) { 422 if (parse_aht_info) {
423 /* AHT is only available when there are 6 blocks in the frame. 423 /* For AHT to be used, all non-zero blocks must reuse exponents from
424 The coupling channel can only use AHT when coupling is in use for 424 the first block. Furthermore, for AHT to be used in the coupling
425 all blocks. 425 channel, all blocks must use coupling and use the same coupling
426 reference: Section E3.3.2 Bit Stream Helper Variables */ 426 strategy. */
427 s->channel_uses_aht[CPL_CH]=0; 427 s->channel_uses_aht[CPL_CH]=0;
428 for (ch = (num_cpl_blocks != 6); ch <= s->channels; ch++) { 428 for (ch = (num_cpl_blocks != 6); ch <= s->channels; ch++) {
429 int nchregs = 0; 429 int use_aht = 1;
430 for (blk = 0; blk < 6; blk++) { 430 for (blk = 1; blk < 6; blk++) {
431 if (ch) 431 if ((s->exp_strategy[blk][ch] != EXP_REUSE) ||
432 nchregs += (s->exp_strategy[blk][ch] != EXP_REUSE); 432 (!ch && s->cpl_strategy_exists[blk])) {
433 else 433 use_aht = 0;
434 nchregs += s->cpl_strategy_exists[blk] || 434 break;
435 (s->exp_strategy[blk][CPL_CH] != EXP_REUSE); 435 }
436 } 436 }
437 s->channel_uses_aht[ch] = (nchregs == 1) && get_bits1(gbc); 437 s->channel_uses_aht[ch] = use_aht && get_bits1(gbc);
438 } 438 }
439 } else { 439 } else {
440 memset(s->channel_uses_aht, 0, sizeof(s->channel_uses_aht)); 440 memset(s->channel_uses_aht, 0, sizeof(s->channel_uses_aht));
441 } 441 }
442 442