diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2011-01-05 16:02:08 +0000 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2011-01-05 16:02:08 +0000 |
commit | 9be52d48d9137e05361dd1ffb6b1fb3677e1fb47 (patch) | |
tree | 50094f1134bd37a4c516355825c8bd3f12683177 /libavcodec/ac3enc.c | |
parent | 5d3d238f826872fa5b42125d7a8efefc63a4e492 (diff) | |
download | ffmpeg-9be52d48d9137e05361dd1ffb6b1fb3677e1fb47.tar.gz |
Use local variables outside the inner loop in extract_exponents() to reduce
accessing of structs and arrays inside the loop.
Approx. 30% faster in function extract_exponents().
Originally committed as revision 26226 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ac3enc.c')
-rw-r--r-- | libavcodec/ac3enc.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index fbf5566b13..e815c66640 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -285,19 +285,22 @@ static void extract_exponents(AC3EncodeContext *s) for (ch = 0; ch < s->channels; ch++) { for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { AC3Block *block = &s->blocks[blk]; + uint8_t *exp = block->exp[ch]; + CoefType *coef = block->mdct_coef[ch]; + int exp_shift = block->exp_shift[ch]; for (i = 0; i < AC3_MAX_COEFS; i++) { int e; - int v = abs(SCALE_COEF(block->mdct_coef[ch][i])); + int v = abs(SCALE_COEF(coef[i])); if (v == 0) e = 24; else { - e = 23 - av_log2(v) + block->exp_shift[ch]; + e = 23 - av_log2(v) + exp_shift; if (e >= 24) { e = 24; - block->mdct_coef[ch][i] = 0; + coef[i] = 0; } } - block->exp[ch][i] = e; + exp[i] = e; } } } |