Ocean
Loading...
Searching...
No Matches
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
14
15#include "ocean/base/Frame.h"
17
18namespace Ocean
19{
20
21namespace Test
22{
23
24namespace TestCV
25{
26
27/**
28 * This class implements a test for frame filter functions.
29 * @ingroup testcv
30 */
31class OCEAN_TEST_CV_EXPORT TestFrameFilter
32{
33 public:
34
35 /**
36 * Tests all frame filter functions.
37 * @param testDuration Number of seconds for each test, with range (0, infinity)
38 * @param worker The worker object to distribute the CPU load
39 * @param selector The test selector to filter tests
40 * @return True, if succeeded
41 */
42 static bool test(const double testDuration, Worker& worker, const TestSelector& selector = TestSelector());
43
44 /**
45 * Tests the magnitude function.
46 * @param testDuration Number of seconds for each test, with range (0, infinity)
47 * @param worker The worker object to distribute the CPU load
48 * @return True, if succeeded
49 */
50 static bool testMagnitude(const double testDuration, Worker& worker);
51
52 /**
53 * Tests the normalize value function.
54 * @param testDuration Number of seconds for each test, with range (0, infinity)
55 * @return True, if succeeded
56 */
57 static bool testNormalizeValue(const double testDuration);
58
59 /**
60 * Tests the normalize value function.
61 * @param testDuration Number of seconds for each test, with range (0, infinity)
62 * @return True, if succeeded
63 * @tparam T The data type to be used
64 */
65 template <typename T>
66 static bool testNormalizeValue(const double testDuration);
67
68 protected:
69
70 /**
71 * Tests the magnitude function.
72 * @param magnitudeDataType The data type of the magnitude to be used for the test
73 * @param randomGenerator The random generator to be used
74 * @param worker The worker object to distribute the CPU load
75 * @return True, if succeeded
76 * @tparam T The data type of the frame to be used for the test
77 */
78 template <typename T>
79 static bool testMagnitude(const FrameType::DataType magnitudeDataType, RandomGenerator& randomGenerator, Worker& worker);
80
81 /**
82 * Tests the magnitude function.
83 * @param randomGenerator The random generator to be used
84 * @param worker The worker object to distribute the CPU load
85 * @return True, if succeeded
86 * @tparam T The data type of the frame to be used for the test
87 * @tparam TMagnitude The data type of the magnitude to be used for the test
88 */
89 template <typename T, typename TMagnitude>
90 static bool testMagnitude(RandomGenerator& randomGenerator, Worker& worker);
91
92 /**
93 * Verifies the value normalization.
94 * @param value The value to be normalized
95 * @tparam T The data type to be used
96 * @tparam tNormalizationDenominator The normalization factor, with range [1, infinity)
97 */
98 template <typename T, T tNormalizationDenominator>
99 static bool verifyValueNormalization(const T& value);
100
101 /**
102 * Verifies the value normalization for floats.
103 * @param value The value to be normalized
104 * @tparam T The data type to be used
105 * @tparam tNormalizationDenominator The normalization factor, with range [1, infinity)
106 */
107 template <typename T, T tNormalizationDenominator>
108 static bool verifyValueNormalizationFloat(const T& value);
109
110 /**
111 * Verifies the value normalization for integers.
112 * @param value The value to be normalized
113 * @tparam T The data type to be used
114 * @tparam tNormalizationDenominator The normalization factor, with range [1, infinity)
115 */
116 template <typename T, T tNormalizationDenominator>
117 static bool verifyValueNormalizationInteger(const T& value);
118
119 /**
120 * Verifies the rounded value normalization for integers.
121 * @param value The value to be normalized
122 * @tparam T The data type to be used
123 * @tparam tNormalizationDenominator The normalization factor, with range [1, infinity)
124 */
125 template <typename T, T tNormalizationDenominator>
126 static bool verifyValueNormalizationIntegerRounded(const T& value);
127
128 /**
129 * Verifies the not-rounded value normalization for integers.
130 * @param value The value to be normalized
131 * @tparam T The data type to be used
132 * @tparam tNormalizationDenominator The normalization factor, with range [1, infinity)
133 */
134 template <typename T, T tNormalizationDenominator>
135 static bool verifyValueNormalizationIntegerNotRounded(const T& value);
136};
137
138}
139
140}
141
142}
143
144#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:32
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 test(const double testDuration, Worker &worker, const TestSelector &selector=TestSelector())
Tests all frame filter functions.
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 test selector that parses test function strings and determines which tests sh...
Definition TestSelector.h:51
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