-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFFT_FFTW3.h
37 lines (29 loc) · 1.34 KB
/
FFT_FFTW3.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
/* The information in this file is
* Copyright (C) 2011, Sven De Smet <[email protected]>
* and is subject to the terms and conditions of the
* GNU Lesser General Public License Version 2.1
* The license text is available from
* http://www.gnu.org/licenses/lgpl.html
*/
#ifndef FFT_FFTW3_H
#define FFT_FFTW3_H
#ifdef USE_FFTW
#include "FFT.h"
#include <fftw3.h>
template <class D> class FFT_FFTW3 : public FFT<D> {
private:
fftwf_plan plan;
SplitInterleavedDataInterface<D>* splitInterleavedDataInterface;
public:
static std::string getName() { return "FFTW3"; }
FFT_FFTW3(int n, bool forward = true, int iBatchCount = 1) : FFT<D>(n, iBatchCount) {
this->dataInterface = splitInterleavedDataInterface = new SplitInterleavedDataInterface<D>(this->batchCount*this->size, false);
plan = fftwf_plan_many_dft(1, &this->size, this->batchCount, (fftwf_complex *) splitInterleavedDataInterface->in->getData(), NULL, 1, this->size,
(fftwf_complex *) splitInterleavedDataInterface->out->getData(), NULL, 1, this->size,
forward ? FFTW_FORWARD : FFTW_BACKWARD, FFTW_ESTIMATE);
}
virtual void execute() { fftwf_execute(plan); }
virtual ~FFT_FFTW3() { fftwf_destroy_plan(plan); }
};
#endif
#endif // FFT_FFTW3_H