Revision 9be52d48 libavcodec/ac3enc.c

View differences:

libavcodec/ac3enc.c
285 285
    for (ch = 0; ch < s->channels; ch++) {
286 286
        for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
287 287
            AC3Block *block = &s->blocks[blk];
288
            uint8_t *exp   = block->exp[ch];
289
            CoefType *coef = block->mdct_coef[ch];
290
            int exp_shift  = block->exp_shift[ch];
288 291
            for (i = 0; i < AC3_MAX_COEFS; i++) {
289 292
                int e;
290
                int v = abs(SCALE_COEF(block->mdct_coef[ch][i]));
293
                int v = abs(SCALE_COEF(coef[i]));
291 294
                if (v == 0)
292 295
                    e = 24;
293 296
                else {
294
                    e = 23 - av_log2(v) + block->exp_shift[ch];
297
                    e = 23 - av_log2(v) + exp_shift;
295 298
                    if (e >= 24) {
296 299
                        e = 24;
297
                        block->mdct_coef[ch][i] = 0;
300
                        coef[i] = 0;
298 301
                    }
299 302
                }
300
                block->exp[ch][i] = e;
303
                exp[i] = e;
301 304
            }
302 305
        }
303 306
    }

Also available in: Unified diff