The current algorithm will always produce this result so just go ahead and set 
it instead of calculating it.
---
 libavcodec/ac3enc.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git libavcodec/ac3enc.c libavcodec/ac3enc.c
index 79329c6..4db0241 100644
--- libavcodec/ac3enc.c
+++ libavcodec/ac3enc.c
@@ -362,8 +362,7 @@ static int calc_exp_diff(uint8_t *exp1, uint8_t *exp2, int n)
 }
 
 static void compute_exp_strategy_ch(uint8_t exp_strategy[AC3_MAX_BLOCKS],
-                                    uint8_t *exp[AC3_MAX_BLOCKS],
-                                    int is_lfe)
+                                    uint8_t *exp[AC3_MAX_BLOCKS])
 {
     int blk, blk1;
     int exp_diff;
@@ -381,8 +380,6 @@ static void compute_exp_strategy_ch(uint8_t exp_strategy[AC3_MAX_BLOCKS],
         else
             exp_strategy[blk] = EXP_REUSE;
     }
-    if (is_lfe)
-        return;
 
     /* now select the encoding strategy type : if exponents are often
        recoded, we use a coarse encoding */
@@ -415,15 +412,24 @@ static void compute_exp_strategy(AC3EncodeContext *s,
     uint8_t exp_str1[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS];
     int ch, blk;
 
-    for (ch = 0; ch < s->channels; ch++) {
+    for (ch = 0; ch < s->fbw_channels; ch++) {
         for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
             exp1[ch][blk] = exp[blk][ch];
             exp_str1[ch][blk] = exp_strategy[blk][ch];
         }
-        compute_exp_strategy_ch(exp_str1[ch], exp1[ch], ch == s->lfe_ch);
+        compute_exp_strategy_ch(exp_str1[ch], exp1[ch]);
         for (blk = 0; blk < AC3_MAX_BLOCKS; blk++)
             exp_strategy[blk][ch] = exp_str1[ch][blk];
     }
+    if (s->lfe_on) {
+        ch = s->lfe_ch;
+        exp_strategy[0][ch] = EXP_D15;
+        exp_strategy[1][ch] =
+        exp_strategy[2][ch] =
+        exp_strategy[3][ch] =
+        exp_strategy[4][ch] =
+        exp_strategy[5][ch] = EXP_REUSE;
+    }
 }
 
 /* set exp[i] to min(exp[i], exp1[i]) */
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc

Reply via email to