diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2011-04-15 19:55:09 -0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2011-05-01 13:32:03 -0400 |
commit | 987fe2dc55c2de4dd798cbd0ebcdae6a066faff7 (patch) | |
tree | 17e35bb7e28e7fcbae0809deb3c4dc51024785ae /libavcodec/ac3enc.c | |
parent | 6b2636bba68880450749b3d36a99d584c031342e (diff) | |
download | ffmpeg-streaming-987fe2dc55c2de4dd798cbd0ebcdae6a066faff7.zip ffmpeg-streaming-987fe2dc55c2de4dd798cbd0ebcdae6a066faff7.tar.gz |
ac3enc: differentiate between current block and reference block in bit_alloc()
Diffstat (limited to 'libavcodec/ac3enc.c')
-rw-r--r-- | libavcodec/ac3enc.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index f813632..00cb047 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -1010,7 +1010,8 @@ static int bit_alloc(AC3EncodeContext *s, int snr_offset) reset_block_bap(s); mantissa_bits = 0; for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { - AC3Block *block; + AC3Block *block = &s->blocks[blk]; + AC3Block *ref_block; // initialize grouped mantissa counts. these are set so that they are // padded to the next whole group size when bits are counted in // compute_mantissa_size_final @@ -1022,14 +1023,17 @@ static int bit_alloc(AC3EncodeContext *s, int snr_offset) blocks within a frame are the exponent values. We can take advantage of that by reusing the bit allocation pointers whenever we reuse exponents. */ - block = s->blocks[blk].exp_ref_block[ch]; + ref_block = block->exp_ref_block[ch]; if (s->exp_strategy[ch][blk] != EXP_REUSE) { - s->ac3dsp.bit_alloc_calc_bap(block->mask[ch], block->psd[ch], 0, - s->nb_coefs[ch], snr_offset, - s->bit_alloc.floor, ff_ac3_bap_tab, - block->bap[ch]); + s->ac3dsp.bit_alloc_calc_bap(ref_block->mask[ch], + ref_block->psd[ch], 0, + s->nb_coefs[ch], snr_offset, + s->bit_alloc.floor, ff_ac3_bap_tab, + ref_block->bap[ch]); } - mantissa_bits += s->ac3dsp.compute_mantissa_size(mant_cnt, block->bap[ch], s->nb_coefs[ch]); + mantissa_bits += s->ac3dsp.compute_mantissa_size(mant_cnt, + ref_block->bap[ch], + s->nb_coefs[ch]); } mantissa_bits += compute_mantissa_size_final(mant_cnt); } |