shithub: opus

Download patch

ref: c8ce2ef3918c1c83109be015b5f51b253c1f9a58
parent: aaf40ef25912752ad8be5c11792d1aa46dc5e0f2
author: Jean-Marc Valin <[email protected]>
date: Thu Oct 25 10:44:37 EDT 2012

Keeping the deemphasis coefficients in local variable to avoid aliasing issues

--- a/celt/celt.c
+++ b/celt/celt.c
@@ -572,6 +572,10 @@
 {
    int c;
    int Nd;
+   opus_val16 coef0, coef1;
+
+   coef0 = coef[0];
+   coef1 = coef[1];
    Nd = N/downsample;
    c=0; do {
       int j;
@@ -581,21 +585,22 @@
       x =in[c];
       y = pcm+c;
       /* Shortcut for the standard (non-custom modes) case */
-      if (coef[1] == 0)
+      if (coef1 == 0)
       {
          for (j=0;j<N;j++)
          {
             celt_sig tmp = x[j] + m;
-            m = MULT16_32_Q15(coef[0], tmp);
+            m = MULT16_32_Q15(coef0, tmp);
             scratch[j] = tmp;
          }
       } else {
+         opus_val16 coef3 = coef[3];
          for (j=0;j<N;j++)
          {
             celt_sig tmp = x[j] + m;
-            m = MULT16_32_Q15(coef[0], tmp)
-              - MULT16_32_Q15(coef[1], x[j]);
-            tmp = SHL32(MULT16_32_Q15(coef[3], tmp), 2);
+            m = MULT16_32_Q15(coef0, tmp)
+              - MULT16_32_Q15(coef1, x[j]);
+            tmp = SHL32(MULT16_32_Q15(coef3, tmp), 2);
             scratch[j] = tmp;
          }
       }