Ocean
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 
18 namespace Ocean
19 {
20 
21 namespace Test
22 {
23 
24 namespace TestCV
25 {
26 
27 /**
28  * This class implements a RGB frame converter test.
29  * @ingroup testcv
30  */
31 class OCEAN_TEST_CV_EXPORT TestFrameConverterRGB24
32 {
33  public:
34 
35  /**
36  * Tests all RGB 24 bit frame conversion functions.
37  * @param width The width of the original frame in pixel, with range [1, infinity)
38  * @param height The height of the original frame in pixel, with range [1, infinity)
39  * @param testDuration Number of seconds for each test, with range (0, infinity)
40  * @param worker The worker object to distribute the computation
41  * @return True, if succeeded
42  */
43  static bool test(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker);
44 
45  /**
46  * Tests RGB24 to ARGB32 conversion.
47  * @param width The width of the original frame in pixel, with range [1, infinity)
48  * @param height The height of the original frame in pixel, with range [1, infinity)
49  * @param flag The conversion flag that has been applied during conversion
50  * @param testDuration Number of seconds for each test, with range (0, infinity)
51  * @param worker The worker object to distribute the computation
52  * @return True, if succeeded
53  */
54  static bool testRGB24ToARGB32(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
55 
56  /**
57  * Tests the exact RGB24 to BGR24 conversion.
58  * @param width The width of the original frame in pixel, with range [1, infinity)
59  * @param height The height of the original frame in pixel, with range [1, infinity)
60  * @param flag The conversion flag that has been applied during conversion
61  * @param testDuration Number of seconds for each test, with range (0, infinity)
62  * @param worker The worker object to distribute the computation
63  * @return True, if succeeded
64  */
65  static bool testRGB24ToBGR24(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
66 
67  /**
68  * Tests the exact RGB24 to BGR32 conversion.
69  * @param width The width of the original frame in pixel, with range [1, infinity)
70  * @param height The height of the original frame in pixel, with range [1, infinity)
71  * @param flag The conversion flag that has been applied during conversion
72  * @param testDuration Number of seconds for each test, with range (0, infinity)
73  * @param worker The worker object to distribute the computation
74  * @return True, if succeeded
75  */
76  static bool testRGB24ToBGR32(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
77 
78  /**
79  * Tests the exact RGB24 to BGRA32 conversion.
80  * @param width The width of the original frame in pixel, with range [1, infinity)
81  * @param height The height of the original frame in pixel, with range [1, infinity)
82  * @param flag The conversion flag that has been applied during conversion
83  * @param testDuration Number of seconds for each test, with range (0, infinity)
84  * @param worker The worker object to distribute the computation
85  * @return True, if succeeded
86  */
87  static bool testRGB24ToBGRA32(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
88 
89  /**
90  * Tests the exact RGB24 to RGB24 conversion.
91  * @param width The width of the original frame in pixel, with range [1, infinity)
92  * @param height The height of the original frame in pixel, with range [1, infinity)
93  * @param flag The conversion flag that has been applied during conversion
94  * @param testDuration Number of seconds for each test, with range (0, infinity)
95  * @param worker The worker object to distribute the computation
96  * @return True, if succeeded
97  */
98  static bool testRGB24ToRGB24(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
99 
100  /**
101  * Tests the exact RGB24 to RGB32 conversion.
102  * @param width The width of the original frame in pixel, with range [1, infinity)
103  * @param height The height of the original frame in pixel, with range [1, infinity)
104  * @param flag The conversion flag that has been applied during conversion
105  * @param testDuration Number of seconds for each test, with range (0, infinity)
106  * @param worker The worker object to distribute the computation
107  * @return True, if succeeded
108  */
109  static bool testRGB24ToRGB32(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
110 
111  /**
112  * Tests the exact RGB24 to RGBA32 conversion.
113  * @param width The width of the original frame in pixel, with range [1, infinity)
114  * @param height The height of the original frame in pixel, with range [1, infinity)
115  * @param flag The conversion flag that has been applied during conversion
116  * @param testDuration Number of seconds for each test, with range (0, infinity)
117  * @param worker The worker object to distribute the computation
118  * @return True, if succeeded
119  */
120  static bool testRGB24ToRGBA32(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
121 
122  /**
123  * Tests the exact RGB24 to Y8 conversion.
124  * @param width The width of the original frame in pixel, with range [1, infinity)
125  * @param height The height of the original frame in pixel, with range [1, infinity)
126  * @param flag The conversion flag that has been applied during conversion
127  * @param testDuration Number of seconds for each test, with range (0, infinity)
128  * @param worker The worker object to distribute the computation
129  * @return True, if succeeded
130  */
131  static bool testRGB24ToY8(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
132 
133  /**
134  * Tests the exact RGB24 to YUV24 conversion.
135  * @param width The width of the original frame in pixel, with range [1, infinity)
136  * @param height The height of the original frame in pixel, with range [1, infinity)
137  * @param flag The conversion flag that has been applied during conversion
138  * @param testDuration Number of seconds for each test, with range (0, infinity)
139  * @param worker The worker object to distribute the computation
140  * @return True, if succeeded
141  */
142  static bool testRGB24ToYUV24(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
143 
144  /**
145  * Tests the full range RGB24 to limited range Y_UV12 conversion with 7bit precision using BT.601
146  * @param width The width of the original frame in pixel, with range [1, infinity)
147  * @param height The height of the original frame in pixel, with range [1, infinity)
148  * @param flag The conversion flag that has been applied during conversion
149  * @param testDuration Number of seconds for each test, with range (0, infinity)
150  * @param worker The worker object to distribute the computation
151  * @return True, if succeeded
152  */
153  static bool testRGB24FullRangeToY_UV12LimitedRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
154 
155  /**
156  * Tests the full range RGB24 to limited range Y_VU12 conversion with 7bit precision using BT.601
157  * @param width The width of the original frame in pixel, with range [1, infinity)
158  * @param height The height of the original frame in pixel, with range [1, infinity)
159  * @param flag The conversion flag that has been applied during conversion
160  * @param testDuration Number of seconds for each test, with range (0, infinity)
161  * @param worker The worker object to distribute the computation
162  * @return True, if succeeded
163  */
164  static bool testRGB24FullRangeToY_VU12LimitedRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
165 
166  /**
167  * Tests the full range RGB24 to full range Y_UV12 conversion with 7bit precision using BT.601
168  * @param width The width of the original frame in pixel, with range [1, infinity)
169  * @param height The height of the original frame in pixel, with range [1, infinity)
170  * @param flag The conversion flag that has been applied during conversion
171  * @param testDuration Number of seconds for each test, with range (0, infinity)
172  * @param worker The worker object to distribute the computation
173  * @return True, if succeeded
174  */
175  static bool testRGB24FullRangeToY_UV12FullRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
176 
177  /**
178  * Tests the full range RGB24 to full range Y_VU12 conversion with 7bit precision using BT.601
179  * @param width The width of the original frame in pixel, with range [1, infinity)
180  * @param height The height of the original frame in pixel, with range [1, infinity)
181  * @param flag The conversion flag that has been applied during conversion
182  * @param testDuration Number of seconds for each test, with range (0, infinity)
183  * @param worker The worker object to distribute the computation
184  * @return True, if succeeded
185  */
186  static bool testRGB24FullRangeToY_VU12FullRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
187 
188  /**
189  * Tests the full range RGB24 to limited range Y_U_V12 conversion with 7bit precision using BT.601
190  * @param width The width of the original frame in pixel, with range [1, infinity)
191  * @param height The height of the original frame in pixel, with range [1, infinity)
192  * @param flag The conversion flag that has been applied during conversion
193  * @param testDuration Number of seconds for each test, with range (0, infinity)
194  * @param worker The worker object to distribute the computation
195  * @return True, if succeeded
196  */
197  static bool testRGB24FullRangeToY_U_V12LimitedRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
198 
199  /**
200  * Tests the full range RGB24 to limited range Y_V_U12 conversion with 7bit precision using BT.601
201  * @param width The width of the original frame in pixel, with range [1, infinity)
202  * @param height The height of the original frame in pixel, with range [1, infinity)
203  * @param flag The conversion flag that has been applied during conversion
204  * @param testDuration Number of seconds for each test, with range (0, infinity)
205  * @param worker The worker object to distribute the computation
206  * @return True, if succeeded
207  */
208  static bool testRGB24FullRangeToY_V_U12LimitedRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
209 
210  /**
211  * Tests the full range RGB24 to full range Y_U_V12 conversion with 7bit precision using BT.601
212  * @param width The width of the original frame in pixel, with range [1, infinity)
213  * @param height The height of the original frame in pixel, with range [1, infinity)
214  * @param flag The conversion flag that has been applied during conversion
215  * @param testDuration Number of seconds for each test, with range (0, infinity)
216  * @param worker The worker object to distribute the computation
217  * @return True, if succeeded
218  */
219  static bool testRGB24FullRangeToY_U_V12FullRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
220 
221  /**
222  * Tests the full range RGB24 to full range Y_V_U12 conversion with 7bit precision using BT.601
223  * @param width The width of the original frame in pixel, with range [1, infinity)
224  * @param height The height of the original frame in pixel, with range [1, infinity)
225  * @param flag The conversion flag that has been applied during conversion
226  * @param testDuration Number of seconds for each test, with range (0, infinity)
227  * @param worker The worker object to distribute the computation
228  * @return True, if succeeded
229  */
230  static bool testRGB24FullRangeToY_V_U12FullRange(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
231 
232  protected:
233 
234  /**
235  * Extracts one pixel from a RGB24 source frame intended for a Y_UV12 frame (or a Y_VU12 frame).
236  * @param frame The frame from which the pixel will be extracted, must be valid
237  * @param x The horizontal pixel location within the frame, with range [0, frame.width() - 1]
238  * @param y The vertical pixel location within the frame, with range [0, frame.height() - 1]
239  * @param conversionFlag The conversion flag that will be applied, must be valid
240  * @return The vector holding the frame's color value at the specified location
241  */
242  static MatrixD pixelFunctionRGBForY_UV12(const Frame& frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag);
243 
244  /**
245  * Extracts one pixel from a Y_UV12 target frame (or a Y_VU12 source frame).
246  * @param frame The frame from which the pixel will be extracted, must be valid
247  * @param x The horizontal pixel location within the frame, with range [0, frame.width() - 1]
248  * @param y The vertical pixel location within the frame, with range [0, frame.height() - 1]
249  * @param conversionFlag The conversion flag that will be applied, must be valid
250  * @return The vector holding the frame's color value at the specified location
251  */
252  static MatrixD pixelFunctionY_UV12ForYUV24(const Frame& frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag);
253 
254  /**
255  * Extracts one pixel from a Y_U_V12 target frame (or a Y_V_U12 source frame).
256  * @param frame The frame from which the pixel will be extracted, must be valid
257  * @param x The horizontal pixel location within the frame, with range [0, frame.width() - 1]
258  * @param y The vertical pixel location within the frame, with range [0, frame.height() - 1]
259  * @param conversionFlag The conversion flag that will be applied, must be valid
260  * @return The vector holding the frame's color value at the specified location
261  */
262  static MatrixD pixelFunctionY_U_V12ForYUV24(const Frame& frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag);
263 };
264 
265 }
266 
267 }
268 
269 }
270 
271 #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:1760
This class implements a matrix with arbitrary size.
Definition: Matrix.h:63
This class implements a RGB frame converter test.
Definition: TestFrameConverterRGB24.h:32
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 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 test(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests all RGB 24 bit frame conversion functions.
static bool testRGB24ToY8(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 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 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 worker able to distribute function calls over different threads.
Definition: Worker.h:33
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15