Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ PARAMS_SSE = $(call cpufeature,sse,-msse) $(call cpufeature,sse2,-msse2) $(call
PARAMS_NEON = -mfloat-abi=hard -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mvectorize-with-neon-quad -funsafe-math-optimizations -Wformat=0 -DNEON_OPTS
#tnx Jan Szumiec for the Raspberry Pi support
PARAMS_RASPI = -mfloat-abi=hard -mcpu=arm1176jzf-s -mfpu=vfp -funsafe-math-optimizations -Wformat=0
PARAMS_ARM = $(if $(call cpufeature,BCM2708,dummy-text),$(PARAMS_RASPI),$(PARAMS_NEON))
# since raspbian buster, fftw3 comes with the slow timer enabled, which causes troubles, so we have to disable FFTW_MEASURE
PARAMS_ARM = $(if $(call cpufeature,BCM2708,dummy-text),$(PARAMS_RASPI),$(PARAMS_NEON)) -DCSDR_DISABLE_FFTW_MEASURE
PARAMS_SIMD = $(if $(call cpufeature,sse,dummy-text),$(PARAMS_SSE),$(PARAMS_ARM))
PARAMS_LOOPVECT = -O3 -ffast-math -fdump-tree-vect-details -dumpbase dumpvect
PARAMS_LIBS = -g -lm -lrt -lfftw3f -DUSE_FFTW -DLIBCSDR_GPL -DUSE_IMA_ADPCM
Expand Down
6 changes: 3 additions & 3 deletions fft_fftw.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
FFT_PLAN_T* make_fft_c2c(int size, complexf* input, complexf* output, int forward, int benchmark)
{
FFT_PLAN_T* plan=(FFT_PLAN_T*)malloc(sizeof(FFT_PLAN_T));
plan->plan = fftwf_plan_dft_1d(size, (fftwf_complex*)input, (fftwf_complex*)output, (forward)?FFTW_FORWARD:FFTW_BACKWARD, (benchmark)?FFTW_MEASURE:FFTW_ESTIMATE);
plan->plan = fftwf_plan_dft_1d(size, (fftwf_complex*)input, (fftwf_complex*)output, (forward)?FFTW_FORWARD:FFTW_BACKWARD, (benchmark)?CSDR_FFTW_MEASURE:FFTW_ESTIMATE);
plan->size=size;
plan->input=(void*)input;
plan->output=(void*)output;
Expand All @@ -16,7 +16,7 @@ FFT_PLAN_T* make_fft_c2c(int size, complexf* input, complexf* output, int forwar
FFT_PLAN_T* make_fft_r2c(int size, float* input, complexf* output, int benchmark) //always forward DFT
{
FFT_PLAN_T* plan=(FFT_PLAN_T*)malloc(sizeof(FFT_PLAN_T));
plan->plan = fftwf_plan_dft_r2c_1d(size, input, (fftwf_complex*)output, (benchmark)?FFTW_MEASURE:FFTW_ESTIMATE);
plan->plan = fftwf_plan_dft_r2c_1d(size, input, (fftwf_complex*)output, (benchmark)?CSDR_FFTW_MEASURE:FFTW_ESTIMATE);
plan->size=size;
plan->input=(void*)input;
plan->output=(void*)output;
Expand All @@ -26,7 +26,7 @@ FFT_PLAN_T* make_fft_r2c(int size, float* input, complexf* output, int benchmark
FFT_PLAN_T* make_fft_c2r(int size, complexf* input, float* output, int benchmark) //always backward DFT
{
FFT_PLAN_T* plan=(FFT_PLAN_T*)malloc(sizeof(FFT_PLAN_T));
plan->plan = fftwf_plan_dft_c2r_1d(size, (fftwf_complex*)input, output, (benchmark)?FFTW_MEASURE:FFTW_ESTIMATE);
plan->plan = fftwf_plan_dft_c2r_1d(size, (fftwf_complex*)input, output, (benchmark)?CSDR_FFTW_MEASURE:FFTW_ESTIMATE);
plan->size=size;
plan->input=(void*)input;
plan->output=(void*)output;
Expand Down
18 changes: 18 additions & 0 deletions fft_fftw.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,22 @@ FFT_PLAN_T* make_fft_r2c(int size, float* input, complexf* output, int benchmark
void fft_execute(FFT_PLAN_T* plan);
void fft_destroy(FFT_PLAN_T* plan);

/*
* FFTW_MEASURE is inacceptably slow when there is no hardware cycle counter
* available. Unfortunately, there's no way to detect this at compile- or
* runtime.
*
* CSDR_DISABLE_FFTW_MEASURE can therefore be used to disable the use of
* FFTW_MEASURE globally.
*
* additional information: http://www.fftw.org/fftw3_doc/Cycle-Counters.html
*
* https://github.com/simonyiszk/openwebrx/issues/139
*/
#ifdef CSDR_DISABLE_FFTW_MEASURE
#define CSDR_FFTW_MEASURE FFTW_ESTIMATE
#else
#define CSDR_FFTW_MEASURE FFTW_MEASURE
#endif

#endif