mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
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
This commit is contained in:
parent
5d3d238f82
commit
9be52d48d9
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user