Ocean
Loading...
Searching...
No Matches
TestFrameConverterRGB24.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_RGB_24_H
9#define META_OCEAN_TEST_TESTCV_TEST_FRAME_CONVERTER_RGB_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 RGB frame converter test.
31 * @ingroup testcv
32 */
33class OCEAN_TEST_CV_EXPORT TestFrameConverterRGB24
34{
35 public:
36
37 /**
38 * Tests all RGB 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 to distribute the computation
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 RGB24 to ARGB32 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 to distribute the computation
55 * @return True, if succeeded
56 */
57 static bool testRGB24ToARGB32(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
58
59 /**
60 * Tests the exact RGB24 to BGR24 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 to distribute the computation
66 * @return True, if succeeded
67 */
68 static bool testRGB24ToBGR24(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
69
70 /**
71 * Tests the exact RGB24 to BGR32 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 to distribute the computation
77 * @return True, if succeeded
78 */
79 static bool testRGB24ToBGR32(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
80
81 /**
82 * Tests the exact RGB24 to BGRA32 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 to distribute the computation
88 * @return True, if succeeded
89 */
90 static bool testRGB24ToBGRA32(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
91
92 /**
93 * Tests the exact RGB24 to RGB24 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 to distribute the computation
99 * @return True, if succeeded
100 */
101 static bool testRGB24ToRGB24(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
102
103 /**
104 * Tests the exact RGB24 to RGB32 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 to distribute the computation
110 * @return True, if succeeded
111 */
112 static bool testRGB24ToRGB32(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
113
114 /**
115 * Tests the exact RGB24 to RGBA32 conversion.
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 testRGB24ToRGBA32(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
124
125 /**
126 * Tests the exact RGB24 to Y8 conversion.
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 testRGB24ToY8FullRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
135
136 /**
137 * Tests the exact RGB24 to YUV24 conversion.
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 testRGB24ToYUV24(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 RGB24 to limited range Y_UV12 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 testRGB24FullRangeToY_UV12LimitedRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
157
158 /**
159 * Tests the full range RGB24 to limited range Y_VU12 conversion with 7bit precision using BT.601
160 * @param width The width of the original frame in pixel, with range [1, infinity)
161 * @param height The height of the original frame in pixel, with range [1, infinity)
162 * @param flag The conversion flag that has been applied during conversion
163 * @param testDuration Number of seconds for each test, with range (0, infinity)
164 * @param worker The worker object to distribute the computation
165 * @return True, if succeeded
166 */
167 static bool testRGB24FullRangeToY_VU12LimitedRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
168
169 /**
170 * Tests the full range RGB24 to full range Y_UV12 conversion with 7bit precision using BT.601
171 * @param width The width of the original frame in pixel, with range [1, infinity)
172 * @param height The height of the original frame in pixel, with range [1, infinity)
173 * @param flag The conversion flag that has been applied during conversion
174 * @param testDuration Number of seconds for each test, with range (0, infinity)
175 * @param worker The worker object to distribute the computation
176 * @return True, if succeeded
177 */
178 static bool testRGB24FullRangeToY_UV12FullRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
179
180 /**
181 * Tests the full range RGB24 to full range Y_VU12 conversion with 7bit precision using BT.601
182 * @param width The width of the original frame in pixel, with range [1, infinity)
183 * @param height The height of the original frame in pixel, with range [1, infinity)
184 * @param flag The conversion flag that has been applied during conversion
185 * @param testDuration Number of seconds for each test, with range (0, infinity)
186 * @param worker The worker object to distribute the computation
187 * @return True, if succeeded
188 */
189 static bool testRGB24FullRangeToY_VU12FullRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
190
191 /**
192 * Tests the full range RGB24 to limited range Y_U_V12 conversion with 7bit precision using BT.601
193 * @param width The width of the original frame in pixel, with range [1, infinity)
194 * @param height The height of the original frame in pixel, with range [1, infinity)
195 * @param flag The conversion flag that has been applied during conversion
196 * @param testDuration Number of seconds for each test, with range (0, infinity)
197 * @param worker The worker object to distribute the computation
198 * @return True, if succeeded
199 */
200 static bool testRGB24FullRangeToY_U_V12LimitedRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
201
202 /**
203 * Tests the full range RGB24 to limited range Y_V_U12 conversion with 7bit precision using BT.601
204 * @param width The width of the original frame in pixel, with range [1, infinity)
205 * @param height The height of the original frame in pixel, with range [1, infinity)
206 * @param flag The conversion flag that has been applied during conversion
207 * @param testDuration Number of seconds for each test, with range (0, infinity)
208 * @param worker The worker object to distribute the computation
209 * @return True, if succeeded
210 */
211 static bool testRGB24FullRangeToY_V_U12LimitedRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
212
213 /**
214 * Tests the full range RGB24 to full range Y_U_V12 conversion with 7bit precision using BT.601
215 * @param width The width of the original frame in pixel, with range [1, infinity)
216 * @param height The height of the original frame in pixel, with range [1, infinity)
217 * @param flag The conversion flag that has been applied during conversion
218 * @param testDuration Number of seconds for each test, with range (0, infinity)
219 * @param worker The worker object to distribute the computation
220 * @return True, if succeeded
221 */
222 static bool testRGB24FullRangeToY_U_V12FullRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
223
224 /**
225 * Tests the full range RGB24 to full range Y_V_U12 conversion with 7bit precision using BT.601
226 * @param width The width of the original frame in pixel, with range [1, infinity)
227 * @param height The height of the original frame in pixel, with range [1, infinity)
228 * @param flag The conversion flag that has been applied during conversion
229 * @param testDuration Number of seconds for each test, with range (0, infinity)
230 * @param worker The worker object to distribute the computation
231 * @return True, if succeeded
232 */
233 static bool testRGB24FullRangeToY_V_U12FullRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
234
235 /**
236 * Tests the RGB24 to R_G_B24 conversion.
237 * @param width The width of the original frame in pixel, with range [1, infinity)
238 * @param height The height of the original frame in pixel, with range [1, infinity)
239 * @param conversionFlag The conversion flag that has been applied during conversion
240 * @param testDuration Number of seconds for each test, with range (0, infinity)
241 * @param worker The worker object
242 * @return True, if succeeded
243 */
244 static bool testRGB24ToR_G_B24(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag conversionFlag, const double testDuration, Worker& worker);
245
246 protected:
247
248 /**
249 * Extracts one pixel from a RGB24 source frame intended for a Y_UV12 frame (or a Y_VU12 frame).
250 * @param frame The frame from which the pixel will be extracted, must be valid
251 * @param x The horizontal pixel location within the frame, with range [0, frame.width() - 1]
252 * @param y The vertical pixel location within the frame, with range [0, frame.height() - 1]
253 * @param conversionFlag The conversion flag that will be applied, must be valid
254 * @return The vector holding the frame's color value at the specified location
255 */
256 static MatrixD pixelFunctionRGBForY_UV12(const Frame& frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag);
257
258 /**
259 * Extracts one pixel from a Y_UV12 target frame (or a Y_VU12 source frame).
260 * @param frame The frame from which the pixel will be extracted, must be valid
261 * @param x The horizontal pixel location within the frame, with range [0, frame.width() - 1]
262 * @param y The vertical pixel location within the frame, with range [0, frame.height() - 1]
263 * @param conversionFlag The conversion flag that will be applied, must be valid
264 * @return The vector holding the frame's color value at the specified location
265 */
266 static MatrixD pixelFunctionY_UV12ForYUV24(const Frame& frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag);
267
268 /**
269 * Extracts one pixel from a Y_U_V12 target frame (or a Y_V_U12 source frame).
270 * @param frame The frame from which the pixel will be extracted, must be valid
271 * @param x The horizontal pixel location within the frame, with range [0, frame.width() - 1]
272 * @param y The vertical pixel location within the frame, with range [0, frame.height() - 1]
273 * @param conversionFlag The conversion flag that will be applied, must be valid
274 * @return The vector holding the frame's color value at the specified location
275 */
276 static MatrixD pixelFunctionY_U_V12ForYUV24(const Frame& frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag);
277
278 /**
279 * Extracts one pixel from a R_G_B24 source frame.
280 * @param frame The frame from which the pixel will be extracted, must be valid
281 * @param x The horizontal pixel location within the frame, with range [0, frame.width() - 1]
282 * @param y The vertical pixel location within the frame, with range [0, frame.height() - 1]
283 * @param conversionFlag The conversion flag that will be applied, must be valid
284 * @return The vector holding the frame's color value at the specified location
285 */
286 static MatrixD pixelFunctionR_G_B24(const Frame& frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag);
287
288};
289
290}
291
292}
293
294}
295
296#endif // META_OCEAN_TEST_TESTCV_TEST_FRAME_CONVERTER_RGB_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 RGB frame converter test.
Definition TestFrameConverterRGB24.h:34
static bool testRGB24FullRangeToY_V_U12LimitedRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the full range RGB24 to limited range Y_V_U12 conversion with 7bit precision using BT....
static bool testRGB24ToBGRA32(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the exact RGB24 to BGRA32 conversion.
static bool testRGB24FullRangeToY_UV12FullRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the full range RGB24 to full range Y_UV12 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 RGB 24 bit frame conversion functions.
static MatrixD pixelFunctionRGBForY_UV12(const Frame &frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag)
Extracts one pixel from a RGB24 source frame intended for a Y_UV12 frame (or a Y_VU12 frame).
static MatrixD pixelFunctionY_UV12ForYUV24(const Frame &frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag)
Extracts one pixel from a Y_UV12 target frame (or a Y_VU12 source frame).
static bool testRGB24FullRangeToY_V_U12FullRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the full range RGB24 to full range Y_V_U12 conversion with 7bit precision using BT....
static bool testRGB24FullRangeToY_U_V12FullRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the full range RGB24 to full range Y_U_V12 conversion with 7bit precision using BT....
static bool testRGB24FullRangeToY_VU12LimitedRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the full range RGB24 to limited range Y_VU12 conversion with 7bit precision using BT....
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 testRGB24ToY8FullRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the exact RGB24 to Y8 conversion.
static MatrixD pixelFunctionR_G_B24(const Frame &frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag)
Extracts one pixel from a R_G_B24 source frame.
static bool testRGB24ToBGR24(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the exact RGB24 to BGR24 conversion.
static bool testRGB24ToYUV24(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the exact RGB24 to YUV24 conversion.
static bool testRGB24ToRGB24(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the exact RGB24 to RGB24 conversion.
static bool testRGB24ToRGBA32(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the exact RGB24 to RGBA32 conversion.
static bool testRGB24ToRGB32(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the exact RGB24 to RGB32 conversion.
static bool testRGB24FullRangeToY_UV12LimitedRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the full range RGB24 to limited range Y_UV12 conversion with 7bit precision using BT....
static bool testRGB24FullRangeToY_U_V12LimitedRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the full range RGB24 to limited range Y_U_V12 conversion with 7bit precision using BT....
static bool testRGB24ToBGR32(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the exact RGB24 to BGR32 conversion.
static bool testRGB24ToR_G_B24(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag conversionFlag, const double testDuration, Worker &worker)
Tests the RGB24 to R_G_B24 conversion.
static bool testRGB24ToARGB32(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests RGB24 to ARGB32 conversion.
static bool testRGB24FullRangeToY_VU12FullRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the full range RGB24 to full range Y_VU12 conversion with 7bit precision using BT....
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