From 0d6d61cfce946427300a114e697831276f05a07e Mon Sep 17 00:00:00 2001 From: Mark Borgerding Date: Sat, 11 Oct 2003 23:07:16 +0000 Subject: [PATCH] reduced calling parameters negligible performane impact --- kiss_fft.c | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/kiss_fft.c b/kiss_fft.c index e39a70b..297e627 100644 --- a/kiss_fft.c +++ b/kiss_fft.c @@ -27,7 +27,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * }kiss_fft_cpx; */ - typedef struct { int nfft; int inverse; @@ -65,38 +64,31 @@ kiss_fft_cpx cexp(double phase) return x; } -static kiss_fft_cpx cmul(kiss_fft_cpx a,kiss_fft_cpx b) -{ - kiss_fft_cpx c; - C_MUL(c,a,b); - return c; -} - // the heart of the fft static void fft_work( kiss_fft_cpx * Fout, const kiss_fft_cpx * f, int fstride, - int n, - int Norig, - int inverse, - kiss_fft_cpx * scratch, - kiss_fft_cpx * twiddles, - int * factors + int * factors, + const kiss_fft_state * st ) { int m,p=0,q,q1,u,k; kiss_fft_cpx t; + kiss_fft_cpx * scratch = st->scratch; + kiss_fft_cpx * twiddles = st->twiddles; + int Norig = st->nfft; p=*factors++; m=*factors++;//m = n/p; for (q=0;qscratch = (kiss_fft_cpx*)(st->tmpbuf + nfft); st->factors = (int*)(st->scratch + nfft); // just after tmpbuf - /* - st->twiddles = (kiss_fft_cpx*)malloc( sizeof(kiss_fft_cpx)*nfft ); - st->tmpbuf = (kiss_fft_cpx*)malloc( sizeof(kiss_fft_cpx)*nfft ); - st->scratch = (kiss_fft_cpx*)malloc( sizeof(kiss_fft_cpx)*nfft ); - st->factors = (int*)malloc( sizeof(int)*nfft ); - */ for (i=0;infft; memcpy(st->tmpbuf,f,sizeof(kiss_fft_cpx)*n); - fft_work( f, st->tmpbuf, 1, n,n, st->inverse, st->scratch ,st->twiddles,st->factors); + fft_work( f, st->tmpbuf, 1, st->factors,st ); }