shithub: opus

Download patch

ref: 2e78b27688a2ba0c2c8e367f8c6e2125371fce89
parent: dbe9a439380af4f03cf441ac00c53faea25b8a3d
author: Jean-Marc Valin <[email protected]>
date: Mon Aug 15 05:39:16 EDT 2011

kiss fft cleanup

--- a/libcelt/_kiss_fft_guts.h
+++ b/libcelt/_kiss_fft_guts.h
@@ -35,30 +35,14 @@
 #ifdef FIXED_POINT
 #include "arch.h"
 
-#define DOUBLE_PRECISION
 
-#ifdef DOUBLE_PRECISION
-
 # define SAMPPROD long long
 #define SAMP_MAX 2147483647
 #define TWID_MAX 32767
 #define TRIG_UPSCALE 1
 
-#else /* DOUBLE_PRECISION */
-
-# define SAMPPROD opus_int32
-#define SAMP_MAX 32767
-#define TRIG_UPSCALE 1
-
-#endif /* !DOUBLE_PRECISION */
-
 #define SAMP_MIN -SAMP_MAX
 
-#if defined(CHECK_OVERFLOW)
-#  define CHECK_OVERFLOW_OP(a,op,b)  \
-	if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \
-		fprintf(stderr,"WARNING:overflow @ " __FILE__ "(%d): (%d " #op" %d) = %ld\n",__LINE__,(a),(b),(SAMPPROD)(a) op (SAMPPROD)(b) );  }
-#endif
 
 #   define S_MUL(a,b) MULT16_32_Q15(b, a)
 
--- a/libcelt/kiss_fft.h
+++ b/libcelt/kiss_fft.h
@@ -48,18 +48,12 @@
 
 #ifdef FIXED_POINT
 #include "arch.h"	
-#define DOUBLE_PRECISION
 
-#ifdef DOUBLE_PRECISION
 #  define kiss_fft_scalar opus_int32
 #  define kiss_twiddle_scalar opus_int16
-#  define KF_SUFFIX _celt_double
+
+
 #else
-#  define kiss_fft_scalar opus_int16
-#  define kiss_twiddle_scalar opus_int16
-#  define KF_SUFFIX _celt_single
-#endif
-#else
 # ifndef kiss_fft_scalar
 /*  default is float */
 #   define kiss_fft_scalar float
@@ -66,22 +60,6 @@
 #   define kiss_twiddle_scalar float
 #   define KF_SUFFIX _celt_single
 # endif
-#endif
-
-#if 0
-/* This adds a suffix to all the opus_fft functions so we
-   can easily link with more than one copy of the fft */
-#define CAT_SUFFIX(a,b) a ## b
-#define SUF(a,b) CAT_SUFFIX(a, b)
-
-#define kiss_fft_alloc_twiddles SUF(opus_fft_alloc_twiddles,KF_SUFFIX)
-#define kiss_fft_alloc SUF(opus_fft_alloc,KF_SUFFIX)
-#define kiss_fft SUF(opus_fft,KF_SUFFIX)
-#define kiss_ifft SUF(opus_ifft,KF_SUFFIX)
-#define kiss_fft_stride SUF(kiss_fft_stride,KF_SUFFIX)
-#define kiss_ifft_stride SUF(kiss_ifft_stride,KF_SUFFIX)
-#define kiss_fft_free SUF(opus_fft_free,KF_SUFFIX)
-
 #endif
 
 typedef struct {
--- a/libcelt/tests/dft-test.c
+++ b/libcelt/tests/dft-test.c
@@ -82,12 +82,10 @@
         in[k].i = (rand() % 32767) - 16384;
     }
 
-#ifdef DOUBLE_PRECISION
     for (k=0;k<nfft;++k) {
        in[k].r *= 32768;
        in[k].i *= 32768;
     }
-#endif
 
     if (isinverse)
     {
--- a/libcelt/tests/mdct-test.c
+++ b/libcelt/tests/mdct-test.c
@@ -105,11 +105,9 @@
     for (k=0;k<nfft/2;++k) {
        window[k] = Q15ONE;
     }
-#ifdef DOUBLE_PRECISION
     for (k=0;k<nfft;++k) {
        in[k] *= 32768;
     }
-#endif
 
     if (isinverse)
     {