Ocean
testlibyuv/TestFrameConverterY_U_V12.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_12_H
9 #define META_OCEAN_TEST_TESTCV_TESTLIBYUV_TEST_FRAME_CONVERTER_Y_U_V_12_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_V12 frames.
29  * @ingroup testcvlibyuv
30  */
31 class OCEAN_TEST_CV_LIBYUV_EXPORT TestFrameConverterY_U_V12
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_V12 frames to RGBA32 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_V12ToRGBA32Precision6Bit(const double testDuration, const bool skipValidation = false);
49 
50  protected:
51 
52  /**
53  * Extracts one pixel from a Y_U_V12 source frame.
54  * @param frame The frame from which the pixel will be extracted, must be valid
55  * @param x The horizontal pixel location within the frame, with range [0, frame.width() - 1]
56  * @param y The vertical pixel location within the frame, with range [0, frame.height() - 1]
57  * @param conversionFlag The conversion flag that will be applied, must be valid
58  * @return The vector holding the frame's color value at the specified location
59  */
60  static MatrixD pixelFunctionY_U_V12ForYUV24(const Frame& frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag);
61 };
62 
63 }
64 
65 }
66 
67 }
68 
69 }
70 
71 #endif // META_OCEAN_TEST_TESTCV_TESTLIBYUV_TEST_FRAME_CONVERTER_Y_U_V_12_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 tests/benchmarks the performance of the frame converter function of libyuv for Y_U_V12 fra...
Definition: testlibyuv/TestFrameConverterY_U_V12.h:32
static void test(const double testDuration, const bool skipValidation=false)
Benchmarks the performance of libyuv agains Ocean for frame converter functions.
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 source frame.
static bool testConvertY_U_V12ToRGBA32Precision6Bit(const double testDuration, const bool skipValidation=false)
Benchmarks the conversion from Y_U_V12 frames to RGBA32 frames.
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15