mirror of
https://github.com/mborgerding/kissfft.git
synced 2025-05-27 13:10:26 -04:00
added kiss_fft_cleanup
updated Makefiles for long and simd targets
This commit is contained in:
parent
553bd4f13a
commit
3b5dfee961
2
Makefile
2
Makefile
@ -6,7 +6,7 @@ ZIPFILE=kiss_fft_v$(KFVER).zip
|
||||
|
||||
testall:
|
||||
# The simd and long types may or may not work on your machine
|
||||
export DATATYPE=simd && cd test && make test
|
||||
#export DATATYPE=simd && cd test && make test
|
||||
export DATATYPE=long && cd test && make test
|
||||
|
||||
export DATATYPE=short && cd test && make test
|
||||
|
4
TIPS
4
TIPS
@ -10,6 +10,10 @@ Speed:
|
||||
* If the input data has no imaginary component, use the kiss_fftr code under tools/.
|
||||
Real ffts are roughly twice as fast as complex.
|
||||
|
||||
* If you can rearrange your code to do 4 FFTs in parallel and you are on a recent Intel or AMD machine,
|
||||
then you might want to experiment with the USE_SIMD code.
|
||||
|
||||
|
||||
Reducing code size:
|
||||
* remove some of the butterflies. There are currently butterflies optimized for radices
|
||||
2,3,4,5. It is worth mentioning that you can still use FFT sizes that contain
|
||||
|
16
kiss_fft.c
16
kiss_fft.c
@ -26,7 +26,8 @@ static size_t ntmpbuf=0;
|
||||
#define CHECKBUF(buf,nbuf,n) \
|
||||
do { \
|
||||
if ( nbuf < (size_t)(n) ) {\
|
||||
buf = (kiss_fft_cpx*)realloc(buf,sizeof(kiss_fft_cpx)*(n)); \
|
||||
free(buf); \
|
||||
buf = (kiss_fft_cpx*)KISS_FFT_MALLOC(sizeof(kiss_fft_cpx)*(n)); \
|
||||
nbuf = (size_t)(n); \
|
||||
} \
|
||||
}while(0)
|
||||
@ -369,3 +370,16 @@ void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout)
|
||||
kiss_fft_stride(cfg,fin,fout,1);
|
||||
}
|
||||
|
||||
|
||||
/* not really necessary to call, but if someone is doing in-place ffts, they may want to free the
|
||||
buffers from CHECKBUF
|
||||
*/
|
||||
void kiss_fft_cleanup(void)
|
||||
{
|
||||
free(scratchbuf);
|
||||
scratchbuf = NULL;
|
||||
nscratchbuf=0;
|
||||
free(tmpbuf);
|
||||
tmpbuf=NULL;
|
||||
ntmpbuf=0;
|
||||
}
|
||||
|
@ -99,6 +99,13 @@ void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout
|
||||
buffer and can be simply free()d when no longer needed*/
|
||||
#define kiss_fft_free free
|
||||
|
||||
/*
|
||||
Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up
|
||||
your compiler output to call this before you exit.
|
||||
*/
|
||||
void kiss_fft_cleanup(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -54,9 +54,9 @@ tools:
|
||||
cd ../tools && make all
|
||||
|
||||
# for x86 pentium+ machines , these flags work well
|
||||
CFLAGS=-Wall -O3 -pedantic -march=pentiumpro -ffast-math -fomit-frame-pointer -I.. -I../tools $(WARNINGS)
|
||||
CFLAGS=-O3 -march=pentiumpro -ffast-math -fomit-frame-pointer -I.. -I../tools $(WARNINGS)
|
||||
# If the above flags do not work, try the following
|
||||
#CFLAGS=-Wall -O3 -I.. -I../tools $(WARNINGS)
|
||||
#CFLAGS=-O3 -I.. -I../tools $(WARNINGS)
|
||||
|
||||
$(SELFTEST): $(SELFTESTSRC) $(SRCFILES)
|
||||
$(CC) -o $@ $(CFLAGS) $(TYPEFLAGS) -lm $+
|
||||
|
@ -6,17 +6,23 @@ ifeq "$(DATATYPE)" ""
|
||||
DATATYPE=float
|
||||
endif
|
||||
|
||||
ifeq "$(DATATYPE)" "long"
|
||||
TYPEFLAGS=-DFIXED_POINT=32
|
||||
endif
|
||||
|
||||
ifeq "$(DATATYPE)" "short"
|
||||
TYPEFLAGS=-DFIXED_POINT -Dkiss_fft_scalar=short
|
||||
else
|
||||
TYPEFLAGS=-Dkiss_fft_scalar=$(DATATYPE)
|
||||
TYPEFLAGS=-DFIXED_POINT=16
|
||||
endif
|
||||
|
||||
ifeq "$(DATATYPE)" "simd"
|
||||
TYPEFLAGS=-DUSE_SIMD=1 -msse
|
||||
endif
|
||||
|
||||
ifeq "$(TYPEFLAGS)" ""
|
||||
TYPEFLAGS=-Dkiss_fft_scalar=$(DATATYPE)
|
||||
endif
|
||||
|
||||
|
||||
ifeq "$(DATATYPE)" "float"
|
||||
FFTUTIL=fft
|
||||
FASTFILT=fastconv
|
||||
|
Loading…
Reference in New Issue
Block a user