From 089923378d610492f1bad80a090005ecbd2da8a3 Mon Sep 17 00:00:00 2001 From: Mark Borgerding Date: Sat, 28 Nov 2009 04:14:47 +0000 Subject: [PATCH] working sourecforge bug --- Makefile | 2 +- kiss_fft.c | 14 ++++++++------ test/Makefile | 4 +--- test/test_real.c | 42 ++++++++++++++++++++++-------------------- 4 files changed, 32 insertions(+), 30 deletions(-) diff --git a/Makefile b/Makefile index b272b40..48f536e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -KFVER=1_2_8 +KFVER=1_2_9 DISTDIR=kiss_fft_v$(KFVER) TARBALL=kiss_fft_v$(KFVER).tar.gz diff --git a/kiss_fft.c b/kiss_fft.c index 1f8a8a2..e0540a6 100644 --- a/kiss_fft.c +++ b/kiss_fft.c @@ -225,29 +225,30 @@ static void kf_bfly_generic( kiss_fft_cpx t; int Norig = st->nfft; - CHECKBUF(scratchbuf,nscratchbuf,p); + kiss_fft_cpx * scratch = (kiss_fft_cpx*)malloc(sizeof(kiss_fft_cpx)*p); for ( u=0; u=Norig) twidx-=Norig; - C_MUL(t,scratchbuf[q] , twiddles[twidx] ); + C_MUL(t,scratch[q] , twiddles[twidx] ); C_ADDTO( Fout[ k ] ,t); } k += m; } } + free(scratch); } static @@ -268,7 +269,8 @@ void kf_work( #ifdef _OPENMP // use openmp extensions at the // top-level (not recursive) - if (fstride==1 && m != 1) { + if (fstride==1 && p<=5) + { int k; // execute the p different work units in different threads diff --git a/test/Makefile b/test/Makefile index 61dfb60..5456247 100644 --- a/test/Makefile +++ b/test/Makefile @@ -3,14 +3,12 @@ WARNINGS=-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return \ -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast \ -Wwrite-strings -# for x86 pentium+ machines , these flags work well -# CFLAGS=-O3 -I.. -I../tools $(WARNINGS) CFLAGS+=-ffast-math -fomit-frame-pointer CFLAGS+=-march=prescott #CFLAGS+= -mtune=native # TIP: try adding -openmp or -fopenmp to enable OPENMP directives and use of multiple cores -#CFLAGS+= -fopenmp +CFLAGS+=-fopenmp ifeq "$(NFFT)" "" diff --git a/test/test_real.c b/test/test_real.c index c926d88..36a0b08 100644 --- a/test/test_real.c +++ b/test/test_real.c @@ -59,38 +59,40 @@ double snr_compare( kiss_fft_cpx * vec1,kiss_fft_cpx * vec2, int n) } return snr; } -#define NFFT 8*3*5 #ifndef NUMFFTS #define NUMFFTS 10000 #endif -int main(void) +int main(int argc,char ** argv) { + int nfft = 8*3*5; double ts,tfft,trfft; int i; - kiss_fft_cpx cin[NFFT]; - kiss_fft_cpx cout[NFFT]; - kiss_fft_cpx sout[NFFT]; + if (argc>1) + nfft = atoi(argv[1]); + kiss_fft_cpx cin[nfft]; + kiss_fft_cpx cout[nfft]; + kiss_fft_cpx sout[nfft]; kiss_fft_cfg kiss_fft_state; kiss_fftr_cfg kiss_fftr_state; - kiss_fft_scalar rin[NFFT+2]; - kiss_fft_scalar rout[NFFT+2]; + kiss_fft_scalar rin[nfft+2]; + kiss_fft_scalar rout[nfft+2]; kiss_fft_scalar zero; memset(&zero,0,sizeof(zero) ); // ugly way of setting short,int,float,double, or __m128 to zero srand(time(0)); - for (i=0;i