fft.cc (speech_tools-2.4-release) | : | fft.cc (speech_tools-2.5.0-release) | ||
---|---|---|---|---|
skipping to change at line 252 | skipping to change at line 252 | |||
** | ** | |||
** Modified to use EST_FVector class Simon King (simonk@cstr.ed.ac.uk) Nov 96 | ** Modified to use EST_FVector class Simon King (simonk@cstr.ed.ac.uk) Nov 96 | |||
** | ** | |||
*/ | */ | |||
#define signum(i) (i < 0 ? -1 : i == 0 ? 0 : 1) | #define signum(i) (i < 0 ? -1 : i == 0 ? 0 : 1) | |||
int fastFFT(EST_FVector &invec) | int fastFFT(EST_FVector &invec) | |||
{ | { | |||
// Tony Robinsons | // Tony Robinsons | |||
float fn; | int i, in, nn, n2pow, n4pow; | |||
int i, in, nn, n2pow, n4pow, nthpo; | ||||
// we could modify all the code to use vector classes .... | // we could modify all the code to use vector classes .... | |||
// ... or we could do this: | // ... or we could do this: | |||
// TO DO | // TO DO | |||
// use FSimpleVector::copy_section here | // use FSimpleVector::copy_section here | |||
// quick fix | // quick fix | |||
int n=invec.n(); // order | int n=invec.n(); // order | |||
#if 0 | #if 0 | |||
float *b = new float[n]; | float *b = new float[n]; | |||
for(i=0; i<n; i++) | for(i=0; i<n; i++) | |||
b[i] = invec(i); | b[i] = invec(i); | |||
#endif | #endif | |||
float *b=invec.memory(); | float *b=invec.memory(); | |||
n2pow = fastlog2(n); | n2pow = fastlog2(n); | |||
if (n2pow <= 0) return 0; | if (n2pow <= 0) return 0; | |||
nthpo = n; | ||||
fn = nthpo; | ||||
n4pow = n2pow / 2; | n4pow = n2pow / 2; | |||
/* radix 2 iteration required; do it now */ | /* radix 2 iteration required; do it now */ | |||
if (n2pow % 2) | if (n2pow % 2) | |||
{ | { | |||
nn = 2; | nn = 2; | |||
in = n / nn; | in = n / nn; | |||
FR2TR(in, b, b + in ); | FR2TR(in, b, b + in ); | |||
} | } | |||
else nn = 1; | else nn = 1; | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 1 lines changed or added |