diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2010-12-17 17:16:13 +0300 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2010-12-17 17:16:13 +0300 |
commit | cf7c961b1901c04464f255863f9e09b6ea1ccb13 (patch) | |
tree | ca9d854f8bdd6f642e085e5fe8adaa01a4f7d7ac /libavcodec/ac3enc.c | |
parent | 68e6b0990dc76cc4bc6e21cafd3403b5ab799881 (diff) |
Do not calculate psd and masking curve if exponents are being reused.
Approx. 20% faster in function bit_alloc_masking().
Originally committed as revision 26042 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ac3enc.c')
-rw-r--r-- | libavcodec/ac3enc.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 3e8f08a263..3495db0ad5 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -964,11 +964,10 @@ static void bit_alloc_masking(AC3EncodeContext *s) for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { AC3Block *block = &s->blocks[blk]; for (ch = 0; ch < s->channels; ch++) { - if (block->exp_strategy[ch] == EXP_REUSE) { - AC3Block *block1 = &s->blocks[blk-1]; - memcpy(block->psd[ch], block1->psd[ch], AC3_MAX_COEFS*sizeof(block->psd[0][0])); - memcpy(block->mask[ch], block1->mask[ch], AC3_CRITICAL_BANDS*sizeof(block->mask[0][0])); - } else { + /* We only need psd and mask for calculating bap. + Since we currently do not calculate bap when exponent + strategy is EXP_REUSE we do not need to calculate psd or mask. */ + if (block->exp_strategy[ch] != EXP_REUSE) { ff_ac3_bit_alloc_calc_psd(block->exp[ch], 0, s->nb_coefs[ch], block->psd[ch], block->band_psd[ch]); |