1 #ifndef __SDR_FFTPLAN_FFTW3_HH__
2 #define __SDR_FFTPLAN_FFTW3_HH__
20 if (in.size() != out.size()) {
22 err <<
"Can not construct FFT plan: input & output buffers are of different size!";
25 if (in.isEmpty() || out.isEmpty()) {
27 err <<
"Can not construct FFT plan: input or output buffer is empty!";
31 int fftw_dir = FFTW_FORWARD;
32 if (FFT::BACKWARD == dir) { fftw_dir = FFTW_BACKWARD; }
34 _plan = fftw_plan_dft_1d(
35 in.size(), (fftw_complex *)in.data(), (fftw_complex *)out.data(),
36 fftw_dir, FFTW_ESTIMATE);
43 if (inplace.isEmpty()) {
45 err <<
"Can not construct FFT plan: Buffer is empty!";
49 int fftw_dir = FFTW_FORWARD;
50 if (FFT::BACKWARD == dir) { fftw_dir = FFTW_BACKWARD; }
52 _plan = fftw_plan_dft_1d(
53 inplace.size(), (fftw_complex *)inplace.data(), (fftw_complex *)inplace.data(),
54 fftw_dir, FFTW_ESTIMATE);
59 fftw_destroy_plan(_plan);
87 if (in.size() != out.size()) {
89 err <<
"Can not construct FFT plan: input & output buffers are of different size!";
93 if (in.isEmpty() || out.isEmpty()) {
95 err <<
"Can not construct FFT plan: input or output buffer is empty!";
99 int fftw_dir = FFTW_FORWARD;
100 if (FFT::BACKWARD == dir) { fftw_dir = FFTW_BACKWARD; }
102 _plan = fftwf_plan_dft_1d(
103 in.size(), (fftwf_complex *)in.data(), (fftwf_complex *)out.data(),
104 fftw_dir, FFTW_ESTIMATE);
111 if (inplace.isEmpty()) {
113 err <<
"Can not construct FFT plan: Buffer is empty!";
117 int fftw_dir = FFTW_FORWARD;
118 if (FFT::BACKWARD == dir) { fftw_dir = FFTW_BACKWARD; }
120 _plan = fftwf_plan_dft_1d(
121 inplace.size(), (fftwf_complex *)inplace.data(), (fftwf_complex *)inplace.data(),
122 fftw_dir, FFTW_ESTIMATE);
127 fftwf_destroy_plan(_plan);
132 fftwf_execute(_plan);
149 #endif // __SDR_FFTPLAN_FFTW3_HH__
FFTPlan(const Buffer< std::complex< double > > &in, const Buffer< std::complex< double > > &out, FFT::Direction dir)
Constructor.
Definition: fftplan_fftw3.hh:16
FFTPlan(const Buffer< std::complex< float > > &in, const Buffer< std::complex< float > > &out, FFT::Direction dir)
Constructor.
Definition: fftplan_fftw3.hh:83
void operator()()
Performs the FFT.
Definition: fftplan_native.hh:53
Direction
Direction type.
Definition: fftplan.hh:17
Definition: autocast.hh:8
Buffer< std::complex< Scalar > > _in
The input buffer.
Definition: fftplan_native.hh:79
Buffer< std::complex< float > > _out
Output buffer.
Definition: fftplan_fftw3.hh:139
Buffer< std::complex< double > > _in
Input buffer.
Definition: fftplan_fftw3.hh:69
virtual ~FFTPlan()
Destructor.
Definition: fftplan_fftw3.hh:126
Buffer< std::complex< Scalar > > _out
The output buffer.
Definition: fftplan_native.hh:81
FFTPlan(const Buffer< std::complex< float > > &inplace, FFT::Direction dir)
Constructor.
Definition: fftplan_fftw3.hh:108
fftw_plan _plan
The FFT plan.
Definition: fftplan_fftw3.hh:73
Buffer< std::complex< float > > _in
Input buffer.
Definition: fftplan_fftw3.hh:137
Buffer< std::complex< double > > _out
Output buffer.
Definition: fftplan_fftw3.hh:71
Trivial FFT implementation for buffer sizes of N=2**K.
Definition: fftplan.hh:11
fftwf_plan _plan
The fft plan.
Definition: fftplan_fftw3.hh:141
The configuration error class.
Definition: exception.hh:24
virtual ~FFTPlan()
Destructor.
Definition: fftplan_fftw3.hh:58
FFTPlan(const Buffer< std::complex< double > > &inplace, FFT::Direction dir)
Constructor.
Definition: fftplan_fftw3.hh:40
A typed buffer.
Definition: buffer.hh:111