]> rtime.felk.cvut.cz Git - hercules2020/kcf.git/blob - src/fft.cpp
412618d070b864f72c8d4dee6e30ff2421aaefab
[hercules2020/kcf.git] / src / fft.cpp
1
2 #include "fft.h"
3 #include <cassert>
4 #include "debug.h"
5
6 Fft::~Fft()
7 {
8
9 }
10
11 void Fft::init(unsigned width, unsigned height, unsigned num_of_feats, unsigned num_of_scales)
12 {
13     m_width = width;
14     m_height = height;
15     m_num_of_feats = num_of_feats;
16 #ifdef BIG_BATCH
17     m_num_of_scales = num_of_scales;
18 #else
19     (void)num_of_scales;
20 #endif
21 }
22
23 void Fft::set_window(const MatDynMem &window)
24 {
25     assert(window.dims == 2);
26     assert(window.size().width == int(m_width));
27     assert(window.size().height == int(m_height));
28     (void)window;
29 }
30
31 void Fft::forward(const MatScales &real_input, ComplexMat &complex_result)
32 {
33     TRACE("");
34     DEBUG_PRINT(real_input);
35     assert(real_input.dims == 3);
36 #ifdef BIG_BATCH
37     assert(real_input.size[0] == 1 || real_input.size[0] == int(m_num_of_scales));
38 #else
39     assert(real_input.size[0] == 1);
40 #endif
41     assert(real_input.size[1] == int(m_height));
42     assert(real_input.size[2] == int(m_width));
43
44     assert(complex_result.cols = freq_size(cv::Size(m_width, m_height)).width);
45     assert(complex_result.rows = freq_size(cv::Size(m_width, m_height)).height);
46     assert(complex_result.channels() == uint(real_input.size[0]));
47
48     (void)real_input;
49     (void)complex_result;
50 }
51
52 void Fft::forward_window(MatScaleFeats &patch_feats, ComplexMat &complex_result, MatScaleFeats &tmp)
53 {
54         assert(patch_feats.dims == 4);
55 #ifdef BIG_BATCH
56         assert(patch_feats.size[0] == 1 || patch_feats.size[0] ==  int(m_num_of_scales));
57 #else
58         assert(patch_feats.size[0] == 1);
59 #endif
60         assert(patch_feats.size[1] == int(m_num_of_feats));
61         assert(patch_feats.size[2] == int(m_height));
62         assert(patch_feats.size[3] == int(m_width));
63
64         assert(tmp.dims == patch_feats.dims);
65         assert(tmp.size[0] == patch_feats.size[0]);
66         assert(tmp.size[1] == patch_feats.size[1]);
67         assert(tmp.size[2] == patch_feats.size[2]);
68         assert(tmp.size[3] == patch_feats.size[3]);
69
70         (void)patch_feats;
71         (void)complex_result;
72         (void)tmp;
73 }
74
75 void Fft::inverse(ComplexMat &complex_input, MatScales &real_result)
76 {
77     TRACE("");
78     DEBUG_PRINT(complex_input);
79     assert(real_result.dims == 3);
80 #ifdef BIG_BATCH
81         assert(real_result.size[0] == 1 || real_result.size[0] ==  int(m_num_of_scales));
82 #else
83         assert(real_result.size[0] == 1);
84 #endif
85     assert(real_result.size[1] == int(m_height));
86     assert(real_result.size[2] == int(m_width));
87
88     (void)complex_input;
89     (void)real_result;
90 }