shithub: opus

Download patch

ref: e8b6830f538e41a5a0db076bd183db43e3b99b3e
parent: d911bc4d0d671d9f18e254427059d6b9c7c074f9
author: Jean-Marc Valin <[email protected]>
date: Sun Feb 24 17:06:04 EST 2008

minor tweak to FFT

--- a/libcelt/_kiss_fft_guts.h
+++ b/libcelt/_kiss_fft_guts.h
@@ -103,6 +103,13 @@
       do{ (c).r =  S_MUL( (c).r , s ) ;\
           (c).i =  S_MUL( (c).i , s ) ; }while(0)
 
+#   define DIVSCALAR(x,k) \
+        (x) = S_MUL(  x, (TWID_MAX-((k)>>1))/(k)+1 )
+
+#   define C_FIXDIV(c,div) \
+        do {    DIVSCALAR( (c).r , div);  \
+                DIVSCALAR( (c).i  , div); }while (0)
+
 #else /* MIXED_PRECISION */
 #   define sround4( x )  (kiss_fft_scalar)( ( (x) + ((SAMPPROD)1<<(FRACBITS-1)) ) >> (FRACBITS+2) )
 
@@ -123,8 +130,6 @@
                do{ (c).r =  sround( smul( (c).r , s ) ) ;\
                (c).i =  sround( smul( (c).i , s ) ) ; }while(0)
 
-#endif /* !MIXED_PRECISION */
-
 #   define DIVSCALAR(x,k) \
 	(x) = sround( smul(  x, SAMP_MAX/k ) )
 
@@ -131,6 +136,8 @@
 #   define C_FIXDIV(c,div) \
 	do {    DIVSCALAR( (c).r , div);  \
 		DIVSCALAR( (c).i  , div); }while (0)
+
+#endif /* !MIXED_PRECISION */
 
 
                
--- a/tests/dft-test.c
+++ b/tests/dft-test.c
@@ -66,8 +66,8 @@
 
 #ifdef DOUBLE_PRECISION
     for (k=0;k<nfft;++k) {
-       in[k].r *= 65536;
-       in[k].i *= 65536;
+       in[k].r *= 32768;
+       in[k].i *= 32768;
     }
 #endif