X-Git-Url: http://git.xiph.org/?p=opus.git;a=blobdiff_plain;f=libcelt%2F_kiss_fft_guts.h;h=5d5aa3b10fe241969057a9fa6a7ffbf4a1aa5a32;hp=a4976832396e7b838a991c94920c23e3d54229f6;hb=568326bfe2c35aef831b1975fa30f80d8a79508a;hpb=b155bb8860e52e73f60a71f7c4acaadb4cb41a9c diff --git a/libcelt/_kiss_fft_guts.h b/libcelt/_kiss_fft_guts.h index a4976832..5d5aa3b1 100644 --- a/libcelt/_kiss_fft_guts.h +++ b/libcelt/_kiss_fft_guts.h @@ -24,21 +24,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */ #include "kiss_fft.h" -#define MAXFACTORS 32 -/* e.g. an fft of length 128 has 4 factors - as far as kissfft is concerned - 4*4*4*2 - */ - -struct kiss_fft_state{ - int nfft; -#ifndef FIXED_POINT - kiss_fft_scalar scale; -#endif - int factors[2*MAXFACTORS]; - int *bitrev; - kiss_twiddle_cpx twiddles[1]; -}; /* Explanation of macros dealing with complex math: @@ -52,24 +37,21 @@ struct kiss_fft_state{ #ifdef FIXED_POINT #include "arch.h" +#define DOUBLE_PRECISION + #ifdef DOUBLE_PRECISION # define FRACBITS 31 -# define SAMPPROD celt_int64_t +# define SAMPPROD long long #define SAMP_MAX 2147483647 -#ifdef MIXED_PRECISION #define TWID_MAX 32767 #define TRIG_UPSCALE 1 -#else -#define TRIG_UPSCALE 65536 -#define TWID_MAX 2147483647 -#endif #define EXT32(a) (a) #else /* DOUBLE_PRECISION */ # define FRACBITS 15 -# define SAMPPROD celt_int32_t +# define SAMPPROD celt_int32 #define SAMP_MAX 32767 #define TRIG_UPSCALE 1 #define EXT32(a) EXTEND32(a) @@ -87,7 +69,6 @@ struct kiss_fft_state{ # define smul(a,b) ( (SAMPPROD)(a)*(b) ) # define sround( x ) (kiss_fft_scalar)( ( (x) + ((SAMPPROD)1<<(FRACBITS-1)) ) >> FRACBITS ) -#ifdef MIXED_PRECISION # define S_MUL(a,b) MULT16_32_Q15(b, a) @@ -128,34 +109,6 @@ struct kiss_fft_state{ do {(res).r = ADD32((res).r,(a).r); (res).i = SUB32((res).i,(a).i); \ }while(0) -#else /* MIXED_PRECISION */ -# define sround4( x ) (kiss_fft_scalar)( ( (x) + ((SAMPPROD)1<<(FRACBITS-1)) ) >> (FRACBITS+2) ) - -# define S_MUL(a,b) sround( smul(a,b) ) - -# define C_MUL(m,a,b) \ - do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \ - (m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0) -# define C_MULC(m,a,b) \ - do{ (m).r = sround( smul((a).r,(b).r) + smul((a).i,(b).i) ); \ - (m).i = sround( smul((a).i,(b).r) - smul((a).r,(b).i) ); }while(0) - -# define C_MUL4(m,a,b) \ - do{ (m).r = sround4( smul((a).r,(b).r) - smul((a).i,(b).i) ); \ - (m).i = sround4( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0) - -# define C_MULBYSCALAR( c, s ) \ - do{ (c).r = sround( smul( (c).r , s ) ) ;\ - (c).i = sround( smul( (c).i , s ) ) ; }while(0) - -# define DIVSCALAR(x,k) \ - (x) = sround( smul( x, SAMP_MAX/k ) ) - -# define C_FIXDIV(c,div) \ - do { DIVSCALAR( (c).r , div); \ - DIVSCALAR( (c).i , div); }while (0) - -#endif /* !MIXED_PRECISION */ @@ -222,11 +175,11 @@ struct kiss_fft_state{ #elif defined(USE_SIMD) # define KISS_FFT_COS(phase) _mm_set1_ps( cos(phase) ) # define KISS_FFT_SIN(phase) _mm_set1_ps( sin(phase) ) -# define HALF_OF(x) ((x)*_mm_set1_ps(.5)) +# define HALF_OF(x) ((x)*_mm_set1_ps(.5f)) #else # define KISS_FFT_COS(phase) (kiss_fft_scalar) cos(phase) # define KISS_FFT_SIN(phase) (kiss_fft_scalar) sin(phase) -# define HALF_OF(x) ((x)*.5) +# define HALF_OF(x) ((x)*.5f) #endif #define kf_cexp(x,phase) \