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