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