]> rtime.felk.cvut.cz Git - hercules2020/kcf.git/blobdiff - src/fft.h
Do not use virtual methods in FFT class
[hercules2020/kcf.git] / src / fft.h
index b165ef466fec20cbe1fabd55fbb60e8a73ab8d8e..9f74de387fc6ff6e3d263bf2e305bbe0a0fa86d0 100644 (file)
--- a/src/fft.h
+++ b/src/fft.h
@@ -5,28 +5,24 @@
 #include <opencv2/opencv.hpp>
 #include <vector>
 #include <cassert>
-
-#ifdef CUFFT
-    #include "complexmat.cuh"
-#else
-    #include "complexmat.hpp"
-#endif
+#include "complexmat.hpp"
 
 #ifdef BIG_BATCH
 #define BIG_BATCH_MODE 1
+#define IF_BIG_BATCH(true, false) true
 #else
 #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) = 0;
-    virtual void set_window(const MatDynMem &window) = 0;
-    virtual void forward(const cv::Mat & real_input, ComplexMat & complex_result) = 0;
-    virtual void forward_window(MatDynMem &patch_feats_in, ComplexMat & complex_result, MatDynMem &tmp) = 0;
-    virtual void inverse(ComplexMat &  complex_input, MatDynMem & real_result) = 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)
     {
@@ -38,12 +34,10 @@ public:
     }
 
 protected:
-    bool is_patch_feats_valid(const MatDynMem &patch_feats)
-    {
-        return patch_feats.dims == 3;
-               // && patch_feats.size[1] == width
-               // && patch_feats.size[2] == height
-    }
+    unsigned m_width, m_height, m_num_of_feats;
+#ifdef BIG_BATCH
+    unsigned m_num_of_scales;
+#endif
 };
 
 #endif // FFT_H