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