non-negative mdct input index
authorJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Mon, 21 Apr 2008 21:50:50 +0000 (07:50 +1000)
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Mon, 21 Apr 2008 21:50:50 +0000 (07:50 +1000)
libcelt/celt.c
libcelt/mdct.c

index 8a7f39f..ff02973 100644 (file)
@@ -161,7 +161,7 @@ static void compute_mdcts(const CELTMode *mode, const celt_word16_t * restrict w
    N4 = (N-overlap)>>1;
    if (C==1)
    {
-      mdct_forward(lookup, in-N4, out, window, overlap);
+      mdct_forward(lookup, in, out, window, overlap);
    } else {
       VARDECL(celt_word32_t, x);
       VARDECL(celt_word32_t, tmp);
@@ -175,7 +175,7 @@ static void compute_mdcts(const CELTMode *mode, const celt_word16_t * restrict w
             x[j+N4] = in[C*j+c];
          CELT_MEMSET(x, 0, N4);
          CELT_MEMSET(x+2*N-N4, 0, N4);
-         mdct_forward(lookup, x, tmp, window, overlap);
+         mdct_forward(lookup, x+N4, tmp, window, overlap);
          /* Interleaving the sub-frames */
          for (j=0;j<N;j++)
             out[C*j+c] = tmp[j];
index 9db0707..d30b350 100644 (file)
@@ -101,8 +101,8 @@ void mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * r
    /* Shuffle, fold, pre-rotate (part 1) */
    {
       /* Temp pointers to make it really clear to the compiler what we're doing */
-      const kiss_fft_scalar * restrict xp1 = in+N4;
-      const kiss_fft_scalar * restrict xp2 = in+N2+N4-1;
+      const kiss_fft_scalar * restrict xp1 = in+overlap/2;
+      const kiss_fft_scalar * restrict xp2 = in+N2-1+overlap/2;
       kiss_fft_scalar * restrict yp = out;
       kiss_fft_scalar *t = &l->trig[0];
       const celt_word16_t * restrict wp1 = window+overlap/2;