Ocean
TestFrameFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_TEST_TESTCV_TEST_FRAME_FILTER_H
9 #define META_OCEAN_TEST_TESTCV_TEST_FRAME_FILTER_H
10 
12 
13 #include "ocean/base/Frame.h"
15 
16 namespace Ocean
17 {
18 
19 namespace Test
20 {
21 
22 namespace TestCV
23 {
24 
25 /**
26  * This class implements a test for frame filter functions.
27  * @ingroup testcv
28  */
29 class OCEAN_TEST_CV_EXPORT TestFrameFilter
30 {
31  public:
32 
33  /**
34  * Tests all frame filter functions.
35  * @param testDuration Number of seconds for each test, with range (0, infinity)
36  * @param worker The worker object to distribute the CPU load
37  * @return True, if succeeded
38  */
39  static bool test(const double testDuration, Worker& worker);
40 
41  /**
42  * Tests the magnitude function.
43  * @param testDuration Number of seconds for each test, with range (0, infinity)
44  * @param worker The worker object to distribute the CPU load
45  * @return True, if succeeded
46  */
47  static bool testMagnitude(const double testDuration, Worker& worker);
48 
49  /**
50  * Tests the normalize value function.
51  * @param testDuration Number of seconds for each test, with range (0, infinity)
52  * @return True, if succeeded
53  */
54  static bool testNormalizeValue(const double testDuration);
55 
56  /**
57  * Tests the normalize value function.
58  * @param testDuration Number of seconds for each test, with range (0, infinity)
59  * @return True, if succeeded
60  * @tparam T The data type to be used
61  */
62  template <typename T>
63  static bool testNormalizeValue(const double testDuration);
64 
65  protected:
66 
67  /**
68  * Tests the magnitude function.
69  * @param magnitudeDataType The data type of the magnitude to be used for the test
70  * @param randomGenerator The random generator to be used
71  * @param worker The worker object to distribute the CPU load
72  * @return True, if succeeded
73  * @tparam T The data type of the frame to be used for the test
74  */
75  template <typename T>
76  static bool testMagnitude(const FrameType::DataType magnitudeDataType, RandomGenerator& randomGenerator, Worker& worker);
77 
78  /**
79  * Tests the magnitude function.
80  * @param randomGenerator The random generator to be used
81  * @param worker The worker object to distribute the CPU load
82  * @return True, if succeeded
83  * @tparam T The data type of the frame to be used for the test
84  * @tparam TMagnitude The data type of the magnitude to be used for the test
85  */
86  template <typename T, typename TMagnitude>
87  static bool testMagnitude(RandomGenerator& randomGenerator, Worker& worker);
88 
89  /**
90  * Verifies the value normalization.
91  * @param value The value to be normalized
92  * @tparam T The data type to be used
93  * @tparam tNormalizationDenominator The normalization factor, with range [1, infinity)
94  */
95  template <typename T, T tNormalizationDenominator>
96  static bool verifyValueNormalization(const T& value);
97 
98  /**
99  * Verifies the value normalization for floats.
100  * @param value The value to be normalized
101  * @tparam T The data type to be used
102  * @tparam tNormalizationDenominator The normalization factor, with range [1, infinity)
103  */
104  template <typename T, T tNormalizationDenominator>
105  static bool verifyValueNormalizationFloat(const T& value);
106 
107  /**
108  * Verifies the value normalization for integers.
109  * @param value The value to be normalized
110  * @tparam T The data type to be used
111  * @tparam tNormalizationDenominator The normalization factor, with range [1, infinity)
112  */
113  template <typename T, T tNormalizationDenominator>
114  static bool verifyValueNormalizationInteger(const T& value);
115 
116  /**
117  * Verifies the rounded value normalization for integers.
118  * @param value The value to be normalized
119  * @tparam T The data type to be used
120  * @tparam tNormalizationDenominator The normalization factor, with range [1, infinity)
121  */
122  template <typename T, T tNormalizationDenominator>
123  static bool verifyValueNormalizationIntegerRounded(const T& value);
124 
125  /**
126  * Verifies the not-rounded value normalization for integers.
127  * @param value The value to be normalized
128  * @tparam T The data type to be used
129  * @tparam tNormalizationDenominator The normalization factor, with range [1, infinity)
130  */
131  template <typename T, T tNormalizationDenominator>
132  static bool verifyValueNormalizationIntegerNotRounded(const T& value);
133 };
134 
135 }
136 
137 }
138 
139 }
140 
141 #endif // META_OCEAN_TEST_TESTCV_TEST_FRAME_FILTER_H
DataType
Definition of individual channel data type.
Definition: Frame.h:37
This class implements a generator for random numbers.
Definition: RandomGenerator.h:42
This class implements a test for frame filter functions.
Definition: TestFrameFilter.h:30
static bool test(const double testDuration, Worker &worker)
Tests all frame filter functions.
static bool verifyValueNormalizationIntegerNotRounded(const T &value)
Verifies the not-rounded value normalization for integers.
static bool testMagnitude(RandomGenerator &randomGenerator, Worker &worker)
Tests the magnitude function.
static bool testMagnitude(const FrameType::DataType magnitudeDataType, RandomGenerator &randomGenerator, Worker &worker)
Tests the magnitude function.
static bool verifyValueNormalizationIntegerRounded(const T &value)
Verifies the rounded value normalization for integers.
static bool testNormalizeValue(const double testDuration)
Tests the normalize value function.
static bool verifyValueNormalizationInteger(const T &value)
Verifies the value normalization for integers.
static bool verifyValueNormalization(const T &value)
Verifies the value normalization.
static bool testMagnitude(const double testDuration, Worker &worker)
Tests the magnitude function.
static bool verifyValueNormalizationFloat(const T &value)
Verifies the value normalization for floats.
static bool testNormalizeValue(const double testDuration)
Tests the normalize value function.
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15