-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathfft_fftw.h
47 lines (39 loc) · 1.16 KB
/
fft_fftw.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#ifdef USE_FFTW
//http://www.fftw.org/doc/Complex-One_002dDimensional-DFTs.html
//http://www.fftw.org/doc/Precision.html
#include <fftw3.h>
#define FFT_LIBRARY_USED "fftw3"
#define FFT_PLAN_T struct fft_plan_s
#define fft_malloc fftwf_malloc
#define fft_free fftwf_free
struct fft_plan_s
{
int size;
void* input;
void* output;
fftwf_plan plan;
};
#include "libcsdr.h"
FFT_PLAN_T* make_fft_c2c(int size, complexf* input, complexf* output, int forward, int benchmark);
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