Ocean
testlibyuv/TestFrameConverterY_U_V24.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_TESTLIBYUV_TEST_FRAME_CONVERTER_Y_U_V_24_H
9 #define META_OCEAN_TEST_TESTCV_TESTLIBYUV_TEST_FRAME_CONVERTER_Y_U_V_24_H
10 
12 
14 
15 namespace Ocean
16 {
17 
18 namespace Test
19 {
20 
21 namespace TestCV
22 {
23 
24 namespace TestLibyuv
25 {
26 
27 /**
28  * This class tests/benchmarks the performance of the frame converter function of libyuv for Y_U_V24 frames.
29  * @ingroup testcvlibyuv
30  */
31 class OCEAN_TEST_CV_LIBYUV_EXPORT TestFrameConverterY_U_V24
32 {
33  public:
34 
35  /**
36  * Benchmarks the performance of libyuv agains Ocean for frame converter functions.
37  * @param testDuration Number of seconds for each test, with range (0, infinity)
38  * @param skipValidation True, to skip the validation
39  */
40  static void test(const double testDuration, const bool skipValidation = false);
41 
42  /**
43  * Benchmarks the conversion from Y_U_V24 frames to BGRA32 frames.
44  * @param testDuration Number of seconds for each test, with range (0, infinity)
45  * @param skipValidation True, to skip the validation
46  * @return True, if succeeded
47  */
48  static bool testConvertY_U_V24ToBGRA32Precision6Bit(const double testDuration, const bool skipValidation = false);
49 
50  protected:
51 
52  /**
53  * Randomizes the content of a given Y_U_V24 frame while setting 2x2 areas of the y-plane and v-plane to the same value.
54  * @param frame The frame to be randomize, with even pixel resolution
55  */
56  static void specialRandomizeFrame(Frame& frame);
57 
58  /**
59  * Extracts one pixel from a Y_U_V24 source frame.
60  * @param frame The frame from which the pixel will be extracted, must be valid
61  * @param x The horizontal pixel location within the frame, with range [0, frame.width() - 1]
62  * @param y The vertical pixel location within the frame, with range [0, frame.height() - 1]
63  * @param conversionFlag The conversion flag that will be applied, must be valid
64  * @return The vector holding the frame's color value at the specified location
65  */
66  static MatrixD pixelFunctionY_U_V24ForYUV24(const Frame& frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag);
67 };
68 
69 }
70 
71 }
72 
73 }
74 
75 }
76 
77 #endif // META_OCEAN_TEST_TESTCV_TESTLIBYUV_TEST_FRAME_CONVERTER_Y_U_V_24_H
ConversionFlag
Definition of individual conversion flags.
Definition: FrameConverter.h:39
This class implements Ocean's image class.
Definition: Frame.h:1792
This class implements a matrix with arbitrary size.
Definition: Matrix.h:63
This class tests/benchmarks the performance of the frame converter function of libyuv for Y_U_V24 fra...
Definition: testlibyuv/TestFrameConverterY_U_V24.h:32
static bool testConvertY_U_V24ToBGRA32Precision6Bit(const double testDuration, const bool skipValidation=false)
Benchmarks the conversion from Y_U_V24 frames to BGRA32 frames.
static MatrixD pixelFunctionY_U_V24ForYUV24(const Frame &frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag)
Extracts one pixel from a Y_U_V24 source frame.
static void specialRandomizeFrame(Frame &frame)
Randomizes the content of a given Y_U_V24 frame while setting 2x2 areas of the y-plane and v-plane to...
static void test(const double testDuration, const bool skipValidation=false)
Benchmarks the performance of libyuv agains Ocean for frame converter functions.
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15