#include <opencv2/opencv.hpp>
#include <vector>
+#include <cassert>
+#include "complexmat.hpp"
-#ifdef CUFFT
- #include "complexmat.cuh"
+#ifdef BIG_BATCH
+#define BIG_BATCH_MODE 1
+#define IF_BIG_BATCH(true, false) true
#else
- #include "complexmat.hpp"
+#define BIG_BATCH_MODE 0
+#define IF_BIG_BATCH(true, false) false
#endif
class Fft
{
public:
- virtual void init(unsigned width, unsigned height,unsigned num_of_feats, unsigned num_of_scales, bool big_batch_mode) = 0;
- virtual void set_window(const cv::Mat &window) = 0;
- virtual ComplexMat forward(const cv::Mat &input) = 0;
- virtual ComplexMat forward_window(const std::vector<cv::Mat> &input) = 0;
- virtual cv::Mat inverse(const ComplexMat &input) = 0;
- virtual ~Fft() = 0;
+ void init(unsigned width, unsigned height, unsigned num_of_feats, unsigned num_of_scales);
+ void set_window(const MatDynMem &window);
+ void forward(const MatScales &real_input, ComplexMat &complex_result);
+ void forward_window(MatScaleFeats &patch_feats_in, ComplexMat &complex_result, MatScaleFeats &tmp);
+ void inverse(ComplexMat &complex_input, MatScales &real_result);
+
+ static cv::Size freq_size(cv::Size space_size)
+ {
+ cv::Size ret(space_size);
+#if defined(CUFFT) || defined(FFTW)
+ ret.width = space_size.width / 2 + 1;
+#endif
+ return ret;
+ }
+
+protected:
+ unsigned m_width, m_height, m_num_of_feats;
+#ifdef BIG_BATCH
+ unsigned m_num_of_scales;
+#endif
};
#endif // FFT_H