[FFmpeg-cvslog] r15067 - trunk/libavcodec/eac3dec.c

Justin Ruggles justin.ruggles
Sun Aug 31 04:40:08 CEST 2008


Michael Niedermayer wrote:
> On Sun, Aug 31, 2008 at 01:13:10AM +0200, jbr wrote:
>> Author: jbr
>> Date: Sun Aug 31 01:13:10 2008
>> New Revision: 15067
>>
>> Log:
>> commit more OKed parts of the E-AC-3 decoder
> 
> [...]
> 
>> +    /* coupling strategy occurance and coupling use per block */
>> +    num_cpl_blocks = 0;
>> +    if (s->channel_mode > 1) {
>> +        for (blk = 0; blk < s->num_blocks; blk++) {
>> +            s->cpl_strategy_exists[blk] = (!blk || get_bits1(gbc));
>> +            if (s->cpl_strategy_exists[blk]) {
>> +                s->cpl_in_use[blk] = get_bits1(gbc);
>> +            } else {
>> +                s->cpl_in_use[blk] = s->cpl_in_use[blk-1];
>> +            }
>> +            num_cpl_blocks += s->cpl_in_use[blk];
>> +        }
>> +    } else {
>> +        memset(s->cpl_in_use, 0, sizeof(s->cpl_in_use));
>> +    }
>> +
>> +    /* exponent strategy data */
>> +    if (ac3_exponent_strategy) {
>> +        /* AC-3-style exponent strategy syntax */
>> +        for (blk = 0; blk < s->num_blocks; blk++) {
>> +            for (ch = !s->cpl_in_use[blk]; ch <= s->fbw_channels; ch++) {
>> +                s->exp_strategy[blk][ch] = get_bits(gbc, 2);
>> +            }
>> +        }
>> +    } else {
> 
>> +        /* LUT-based exponent strategy syntax */
>> +        int frmchexpstr;
>> +        for (ch = !((s->channel_mode > 1) && num_cpl_blocks); ch <= s->fbw_channels; ch++) {
>> +            frmchexpstr = get_bits(gbc, 5);
>> +            for (blk = 0; blk < 6; blk++) {
>> +                s->exp_strategy[blk][ch] = ff_eac3_frm_expstr[frmchexpstr][blk];
>> +            }
>> +        }
> 
> You did commit a little more than i approved ...

Sorry... it was a lot at once.

> here declaration and init can be merged

fixed.

> 
>> +    }
>> +    /* LFE exponent strategy */
>> +    if (s->lfe_on) {
>> +        for (blk = 0; blk < s->num_blocks; blk++) {
>> +            s->exp_strategy[blk][s->lfe_ch] = get_bits1(gbc);
>> +        }
>> +    }
>> +    /* original exponent strategies if this stream was converted from AC-3 */
>> +    if (s->frame_type == EAC3_FRAME_TYPE_INDEPENDENT &&
>> +            (s->num_blocks == 6 || get_bits1(gbc))) {
> 
>> +        for (ch = 1; ch <= s->fbw_channels; ch++) {
>> +            skip_bits(gbc, 5); // skip converter channel exponent strategy
>> +        }
> 
> skip_bits(gbc, 5 * s->fbw_channels);

fixed.

> 
>> +    }
>> +
>> +    /* 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 */
>> +        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);
>> +            }
>> +            s->channel_uses_aht[ch] = (nchregs == 1) && get_bits1(gbc);
>> +        }
>> +    } else {
>> +        memset(s->channel_uses_aht, 0, sizeof(s->channel_uses_aht));
>> +    }
> 
> I think this code needs to be commented a little more, i cannot really relate
> the comment with the code.

I'll try. It is a little strange.

-Justin





More information about the ffmpeg-cvslog mailing list