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; } } }