ac3enc: use MUL64() to multiply fixed-point coefficients
authorJustin Ruggles <justin.ruggles@gmail.com>
Tue, 8 Mar 2011 18:18:55 +0000 (13:18 -0500)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 8 Mar 2011 18:42:23 +0000 (19:42 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/ac3enc.c
libavcodec/ac3enc_fixed.h
libavcodec/ac3enc_float.h

index baa9597..e792eaf 100644 (file)
@@ -328,10 +328,10 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s)
                 CoefType rt = block->mdct_coef[1][i];
                 CoefType md = lt + rt;
                 CoefType sd = lt - rt;
-                sum[0] += lt * lt;
-                sum[1] += rt * rt;
-                sum[2] += md * md;
-                sum[3] += sd * sd;
+                sum[0] += MUL_COEF(lt, lt);
+                sum[1] += MUL_COEF(rt, rt);
+                sum[2] += MUL_COEF(md, md);
+                sum[3] += MUL_COEF(sd, sd);
             }
 
             /* compare sums to determine if rematrixing will be used for this band */
index 12c8ace..773caec 100644 (file)
@@ -36,6 +36,8 @@ typedef int16_t SampleType;
 typedef int32_t CoefType;
 typedef int64_t CoefSumType;
 
+#define MUL_COEF(a,b) MUL64(a,b)
+
 
 /**
  * Compex number.
index 1726ca0..6ad22ec 100644 (file)
@@ -36,6 +36,8 @@ typedef float SampleType;
 typedef float CoefType;
 typedef float CoefSumType;
 
+#define MUL_COEF(a,b) ((a)*(b))
+
 
 typedef struct AC3MDCTContext {
     const float *window;    ///< MDCT window function