]> rtime.felk.cvut.cz Git - hercules2020/kcf.git/blob - src/fft_fftw.h
Gaussian correlation for CUFFT version is now on GPU. Also corrected << operator...
[hercules2020/kcf.git] / src / fft_fftw.h
1
2 #ifndef FFT_FFTW_H
3 #define FFT_FFTW_H
4
5 #include "fft.h"
6
7 #if defined(ASYNC)
8 #include <mutex>
9 #endif
10
11 #ifndef CUFFTW
12   #include <fftw3.h>
13 #else
14   #include <cufftw.h>
15 #endif //CUFFTW
16
17 class Fftw : public Fft
18 {
19 public:
20     Fftw();
21     Fftw(int num_of_threads);
22     void init(unsigned width, unsigned height, unsigned num_of_feats, unsigned num_of_scales, bool big_batch_mode) override;
23     void set_window(const cv::Mat &window) override;
24     ComplexMat forward(const cv::Mat &input) override;
25     ComplexMat forward_raw(float *input, bool all_scales) override;
26     ComplexMat forward_window(const std::vector<cv::Mat> &input) override;
27     cv::Mat inverse(const ComplexMat &input) override;
28     float* inverse_raw(const ComplexMat &input) override;
29     ~Fftw() override;
30 private:
31     unsigned m_num_threads = 6;
32     unsigned m_width, m_height, m_num_of_feats, m_num_of_scales;
33     bool m_big_batch_mode;
34     cv::Mat m_window;
35     fftwf_plan plan_f, plan_f_all_scales, plan_fw, plan_fw_all_scales, plan_i_features,
36         plan_i_features_all_scales, plan_i_1ch, plan_i_1ch_all_scales;
37 };
38
39 #endif // FFT_FFTW_H