Ocean
Loading...
Searching...
No Matches
TestZeroMeanSumSquareDifferences.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_ZERO_MEAN_SUM_SQUARE_DIFFERENCES_H
9#define META_OCEAN_TEST_TESTCV_ZERO_MEAN_SUM_SQUARE_DIFFERENCES_H
10
12
14
16
17namespace Ocean
18{
19
20namespace Test
21{
22
23namespace TestCV
24{
25
26/**
27 * This class implements zero-mean sum square differences (ZMSSD) tests.
28 * @ingroup testcv
29 */
30class OCEAN_TEST_CV_EXPORT TestZeroMeanSumSquareDifferences
31{
32 protected:
33
34 /**
35 * Definition of individual types of implementation.
36 */
37 enum ImplementationType : uint32_t
38 {
39 /// The naive implementation.
41 /// The template-based implementation.
43 /// The SSE-based implementation.
45 /// The NEON-based implementation.
47 /// The default implementation (which is actually used by default).
48 IT_DEFAULT
49 };
50
51 public:
52
53 /**
54 * Tests the entire zero-mean sum square differences functions.
55 * @param testDuration Number of seconds for each test, with range (0, infinity)
56 * @param selector Test selector for filtering sub-tests; default runs all tests
57 * @return True, if succeeded
58 */
59 static bool test(const double testDuration, const TestSelector& selector = TestSelector());
60
61 /**
62 * Tests the zero-mean sum square differences function for two image patches.
63 * @param testDuration Number of seconds for each test, with range (0, infinity)
64 * @return True, if succeeded
65 */
66 static bool testPatch8BitPerChannel(const double testDuration);
67
68 /**
69 * Tests the zero-mean sum square differences function for two buffers.
70 * @param testDuration Number of seconds for each test, with range (0, infinity)
71 * @return True, if succeeded
72 */
73 static bool testBuffer8BitPerChannel(const double testDuration);
74
75 /**
76 * Tests the zero-mean sum square differences function between an image patch and a buffer.
77 * @param testDuration Number of seconds for each test, with range (0, infinity)
78 * @return True, if succeeded
79 */
80 static bool testPatchBuffer8BitPerChannel(const double testDuration);
81
82 /**
83 * Tests the zero-mean sum square differences function for two image patches which are mirrored at the image border.
84 * @param testDuration Number of seconds for each test, with range (0, infinity)
85 * @return True, if succeeded
86 */
87 static bool testPatchMirroredBorder8BitPerChannel(const double testDuration);
88
89 private:
90
91 /**
92 * Tests the zero mean sum square differences function for two image patches.
93 * @param width The width of the test image, in pixel, with range [tSize, infinity)
94 * @param height The height of the test image, in pixel, with range [tSize, infinity)
95 * @param testDuration Number of seconds for each test, with range (0, infinity)
96 * @return True, if succeeded
97 * @tparam tChannels The number of frame channels, with range [1, infinity)
98 * @tparam tSize The size of the patch, with range [1, infinity)
99 */
100 template <unsigned int tChannels, unsigned int tSize>
101 static bool testPatch8BitPerChannel(const unsigned int width, const unsigned int height, const double testDuration);
102
103 /**
104 * Tests the zero-mean sum square differences function for two buffers.
105 * @param width The width of the test image, in pixel, with range [tSize, infinity)
106 * @param height The height of the test image, in pixel, with range [tSize, infinity)
107 * @param testDuration Number of seconds for each test, with range (0, infinity)
108 * @return True, if succeeded
109 * @tparam tChannels The number of frame channels, with range [1, infinity)
110 * @tparam tPixels The number of pixels in the buffer, with range [1, infinity)
111 */
112 template <unsigned int tChannels, unsigned int tPixels>
113 static bool testBuffer8BitPerChannel(const unsigned int width, const unsigned int height, const double testDuration);
114
115 /**
116 * Tests the zero-mean sum square differences function between an image patch and a buffer.
117 * @param width The width of the test image, in pixel, with range [tSize, infinity)
118 * @param height The height of the test image, in pixel, with range [tSize, infinity)
119 * @param testDuration Number of seconds for each test, with range (0, infinity)
120 * @return True, if succeeded
121 * @tparam tChannels The number of frame channels, with range [1, infinity)
122 * @tparam tSize The size of the patch, with range [1, infinity)
123 */
124 template <unsigned int tChannels, unsigned int tSize>
125 static bool testPatchBuffer8BitPerChannel(const unsigned int width, const unsigned int height, const double testDuration);
126
127 /**
128 * Tests the zero-mean sum square differences function for two image patches which are mirrored at the image border.
129 * @param width The width of the test image, in pixel, with range [tSize, infinity)
130 * @param height The height of the test image, in pixel, with range [tSize, infinity)
131 * @param testDuration Number of seconds for each test, with range (0, infinity)
132 * @return True, if succeeded
133 * @tparam tChannels The number of frame channels, with range [1, infinity)
134 * @tparam tSize The size of the patch, with range [1, infinity)
135 */
136 template <unsigned int tChannels, unsigned int tSize>
137 static bool testPatchMirroredBorder8BitPerChannel(const unsigned int width, const unsigned int height, const double testDuration);
138};
139
140}
141
142}
143
144}
145
146#endif // META_OCEAN_TEST_TESTCV_ZERO_MEAN_SUM_SQUARE_DIFFERENCES_H
This class implements zero-mean sum square differences (ZMSSD) tests.
Definition TestZeroMeanSumSquareDifferences.h:31
static bool testPatchBuffer8BitPerChannel(const unsigned int width, const unsigned int height, const double testDuration)
Tests the zero-mean sum square differences function between an image patch and a buffer.
static bool testBuffer8BitPerChannel(const unsigned int width, const unsigned int height, const double testDuration)
Tests the zero-mean sum square differences function for two buffers.
static bool testBuffer8BitPerChannel(const double testDuration)
Tests the zero-mean sum square differences function for two buffers.
static bool testPatchBuffer8BitPerChannel(const double testDuration)
Tests the zero-mean sum square differences function between an image patch and a buffer.
static bool testPatchMirroredBorder8BitPerChannel(const double testDuration)
Tests the zero-mean sum square differences function for two image patches which are mirrored at the i...
ImplementationType
Definition of individual types of implementation.
Definition TestZeroMeanSumSquareDifferences.h:38
@ IT_SSE
The SSE-based implementation.
Definition TestZeroMeanSumSquareDifferences.h:44
@ IT_NEON
The NEON-based implementation.
Definition TestZeroMeanSumSquareDifferences.h:46
@ IT_TEMPLATE
The template-based implementation.
Definition TestZeroMeanSumSquareDifferences.h:42
@ IT_NAIVE
The naive implementation.
Definition TestZeroMeanSumSquareDifferences.h:40
static bool testPatch8BitPerChannel(const unsigned int width, const unsigned int height, const double testDuration)
Tests the zero mean sum square differences function for two image patches.
static bool testPatchMirroredBorder8BitPerChannel(const unsigned int width, const unsigned int height, const double testDuration)
Tests the zero-mean sum square differences function for two image patches which are mirrored at the i...
static bool test(const double testDuration, const TestSelector &selector=TestSelector())
Tests the entire zero-mean sum square differences functions.
static bool testPatch8BitPerChannel(const double testDuration)
Tests the zero-mean sum square differences function for two image patches.
This class implements a test selector that parses test function strings and determines which tests sh...
Definition TestSelector.h:51
The namespace covering the entire Ocean framework.
Definition Accessor.h:15