shithub: opus

Download patch

ref: cb1cf2f169cc46cb911600bf3436b8ac38a94901
parent: ef1002746cd08410e71e676669a436ce9db63eee
author: Jean-Marc Valin <[email protected]>
date: Fri Apr 25 18:39:46 EDT 2008

Brought the mdct test-case with the recent changes to the mdct semantic

--- a/tests/mdct-test.c
+++ b/tests/mdct-test.c
@@ -20,7 +20,7 @@
            double phase = 2*M_PI*(k+.5+.25*nfft)*(bin+.5)/nfft;
            double re = cos(phase);
             
-           re /= nfft/2;
+           re /= nfft/4;
 
            ansr += in[k] * re;
         }
@@ -75,6 +75,7 @@
 
     kiss_fft_scalar  * in = (kiss_fft_scalar*)malloc(buflen);
     kiss_fft_scalar  * out= (kiss_fft_scalar*)malloc(buflen);
+    celt_word16_t  * window= (celt_word16_t*)malloc(sizeof(celt_word16_t)*nfft/2);
     int k;
 
     mdct_init(&cfg, nfft);
@@ -82,9 +83,12 @@
         in[k] = (rand() % 32768) - 16384;
     }
 
+    for (k=0;k<nfft/2;++k) {
+       window[k] = Q15ONE;
+    }
 #ifdef DOUBLE_PRECISION
     for (k=0;k<nfft;++k) {
-       in[k] *= 65536;
+       in[k] *= 32768;
     }
 #endif
     
@@ -99,10 +103,12 @@
        
     if (isinverse)
     {
-       mdct_backward(&cfg,in,out, NULL, 0);
+       for (k=0;k<nfft;++k)
+          out[k] = 0;
+       mdct_backward(&cfg,in,out, window, nfft/2);
        check_inv(in,out,nfft,isinverse);
     } else {
-       mdct_forward(&cfg,in,out,NULL, 0);
+       mdct_forward(&cfg,in,out,window, nfft/2);
        check(in,out,nfft,isinverse);
     }
     /*for (k=0;k<nfft;++k) printf("%d %d ", out[k].r, out[k].i);printf("\n");*/