Ocean
Loading...
Searching...
No Matches
TestFrameConverterBGR24.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_CONVERTER_BGR_24_H
9#define META_OCEAN_TEST_TESTCV_TEST_FRAME_CONVERTER_BGR_24_H
10
13
14#include "ocean/base/Worker.h"
15
17
19
20namespace Ocean
21{
22
23namespace Test
24{
25
26namespace TestCV
27{
28
29/**
30 * This class implements a BGR frame converter test.
31 * @ingroup testcv
32 */
33class OCEAN_TEST_CV_EXPORT TestFrameConverterBGR24
34{
35 public:
36
37 /**
38 * Tests all BGR 24 bit frame conversion functions.
39 * @param width The width of the original frame in pixel, with range [1, infinity)
40 * @param height The height of the original frame in pixel, with range [1, infinity)
41 * @param testDuration Number of seconds for each test, with range (0, infinity)
42 * @param worker The worker object
43 * @param selector The test selector to control which tests to run
44 * @return True, if succeeded
45 */
46 static bool test(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker, const TestSelector& selector = TestSelector());
47
48 /**
49 * Tests the exact BGR24 to BGR24 conversion.
50 * @param width The width of the original frame in pixel, with range [1, infinity)
51 * @param height The height of the original frame in pixel, with range [1, infinity)
52 * @param flag The conversion flag that has been applied during conversion
53 * @param testDuration Number of seconds for each test, with range (0, infinity)
54 * @param worker The worker object
55 * @return True, if succeeded
56 */
57 static bool testBGR24ToBGR24(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
58
59 /**
60 * Tests the exact BGR24 to BGRA32 conversion.
61 * @param width The width of the original frame in pixel, with range [1, infinity)
62 * @param height The height of the original frame in pixel, with range [1, infinity)
63 * @param flag The conversion flag that has been applied during conversion
64 * @param testDuration Number of seconds for each test, with range (0, infinity)
65 * @param worker The worker object
66 * @return True, if succeeded
67 */
68 static bool testBGR24ToBGRA32(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
69
70 /**
71 * Tests the exact BGR24 to RGB24 conversion.
72 * @param width The width of the original frame in pixel, with range [1, infinity)
73 * @param height The height of the original frame in pixel, with range [1, infinity)
74 * @param flag The conversion flag that has been applied during conversion
75 * @param testDuration Number of seconds for each test, with range (0, infinity)
76 * @param worker The worker object
77 * @return True, if succeeded
78 */
79 static bool testBGR24ToRGB24(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
80
81 /**
82 * Tests the exact BGR24 to RGBA32 conversion.
83 * @param width The width of the original frame in pixel, with range [1, infinity)
84 * @param height The height of the original frame in pixel, with range [1, infinity)
85 * @param flag The conversion flag that has been applied during conversion
86 * @param testDuration Number of seconds for each test, with range (0, infinity)
87 * @param worker The worker object
88 * @return True, if succeeded
89 */
90 static bool testBGR24ToRGBA32(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
91
92 /**
93 * Tests the exact BGR24 to Y8 full range conversion.
94 * @param width The width of the original frame in pixel, with range [1, infinity)
95 * @param height The height of the original frame in pixel, with range [1, infinity)
96 * @param flag The conversion flag that has been applied during conversion
97 * @param testDuration Number of seconds for each test, with range (0, infinity)
98 * @param worker The worker object
99 * @return True, if succeeded
100 */
101 static bool testBGR24ToY8FullRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
102
103 /**
104 * Tests the exact BGR24 to YUV24 conversion.
105 * @param width The width of the original frame in pixel, with range [1, infinity)
106 * @param height The height of the original frame in pixel, with range [1, infinity)
107 * @param flag The conversion flag that has been applied during conversion
108 * @param testDuration Number of seconds for each test, with range (0, infinity)
109 * @param worker The worker object
110 * @return True, if succeeded
111 */
112 static bool testBGR24ToYUV24(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
113
114 /**
115 * Tests the full range BGR24 to limited range Y_U_V12 conversion with 7bit precision using BT.601
116 * @param width The width of the original frame in pixel, with range [1, infinity)
117 * @param height The height of the original frame in pixel, with range [1, infinity)
118 * @param flag The conversion flag that has been applied during conversion
119 * @param testDuration Number of seconds for each test, with range (0, infinity)
120 * @param worker The worker object to distribute the computation
121 * @return True, if succeeded
122 */
123 static bool testBGR24FullRangeToY_U_V12LimitedRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
124
125 /**
126 * Tests the full range BGR24 to limited range Y_U_V12 conversion with 7bit precision using BT.601
127 * @param width The width of the original frame in pixel, with range [1, infinity)
128 * @param height The height of the original frame in pixel, with range [1, infinity)
129 * @param flag The conversion flag that has been applied during conversion
130 * @param testDuration Number of seconds for each test, with range (0, infinity)
131 * @param worker The worker object to distribute the computation
132 * @return True, if succeeded
133 */
134 static bool testBGR24FullRangeToY_V_U12LimitedRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
135
136 /**
137 * Tests the full range BGR24 to full range Y_U_V12 conversion with 7bit precision using BT.601
138 * @param width The width of the original frame in pixel, with range [1, infinity)
139 * @param height The height of the original frame in pixel, with range [1, infinity)
140 * @param flag The conversion flag that has been applied during conversion
141 * @param testDuration Number of seconds for each test, with range (0, infinity)
142 * @param worker The worker object to distribute the computation
143 * @return True, if succeeded
144 */
145 static bool testBGR24FullRangeToY_U_V12FullRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
146
147 /**
148 * Tests the full range BGR24 to full range Y_U_V12 conversion with 7bit precision using BT.601
149 * @param width The width of the original frame in pixel, with range [1, infinity)
150 * @param height The height of the original frame in pixel, with range [1, infinity)
151 * @param flag The conversion flag that has been applied during conversion
152 * @param testDuration Number of seconds for each test, with range (0, infinity)
153 * @param worker The worker object to distribute the computation
154 * @return True, if succeeded
155 */
156 static bool testBGR24FullRangeToY_V_U12FullRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
157
158 protected:
159
160 /**
161 * Extracts one pixel from a BGR24 source frame intended for a Y_UV12 frame (or a Y_VU12 frame).
162 * @param frame The frame from which the pixel will be extracted, must be valid
163 * @param x The horizontal pixel location within the frame, with range [0, frame.width() - 1]
164 * @param y The vertical pixel location within the frame, with range [0, frame.height() - 1]
165 * @param conversionFlag The conversion flag that will be applied, must be valid
166 * @return The vector holding the frame's color value at the specified location
167 */
168 static MatrixD pixelFunctionBGRForY_UV12(const Frame& frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag);
169
170 /**
171 * Extracts one pixel from a Y_U_V12 target frame (or a Y_V_U12 source frame).
172 * @param frame The frame from which the pixel will be extracted, must be valid
173 * @param x The horizontal pixel location within the frame, with range [0, frame.width() - 1]
174 * @param y The vertical pixel location within the frame, with range [0, frame.height() - 1]
175 * @param conversionFlag The conversion flag that will be applied, must be valid
176 * @return The vector holding the frame's color value at the specified location
177 */
178 static MatrixD pixelFunctionY_U_V12ForYUV24(const Frame& frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag);
179};
180
181}
182
183}
184
185}
186
187#endif // META_OCEAN_TEST_TESTCV_TEST_FRAME_CONVERTER_BGR_24_H
ConversionFlag
Definition of individual conversion flags.
Definition FrameConverter.h:39
This class implements Ocean's image class.
Definition Frame.h:1879
This class implements a matrix with arbitrary size.
Definition Matrix.h:63
This class implements a BGR frame converter test.
Definition TestFrameConverterBGR24.h:34
static bool testBGR24FullRangeToY_V_U12FullRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the full range BGR24 to full range Y_U_V12 conversion with 7bit precision using BT....
static bool testBGR24ToY8FullRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the exact BGR24 to Y8 full range conversion.
static bool testBGR24FullRangeToY_U_V12FullRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the full range BGR24 to full range Y_U_V12 conversion with 7bit precision using BT....
static bool test(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker, const TestSelector &selector=TestSelector())
Tests all BGR 24 bit frame conversion functions.
static bool testBGR24ToBGR24(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the exact BGR24 to BGR24 conversion.
static MatrixD pixelFunctionY_U_V12ForYUV24(const Frame &frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag)
Extracts one pixel from a Y_U_V12 target frame (or a Y_V_U12 source frame).
static bool testBGR24ToRGBA32(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the exact BGR24 to RGBA32 conversion.
static MatrixD pixelFunctionBGRForY_UV12(const Frame &frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag)
Extracts one pixel from a BGR24 source frame intended for a Y_UV12 frame (or a Y_VU12 frame).
static bool testBGR24ToBGRA32(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the exact BGR24 to BGRA32 conversion.
static bool testBGR24ToYUV24(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the exact BGR24 to YUV24 conversion.
static bool testBGR24FullRangeToY_U_V12LimitedRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the full range BGR24 to limited range Y_U_V12 conversion with 7bit precision using BT....
static bool testBGR24FullRangeToY_V_U12LimitedRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the full range BGR24 to limited range Y_U_V12 conversion with 7bit precision using BT....
static bool testBGR24ToRGB24(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the exact BGR24 to RGB24 conversion.
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