Ocean
Loading...
Searching...
No Matches
TestNEON.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_NEON_H
9#define META_OCEAN_TEST_TESTCV_TEST_NEON_H
10
12
14
16
17#if defined(OCEAN_HARDWARE_NEON_VERSION) && OCEAN_HARDWARE_NEON_VERSION >= 10
18
19namespace Ocean
20{
21
22namespace Test
23{
24
25namespace TestCV
26{
27
28/**
29 * This class implements a Computer Vision NEON test.
30 * @ingroup testcv
31 */
32class OCEAN_TEST_CV_EXPORT TestNEON
33{
34 protected:
35
36 /**
37 * Definition of a pointer to a function allowing to averaging 2x2 pixel blocks.
38 * @param source0 The upper source row, must be valid
39 * @param source1 The lower source row, must be valid
40 * @param target The resulting averaged elements, must be valid
41 */
42 using AveragingFunction = void (*)(const unsigned char* const source0, const unsigned char* const source1, unsigned char* const target);
43
44 public:
45
46 /**
47 * Invokes all tests of the NEON class.
48 * @param testDuration Number of seconds for each test, with range (0, infinity)
49 * @param selector The test selector to control which tests to run
50 * @return True, if succeeded
51 */
52 static bool test(const double testDuration, const TestSelector& selector = TestSelector());
53
54 /**
55 * Tests the NEON-based calculation of 3x3 block sums of 16 bit values.
56 * @param testDuration Number of seconds for each test, with range (0, infinity)
57 * @return True, if all result are valid
58 */
59 static bool testSum16Bit4Blocks3x3(const double testDuration);
60
61 /**
62 * Tests the NEON-based averaging of 2x2 pixel blocks.
63 * @param testDuration Number of seconds for each test, with range (0, infinity)
64 * @return True, if all result are valid
65 */
66 static bool testAveragingPixels2x2(const double testDuration);
67
68 /**
69 * Tests the NEON-based multiply functions.
70 * @param testDuration Number of seconds for each test, with range (0, infinity)
71 * @return True, if all result are valid
72 */
73 static bool testMultiply(const double testDuration);
74
75 /**
76 * Tests the NEON-based copySign functions.
77 * @param testDuration Number of seconds for each test, with range (0, infinity)
78 * @return True, if all result are valid
79 */
80 static bool testCopySign(const double testDuration);
81
82 /**
83 * Tests the NEON-based cast functions.
84 * @param testDuration Number of seconds for each test, with range (0, infinity)
85 * @return True, if all result are valid
86 */
87 static bool testCastElements(const double testDuration);
88
89 /**
90 * Tests the NEON-based sum function for four uint32_t values.
91 * @param testDuration Number of seconds for each test, with range (0, infinity)
92 * @return True, if all result are valid
93 */
94 static bool testSumHorizontal_u_32x4(const double testDuration);
95
96 protected:
97
98 /*
99 * Validates the NEON-based averaging of 2x2 pixel blocks.
100 * @param averagingFunction The actual averaging function to be tested, must be valid
101 * @param randomGenerator The random generator object to be used
102 * @return True, if succeeded
103 * @tparam tChannels The number of channels to test, with range [1, infinity)
104 * @tparam tSourcePixels The number of source pixels to test, with range [2, infinity), must be even
105 */
106 template <unsigned int tChannels, unsigned int tSourcePixels>
107 static bool validateAveragePixels2x2(const AveragingFunction averagingFunction, RandomGenerator& randomGenerator);
108};
109
110}
111
112}
113
114}
115
116#endif // OCEAN_HARDWARE_NEON_VERSION >= 10
117
118#endif // META_OCEAN_TEST_TESTCV_TEST_NEON_H
This class implements a generator for random numbers.
Definition RandomGenerator.h:42
This class implements a Computer Vision NEON test.
Definition TestNEON.h:33
static bool validateAveragePixels2x2(const AveragingFunction averagingFunction, RandomGenerator &randomGenerator)
static bool testCastElements(const double testDuration)
Tests the NEON-based cast functions.
static bool test(const double testDuration, const TestSelector &selector=TestSelector())
Invokes all tests of the NEON class.
static bool testCopySign(const double testDuration)
Tests the NEON-based copySign functions.
static bool testSumHorizontal_u_32x4(const double testDuration)
Tests the NEON-based sum function for four uint32_t values.
void(*)(const unsigned char *const source0, const unsigned char *const source1, unsigned char *const target) AveragingFunction
Definition of a pointer to a function allowing to averaging 2x2 pixel blocks.
Definition TestNEON.h:42
static bool testMultiply(const double testDuration)
Tests the NEON-based multiply functions.
static bool testSum16Bit4Blocks3x3(const double testDuration)
Tests the NEON-based calculation of 3x3 block sums of 16 bit values.
static bool testAveragingPixels2x2(const double testDuration)
Tests the NEON-based averaging of 2x2 pixel blocks.
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