shithub: opus

Download patch

ref: 1a3ed79cbe547b53693bc79ca3a7af07fbb919cc
parent: bdb58836ce6382af858be92ec8bfe09a9d816c54
author: Jean-Marc Valin <[email protected]>
date: Sun Apr 20 16:39:53 EDT 2008

Saved two copies when computing MDCTs of mono signals

--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -181,10 +181,15 @@
       }
       CELT_MEMSET(x, 0, N4);
       CELT_MEMSET(x+2*N-N4, 0, N4);
-      mdct_forward(lookup, x, tmp);
-      /* Interleaving the sub-frames */
-      for (j=0;j<N;j++)
-         out[C*j+c] = tmp[j];
+      if (C==1)
+      {
+         mdct_forward(lookup, x, out);
+      } else {
+         mdct_forward(lookup, x, tmp);
+         /* Interleaving the sub-frames */
+         for (j=0;j<N;j++)
+            out[C*j+c] = tmp[j];
+      }
    }
    RESTORE_STACK;
 }
@@ -206,10 +211,14 @@
    for (c=0;c<C;c++)
    {
       int j;
-      /* De-interleaving the sub-frames */
-      for (j=0;j<N;j++)
-         tmp[j] = X[C*j+c];
-      mdct_backward(lookup, tmp, x);
+      if (C==1) {
+         mdct_backward(lookup, X, x);
+      } else {
+         /* De-interleaving the sub-frames */
+         for (j=0;j<N;j++)
+            tmp[j] = X[C*j+c];
+         mdct_backward(lookup, tmp, x);
+      }
          /* The first and last part would need to be set to zero if we actually
       wanted to use them. */
       for (j=0;j<overlap;j++)