Ocean
TestFrameConverterY10_Packed.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_Y_10_PACKED_H
9 #define META_OCEAN_TEST_TESTCV_TEST_FRAME_CONVERTER_Y_10_PACKED_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 Y10_PACKED frame converter test.
29  * @ingroup testcv
30  */
31 class OCEAN_TEST_CV_EXPORT TestFrameConverterY10_Packed
32 {
33  public:
34 
35  /**
36  * Tests all Y10_PACKED bit frame conversion functions.
37  * @param width The width of the test frame in pixel, with range [1, infinity)
38  * @param height The height of the test 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
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 the Y10_PACKED to BGR24 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
52  * @return True, if succeeded
53  */
54  static bool testY10_PackedToBGR24(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
55 
56  /**
57  * Tests the Y10_PACKED to RGB24 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
63  * @return True, if succeeded
64  */
65  static bool testY10_PackedToRGB24(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
66 
67  /**
68  * Tests the Y10_PACKED to Y8 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
74  * @return True, if succeeded
75  */
76  static bool testY10_PackedToY8Linear(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
77 
78  /**
79  * Tests the Y10_PACKED to Y8 conversion with gamma compression/correction.
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
85  * @return True, if succeeded
86  */
87  static bool testY10_PackedToY8GammaLUT(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
88 
89  /**
90  * Tests the Y10_PACKED to Y8 conversion with gamma compression/correction with a 3-step linear interpolation.
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
96  * @return True, if succeeded
97  */
98  static bool testY10_PackedToY8GammaApproximated(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
99 
100  /**
101  * Tests the Y10_PACKED to Y10 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
107  * @return True, if succeeded
108  */
109  static bool testY10_PackedToY10(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker& worker);
110 
111  private:
112 
113  /**
114  * Extracts one pixel from a Y10_PACKED source frame.
115  * @param frame The frame from which the pixel will be extracted, must be valid
116  * @param x The horizontal pixel location within the frame, with range [0, frame.width() - 1]
117  * @param y The vertical pixel location within the frame, with range [0, frame.height() - 1]
118  * @param conversionFlag The conversion flag that will be applied, must be valid
119  * @return The vector holding the frame's color value at the specified location
120  * @tparam tApplyGamma True, to apply gamma compression/correction after unpacking; False, to unpack the pixel value only
121  */
122  template <bool tApplyGamma>
123  static MatrixD pixelFunctionY10_Packed(const Frame& frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag);
124 
125  /**
126  * Extracts one pixel from a Y10_PACKED source frame and applies gamma approximation.
127  * @param frame The frame from which the pixel will be extracted, must be valid
128  * @param x The horizontal pixel location within the frame, with range [0, frame.width() - 1]
129  * @param y The vertical pixel location within the frame, with range [0, frame.height() - 1]
130  * @param conversionFlag The conversion flag that will be applied, must be valid
131  * @return The vector holding the frame's color value at the specified location
132  */
133  static MatrixD pixelFunctionY10_PackedApproximated(const Frame& frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag);
134 };
135 
136 }
137 
138 }
139 
140 }
141 
142 #endif // META_OCEAN_TEST_TESTCV_TEST_FRAME_CONVERTER_Y_10_PACKED_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 Y10_PACKED frame converter test.
Definition: TestFrameConverterY10_Packed.h:32
static bool testY10_PackedToY10(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the Y10_PACKED to Y10 conversion.
static bool testY10_PackedToBGR24(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the Y10_PACKED to BGR24 conversion.
static bool testY10_PackedToY8GammaApproximated(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the Y10_PACKED to Y8 conversion with gamma compression/correction with a 3-step linear interpol...
static MatrixD pixelFunctionY10_Packed(const Frame &frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag)
Extracts one pixel from a Y10_PACKED source frame.
static bool testY10_PackedToY8Linear(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the Y10_PACKED to Y8 conversion.
static bool test(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests all Y10_PACKED bit frame conversion functions.
static bool testY10_PackedToY8GammaLUT(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the Y10_PACKED to Y8 conversion with gamma compression/correction.
static MatrixD pixelFunctionY10_PackedApproximated(const Frame &frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag)
Extracts one pixel from a Y10_PACKED source frame and applies gamma approximation.
static bool testY10_PackedToRGB24(const unsigned int width, const unsigned int height, const CV::FrameConverter::ConversionFlag flag, const double testDuration, Worker &worker)
Tests the Y10_PACKED to RGB24 conversion.
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