minor tweak to FFT

This commit is contained in:
Jean-Marc Valin 2008-02-24 22:06:04 +11:00
parent d911bc4d0d
commit e8b6830f53
2 changed files with 11 additions and 4 deletions

View file

@ -103,6 +103,13 @@ struct kiss_fft_state{
do{ (c).r = S_MUL( (c).r , s ) ;\ do{ (c).r = S_MUL( (c).r , s ) ;\
(c).i = S_MUL( (c).i , s ) ; }while(0) (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 */ #else /* MIXED_PRECISION */
# define sround4( x ) (kiss_fft_scalar)( ( (x) + ((SAMPPROD)1<<(FRACBITS-1)) ) >> (FRACBITS+2) ) # define sround4( x ) (kiss_fft_scalar)( ( (x) + ((SAMPPROD)1<<(FRACBITS-1)) ) >> (FRACBITS+2) )
@ -123,8 +130,6 @@ struct kiss_fft_state{
do{ (c).r = sround( smul( (c).r , s ) ) ;\ do{ (c).r = sround( smul( (c).r , s ) ) ;\
(c).i = sround( smul( (c).i , s ) ) ; }while(0) (c).i = sround( smul( (c).i , s ) ) ; }while(0)
#endif /* !MIXED_PRECISION */
# define DIVSCALAR(x,k) \ # define DIVSCALAR(x,k) \
(x) = sround( smul( x, SAMP_MAX/k ) ) (x) = sround( smul( x, SAMP_MAX/k ) )
@ -132,6 +137,8 @@ struct kiss_fft_state{
do { DIVSCALAR( (c).r , div); \ do { DIVSCALAR( (c).r , div); \
DIVSCALAR( (c).i , div); }while (0) DIVSCALAR( (c).i , div); }while (0)
#endif /* !MIXED_PRECISION */
#define L1 32767 #define L1 32767

View file

@ -66,8 +66,8 @@ void test1d(int nfft,int isinverse)
#ifdef DOUBLE_PRECISION #ifdef DOUBLE_PRECISION
for (k=0;k<nfft;++k) { for (k=0;k<nfft;++k) {
in[k].r *= 65536; in[k].r *= 32768;
in[k].i *= 65536; in[k].i *= 32768;
} }
#endif #endif