ac3enc: extract all exponents for the frame at once
authorJustin Ruggles <justin.ruggles@gmail.com>
Wed, 1 Jun 2011 16:40:01 +0000 (12:40 -0400)
committerJustin Ruggles <justin.ruggles@gmail.com>
Sat, 4 Jun 2011 23:08:37 +0000 (19:08 -0400)
libavcodec/ac3enc.c

index dbe7784..53f6251 100644 (file)
@@ -900,15 +900,11 @@ static av_cold void exponent_init(AC3EncodeContext *s)
  */
 static void extract_exponents(AC3EncodeContext *s)
 {
-    int blk, ch;
+    int ch        = !s->cpl_on;
+    int chan_size = AC3_MAX_COEFS * AC3_MAX_BLOCKS * (s->channels - ch + 1);
+    AC3Block *block = &s->blocks[0];
 
-    for (ch = !s->cpl_on; ch <= s->channels; ch++) {
-        for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
-            AC3Block *block = &s->blocks[blk];
-            s->ac3dsp.extract_exponents(block->exp[ch], block->fixed_coef[ch],
-                                        AC3_MAX_COEFS);
-        }
-    }
+    s->ac3dsp.extract_exponents(block->exp[ch], block->fixed_coef[ch], chan_size);
 }