Ocean
FrameConverterY_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_CV_FRAME_CONVERTER_Y_U_V_12_H
9 #define META_OCEAN_CV_FRAME_CONVERTER_Y_U_V_12_H
10 
11 #include "ocean/cv/CV.h"
12 #include "ocean/cv/FrameChannels.h"
14 
15 #include "ocean/base/Worker.h"
16 
17 namespace Ocean
18 {
19 
20 namespace CV
21 {
22 
23 /**
24  * This class provides functions to convert frames with Y_U_V12 pixel format.
25  * The Y_U_V12 format holds the three blocks of color channels.<br>
26  * The first block covers the Y channel and holds 8 bit per pixel.<br>
27  * The second block covers the U channel and holds 8 bit for four pixels in a 2x2 neighborhood.<br>
28  * The third block covers the V channel and also holds 8 bit for four pixels in a 2x2 neighborhood.
29  * @ingroup cv
30  */
31 class OCEAN_CV_EXPORT FrameConverterY_U_V12 : public FrameConverter
32 {
33  public:
34 
35  /**
36  * Converts a Y_U_V12 frame to a Y_U_V12 frame into a second image buffer.
37  * @param ySource The y source plane, with (width + yPaddingElements) * height elements, must be valid
38  * @param uSource The u source plane, with (width/2 + uPaddingElements) * height/2 elements, must be valid
39  * @param vSource The v source plane, with (width/2 + vPaddingElements) * height/2 elements, must be valid
40  * @param yTarget The y target plane, with (width + yTargetPaddingElements) * height elements, must be valid
41  * @param uTarget The u target plane, with (width/2 + uTargetPaddingElements) * height/2 elements, must be valid
42  * @param vTarget The v target plane, with (width/2 + vTargetPaddingElements) * height/2 elements, must be valid
43  * @param width The width of the frame in pixel, with range [2, infinity), must be a multiple of 2
44  * @param height The height of the frame in pixel, with range [2, infinity), must be a multiple of 2
45  * @param flag Determining the type of conversion
46  * @param ySourcePaddingElements The number of padding elements at the end of each y-source row, in (uint8_t) elements, with range [0, infinity)
47  * @param uSourcePaddingElements The number of padding elements at the end of each u-source row, in (uint8_t) elements, with range [0, infinity)
48  * @param vSourcePaddingElements The number of padding elements at the end of each v-source row, in (uint8_t) elements, with range [0, infinity)
49  * @param yTargetPaddingElements The number of padding elements at the end of each y-target row, in (uint8_t) elements, with range [0, infinity)
50  * @param uTargetPaddingElements The number of padding elements at the end of each uv-target row, in (uint8_t) elements, with range [0, infinity)
51  * @param vTargetPaddingElements The number of padding elements at the end of each uv-target row, in (uint8_t) elements, with range [0, infinity)
52  * @param worker Optional worker object to distribute the computational to several CPU cores
53  */
54  static inline void convertY_U_V12ToY_U_V12(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* yTarget, uint8_t* uTarget, uint8_t* vTarget, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int yTargetPaddingElements, const unsigned int uTargetPaddingElements, const unsigned int vTargetPaddingElements, Worker* worker = nullptr);
55 
56  /**
57  * Converts a Y_U_V12 frame to an 8 bit gray scale frame into a second image buffer.
58  * @param ySource The y source frame buffer, with (width + yPaddingElements) * height elements, must be valid
59  * @param uSource The u source frame buffer, with (width/2 + uPaddingElements) * height/2 elements, can be invalid, as this parameter is not used
60  * @param vSource The v source frame buffer, with (width/2 + vPaddingElements) * height/2 elements, can be invalid, as this parameter is not used
61  * @param target The target frame buffer, with (width + targetPaddingElements) * height elements, must be valid
62  * @param width The width of the frame in pixel, with range [2, infinity), must be a multiple of 2
63  * @param height The height of the frame in pixel, with range [2, infinity), must be a multiple of 2
64  * @param flag Determining the type of conversion
65  * @param ySourcePaddingElements The number of padding elements at the end of each y-source row, in (uint8_t) elements, with range [0, infinity)
66  * @param uSourcePaddingElements The number of padding elements at the end of each u-source row, in (uint8_t) elements, with range [0, infinity), actually this parameter is not used
67  * @param vSourcePaddingElements The number of padding elements at the end of each v-source row, in (uint8_t) elements, with range [0, infinity), actually this parameter is not used
68  * @param targetPaddingElements The number of padding elements at the end of each target row, in (uint8_t) elements, with range [0, infinity)
69  * @param worker Optional worker object to distribute the computational to several CPU cores
70  */
71  static inline void convertY_U_V12ToY8(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker* worker = nullptr);
72 
73  /**
74  * Converts a Y_U_V12 frame to a 24 bit BGR frame into a second image buffer using BT.601 (digital).
75  * <pre>
76  * YUV input value range: [16, 235]x[16, 240]x[16, 240]
77  * BGR output value range: [ 0, 255]x[ 0, 255]x[ 0, 255]
78  * </pre>
79  * @param ySource The y source frame buffer, with (width + yPaddingElements) * height elements, must be valid
80  * @param uSource The u source frame buffer, with (width/2 + uPaddingElements) * height/2 elements, must be valid
81  * @param vSource The v source frame buffer, with (width/2 + vPaddingElements) * height/2 elements, must be valid
82  * @param target The target frame buffer, with (width + targetPaddingElements) * height elements, must be valid
83  * @param width The width of the frame in pixel, with range [2, infinity), must be a multiple of 2
84  * @param height The height of the frame in pixel, with range [2, infinity), must be a multiple of 2
85  * @param flag Determining the type of conversion
86  * @param ySourcePaddingElements The number of padding elements at the end of each y-source row, in (uint8_t) elements, with range [0, infinity)
87  * @param uSourcePaddingElements The number of padding elements at the end of each u-source row, in (uint8_t) elements, with range [0, infinity)
88  * @param vSourcePaddingElements The number of padding elements at the end of each v-source row, in (uint8_t) elements, with range [0, infinity)
89  * @param targetPaddingElements The number of padding elements at the end of each target row, in (uint8_t) elements, with range [0, infinity)
90  * @param worker Optional worker object to distribute the computational to several CPU cores
91  */
92  static inline void convertY_U_V12LimitedRangeToBGR24FullRange(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker* worker = nullptr);
93 
94  /**
95  * Converts a Y_U_V12 frame to a 24 bit BGR frame into a second image buffer using BT.601 (analog).
96  * <pre>
97  * YUV input value range: [0, 255]x[0, 255]x[0, 255]
98  * BGR output value range: [0, 255]x[0, 255]x[0, 255]
99  * </pre>
100  * @param ySource The y source frame buffer, with (width + yPaddingElements) * height elements, must be valid
101  * @param uSource The u source frame buffer, with (width/2 + uPaddingElements) * height/2 elements, must be valid
102  * @param vSource The v source frame buffer, with (width/2 + vPaddingElements) * height/2 elements, must be valid
103  * @param target The target frame buffer, with (width + targetPaddingElements) * height elements, must be valid
104  * @param width The width of the frame in pixel, with range [2, infinity), must be a multiple of 2
105  * @param height The height of the frame in pixel, with range [2, infinity), must be a multiple of 2
106  * @param flag Determining the type of conversion
107  * @param ySourcePaddingElements The number of padding elements at the end of each y-source row, in (uint8_t) elements, with range [0, infinity)
108  * @param uSourcePaddingElements The number of padding elements at the end of each u-source row, in (uint8_t) elements, with range [0, infinity)
109  * @param vSourcePaddingElements The number of padding elements at the end of each v-source row, in (uint8_t) elements, with range [0, infinity)
110  * @param targetPaddingElements The number of padding elements at the end of each target row, in (uint8_t) elements, with range [0, infinity)
111  * @param worker Optional worker object to distribute the computational to several CPU cores
112  */
113  static inline void convertY_U_V12FullRangeToBGR24FullRangePrecision6Bit(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker* worker = nullptr);
114 
115  /**
116  * Converts a Y_U_V12 frame to an 32 bit BGRA frame into a second image buffer (with 6 bit precision).
117  * <pre>
118  * YUV input value range: [16, 235]x[16, 240]x[16, 240]
119  * BGRA output value range: [ 0, 255]x[ 0, 255]x[ 0, 255]x[ 0, 255]
120  * </pre>
121  * @param ySource The y source frame buffer, with (width + yPaddingElements) * height elements, must be valid
122  * @param uSource The u source frame buffer, with (width/2 + uPaddingElements) * height/2 elements, must be valid
123  * @param vSource The v source frame buffer, with (width/2 + vPaddingElements) * height/2 elements, must be valid
124  * @param target The target frame buffer, with (width + targetPaddingElements) * height elements, must be valid
125  * @param width The width of the frame in pixel, with range [2, infinity), must be a multiple of 2
126  * @param height The height of the frame in pixel, with range [2, infinity), must be a multiple of 2
127  * @param flag Determining the type of conversion
128  * @param ySourcePaddingElements The number of padding elements at the end of each y-source row, in (uint8_t) elements, with range [0, infinity)
129  * @param uSourcePaddingElements The number of padding elements at the end of each u-source row, in (uint8_t) elements, with range [0, infinity)
130  * @param vSourcePaddingElements The number of padding elements at the end of each v-source row, in (uint8_t) elements, with range [0, infinity)
131  * @param targetPaddingElements The number of padding elements at the end of each target row, in (uint8_t) elements, with range [0, infinity)
132  * @param alphaValue The value of the alpha channel to be set, with range [0, 255]
133  * @param worker Optional worker object to distribute the computational to several CPU cores
134  */
135  static inline void convertY_U_V12LimitedRangeToBGRA32FullRangePrecision6Bit(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, const uint8_t alphaValue = 0xFF, Worker* worker = nullptr);
136 
137  /**
138  * Converts a Y_U_V12 frame to a 24 bit RGB frame into a second image buffer.
139  * <pre>
140  * YUV input value range: [16, 235]x[16, 240]x[16, 240]
141  * RGB output value range: [ 0, 255]x[ 0, 255]x[ 0, 255]
142  * </pre>
143  * @param ySource The y source frame buffer, with (width + yPaddingElements) * height elements, must be valid
144  * @param uSource The u source frame buffer, with (width/2 + uPaddingElements) * height/2 elements, must be valid
145  * @param vSource The v source frame buffer, with (width/2 + vPaddingElements) * height/2 elements, must be valid
146  * @param target The target frame buffer, with (width + targetPaddingElements) * height elements, must be valid
147  * @param width The width of the frame in pixel, with range [2, infinity), must be a multiple of 2
148  * @param height The height of the frame in pixel, with range [2, infinity), must be a multiple of 2
149  * @param flag Determining the type of conversion
150  * @param ySourcePaddingElements The number of padding elements at the end of each y-source row, in (uint8_t) elements, with range [0, infinity)
151  * @param uSourcePaddingElements The number of padding elements at the end of each u-source row, in (uint8_t) elements, with range [0, infinity)
152  * @param vSourcePaddingElements The number of padding elements at the end of each v-source row, in (uint8_t) elements, with range [0, infinity)
153  * @param targetPaddingElements The number of padding elements at the end of each target row, in (uint8_t) elements, with range [0, infinity)
154  * @param worker Optional worker object to distribute the computational to several CPU cores
155  */
156  static inline void convertY_U_V12LimitedRangeToRGB24FullRange(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker* worker = nullptr);
157 
158  /**
159  * Converts a Y_U_V12 frame to a 24 bit RGB frame into a second image buffer (with 6 bit precision).
160  * <pre>
161  * YUV input value range: [16, 235]x[16, 240]x[16, 240]
162  * RGB output value range: [ 0, 255]x[ 0, 255]x[ 0, 255]
163  * </pre>
164  * @param ySource The y source frame buffer, with (width + yPaddingElements) * height elements, must be valid
165  * @param uSource The u source frame buffer, with (width/2 + uPaddingElements) * height/2 elements, must be valid
166  * @param vSource The v source frame buffer, with (width/2 + vPaddingElements) * height/2 elements, must be valid
167  * @param target The target frame buffer, with (width + targetPaddingElements) * height elements, must be valid
168  * @param width The width of the frame in pixel, with range [2, infinity), must be a multiple of 2
169  * @param height The height of the frame in pixel, with range [2, infinity), must be a multiple of 2
170  * @param flag Determining the type of conversion
171  * @param ySourcePaddingElements The number of padding elements at the end of each y-source row, in (uint8_t) elements, with range [0, infinity)
172  * @param uSourcePaddingElements The number of padding elements at the end of each u-source row, in (uint8_t) elements, with range [0, infinity)
173  * @param vSourcePaddingElements The number of padding elements at the end of each v-source row, in (uint8_t) elements, with range [0, infinity)
174  * @param targetPaddingElements The number of padding elements at the end of each target row, in (uint8_t) elements, with range [0, infinity)
175  * @param worker Optional worker object to distribute the computational to several CPU cores
176  */
177  static inline void convertY_U_V12LimitedRangeToRGB24FullRangePrecision6Bit(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker* worker = nullptr);
178 
179  /**
180  * Converts a Y_U_V12 frame to a 24 bit RGB frame into a second image buffer.
181  * <pre>
182  * YUV input value range: [0, 255]x[0, 255]x[0, 255]
183  * RGB output value range: [0, 255]x[0, 255]x[0, 255]
184  * </pre>
185  * @param ySource The y source frame buffer, with (width + yPaddingElements) * height elements, must be valid
186  * @param uSource The u source frame buffer, with (width/2 + uPaddingElements) * height/2 elements, must be valid
187  * @param vSource The v source frame buffer, with (width/2 + vPaddingElements) * height/2 elements, must be valid
188  * @param target The target frame buffer, with (width + targetPaddingElements) * height elements, must be valid
189  * @param width The width of the frame in pixel, with range [2, infinity), must be a multiple of 2
190  * @param height The height of the frame in pixel, with range [2, infinity), must be a multiple of 2
191  * @param flag Determining the type of conversion
192  * @param ySourcePaddingElements The number of padding elements at the end of each y-source row, in (uint8_t) elements, with range [0, infinity)
193  * @param uSourcePaddingElements The number of padding elements at the end of each u-source row, in (uint8_t) elements, with range [0, infinity)
194  * @param vSourcePaddingElements The number of padding elements at the end of each v-source row, in (uint8_t) elements, with range [0, infinity)
195  * @param targetPaddingElements The number of padding elements at the end of each target row, in (uint8_t) elements, with range [0, infinity)
196  * @param worker Optional worker object to distribute the computational to several CPU cores
197  */
198  static inline void convertY_U_V12FullRangeToRGB24FullRangePrecision6Bit(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker* worker = nullptr);
199 
200  /**
201  * Converts a Y_U_V12 frame to an 32 bit RGBA frame into a second image buffer.
202  * <pre>
203  * YUV input value range: [16, 235]x[16, 240]x[16, 240]
204  * RGBA output value range: [ 0, 255]x[ 0, 255]x[ 0, 255]x[ 0, 255]
205  * </pre>
206  * @param ySource The y source frame buffer, with (width + yPaddingElements) * height elements, must be valid
207  * @param uSource The u source frame buffer, with (width/2 + uPaddingElements) * height/2 elements, must be valid
208  * @param vSource The v source frame buffer, with (width/2 + vPaddingElements) * height/2 elements, must be valid
209  * @param target The target frame buffer, with (width + targetPaddingElements) * height elements, must be valid
210  * @param width The width of the frame in pixel, with range [2, infinity), must be a multiple of 2
211  * @param height The height of the frame in pixel, with range [2, infinity), must be a multiple of 2
212  * @param flag Determining the type of conversion
213  * @param ySourcePaddingElements The number of padding elements at the end of each y-source row, in (uint8_t) elements, with range [0, infinity)
214  * @param uSourcePaddingElements The number of padding elements at the end of each u-source row, in (uint8_t) elements, with range [0, infinity)
215  * @param vSourcePaddingElements The number of padding elements at the end of each v-source row, in (uint8_t) elements, with range [0, infinity)
216  * @param targetPaddingElements The number of padding elements at the end of each target row, in (uint8_t) elements, with range [0, infinity)
217  * @param alphaValue The value of the alpha channel to be set, with range [0, 255]
218  * @param worker Optional worker object to distribute the computational to several CPU cores
219  */
220  static inline void convertY_U_V12LimitedRangeToRGBA32FullRangePrecision6Bit(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, const uint8_t alphaValue = 0xFF, Worker* worker = nullptr);
221 
222  /**
223  * Converts a Y_U_V12 frame to a 24 bit YUV frame into a second image buffer.
224  * @param ySource The y source frame buffer, with (width + yPaddingElements) * height elements, must be valid
225  * @param uSource The u source frame buffer, with (width/2 + uPaddingElements) * height/2 elements, must be valid
226  * @param vSource The v source frame buffer, with (width/2 + vPaddingElements) * height/2 elements, must be valid
227  * @param target The target frame buffer, with (width + targetPaddingElements) * height elements, must be valid
228  * @param width The width of the frame in pixel, with range [2, infinity), must be a multiple of 2
229  * @param height The height of the frame in pixel, with range [2, infinity), must be a multiple of 2
230  * @param flag Determining the type of conversion
231  * @param ySourcePaddingElements The number of padding elements at the end of each y-source row, in (uint8_t) elements, with range [0, infinity)
232  * @param uSourcePaddingElements The number of padding elements at the end of each u-source row, in (uint8_t) elements, with range [0, infinity)
233  * @param vSourcePaddingElements The number of padding elements at the end of each v-source row, in (uint8_t) elements, with range [0, infinity)
234  * @param targetPaddingElements The number of padding elements at the end of each target row, in (uint8_t) elements, with range [0, infinity)
235  * @param worker Optional worker object to distribute the computational to several CPU cores
236  */
237  static inline void convertY_U_V12ToYUV24(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker* worker = nullptr);
238 
239  /**
240  * Converts a Y_U_V12 frame to a 24 bit YVU frame into a second image buffer.
241  * @param ySource The y source frame buffer, with (width + yPaddingElements) * height elements, must be valid
242  * @param uSource The u source frame buffer, with (width/2 + uPaddingElements) * height/2 elements, must be valid
243  * @param vSource The v source frame buffer, with (width/2 + vPaddingElements) * height/2 elements, must be valid
244  * @param target The target frame buffer, with (width + targetPaddingElements) * height elements, must be valid
245  * @param width The width of the frame in pixel, with range [2, infinity), must be a multiple of 2
246  * @param height The height of the frame in pixel, with range [2, infinity), must be a multiple of 2
247  * @param flag Determining the type of conversion
248  * @param ySourcePaddingElements The number of padding elements at the end of each y-source row, in (uint8_t) elements, with range [0, infinity)
249  * @param uSourcePaddingElements The number of padding elements at the end of each u-source row, in (uint8_t) elements, with range [0, infinity)
250  * @param vSourcePaddingElements The number of padding elements at the end of each v-source row, in (uint8_t) elements, with range [0, infinity)
251  * @param targetPaddingElements The number of padding elements at the end of each target row, in (uint8_t) elements, with range [0, infinity)
252  * @param worker Optional worker object to distribute the computational to several CPU cores
253  */
254  static inline void convertY_U_V12ToYVU24(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker* worker = nullptr);
255 
256  /**
257  * Converts a Y_U_V12 frame to a Y_UV12 frame into a second image buffer.
258  * @param ySource The y source plane, with (width + yPaddingElements) * height elements, must be valid
259  * @param uSource The u source plane, with (width/2 + uPaddingElements) * height/2 elements, must be valid
260  * @param vSource The v source plane, with (width/2 + vPaddingElements) * height/2 elements, must be valid
261  * @param yTarget The y target plane, with (width + yTargetPaddingElements) * height elements, must be valid
262  * @param uvTarget The uv target plane, with (width + uvTargetPaddingElements) * height/2 elements, must be valid
263  * @param width The width of the frame in pixel, with range [2, infinity), must be a multiple of 2
264  * @param height The height of the frame in pixel, with range [2, infinity), must be a multiple of 2
265  * @param ySourcePaddingElements The number of padding elements at the end of each y-source row, in (uint8_t) elements, with range [0, infinity)
266  * @param uSourcePaddingElements The number of padding elements at the end of each u-source row, in (uint8_t) elements, with range [0, infinity)
267  * @param vSourcePaddingElements The number of padding elements at the end of each v-source row, in (uint8_t) elements, with range [0, infinity)
268  * @param yTargetPaddingElements The number of padding elements at the end of each y-target row, in (uint8_t) elements, with range [0, infinity)
269  * @param uvTargetPaddingElements The number of padding elements at the end of each uv-target row, in (uint8_t) elements, with range [0, infinity)
270  * @param ySourcePixelStride The stride between consecutive pixels in the y source plane, in elements, with range [1, infinity)
271  * @param uSourcePixelStride The stride between consecutive pixels in the u source plane, in elements, with range [1, infinity)
272  * @param vSourcePixelStride The stride between consecutive pixels in the v source plane, in elements, with range [1, infinity)
273  * @param worker Optional worker object to distribute the computational to several CPU cores
274  */
275  static inline void convertY_U_V12ToY_UV12(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* yTarget, uint8_t* uvTarget, const unsigned int width, const unsigned int height, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int yTargetPaddingElements, const unsigned int uvTargetPaddingElements, const unsigned int ySourcePixelStride = 1u, const unsigned int uSourcePixelStride = 1u, const unsigned int vSourcePixelStride = 1u, Worker* worker = nullptr);
276 
277  protected:
278 
279  /**
280  * Converts one row of an image with Y_U_V12 pixel format to one row of an image with RGBA32 pixel format.
281  * This function applies hard-coded conversion parameters.<br>
282  * The layout of the options parameters is as follows:
283  * <pre>
284  * options[0] uint32_t: sourcePlane0PaddingElements
285  * options[1] uint32_t: sourcePlane1PaddingElements
286  * options[2] uint32_t: sourcePlane2PaddingElements
287  * options[3] uint32_t: targetZippedPaddingElements
288  * options[4] uint32_t: channelValue3
289  * </pre>
290  * @param sources The pointer to the first, second, and third memory block of the source image, must be valid
291  * @param targets The one pointer to the target image, must be valid
292  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height - 1]
293  * @param width The width of the frame in pixel, with range [1, infinity)
294  * @param height The height of the frame in pixel, with range [1, infinity)
295  * @param conversionFlag The conversion to be applied
296  * @param options The 5 options parameters: 4 padding parameters, one constant channel value, must be valid
297  */
298  static void convertOneRowY_U_V12ToRGBA32Precision6Bit(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
299 
300  /**
301  * Converts two rows of an image with Y_U_V12 pixel format to two rows of an image with a Y_UV12 pixel format.
302  * The layout of the options parameters is as follows:
303  * <pre>
304  * options[0] uint32_t: ySourcePaddingElements
305  * options[1] uint32_t: uSourcePaddingElements
306  * options[2] uint32_t: vSourcePaddingElements
307  * options[3] uint32_t: yTargetPaddingElements
308  * options[4] uint32_t: uvTargetPaddingElements
309  * options[5] uint32_t: ySourcePixelStride
310  * options[6] uint32_t: uSourcePixelStride
311  * options[7] uint32_t: vSourcePixelStride
312  * </pre>
313  * @param sources The pointer to the first, second, and third plane of the source image, must be valid
314  * @param targets The one pointer to the first and second target plane, must be valid
315  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height / 2 - 1]
316  * @param width The width of the frame in pixel, with range [2, infinity), must be even
317  * @param height The height of the frame in pixel, with range [2, infinity), must be even
318  * @param conversionFlag The conversion to be applied, must be CONVERT_NORMAL
319  * @param options The 8 options parameters: 5 padding parameters, 3 pixel stride parameters, must be valid
320  */
321  static void mapY_U_V12ToY_UV12(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
322 };
323 
324 inline void FrameConverterY_U_V12::convertY_U_V12ToY_U_V12(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* yTarget, uint8_t* uTarget, uint8_t* vTarget, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int yTargetPaddingElements, const unsigned int uTargetPaddingElements, const unsigned int vTargetPaddingElements, Worker* worker)
325 {
326  ocean_assert(ySource != nullptr && uSource != nullptr && vSource != nullptr);
327  ocean_assert(yTarget != nullptr && uTarget != nullptr && vTarget != nullptr);
328  ocean_assert(width >= 2u && height >= 2u);
329  ocean_assert(width % 2u == 0u && height % 2u == 0u);
330 
331  const unsigned int width_2 = width / 2u;
332  const unsigned int height_2 = height / 2u;
333 
334  FrameChannels::transformGeneric<uint8_t, 1u>(ySource, yTarget, width, height, flag, ySourcePaddingElements, yTargetPaddingElements, worker);
335  FrameChannels::transformGeneric<uint8_t, 1u>(uSource, uTarget, width_2, height_2, flag, uSourcePaddingElements, uTargetPaddingElements, worker);
336  FrameChannels::transformGeneric<uint8_t, 1u>(vSource, vTarget, width_2, height_2, flag, vSourcePaddingElements, vTargetPaddingElements, worker);
337 }
338 
339 inline void FrameConverterY_U_V12::convertY_U_V12ToY8(const uint8_t* ySource, const uint8_t* /* uSource */, const uint8_t* /* vSource */, uint8_t* target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int /* uSourcePaddingElements */, const unsigned int /* vSourcePaddingElements */, const unsigned int targetPaddingElements, Worker* worker)
340 {
341  ocean_assert(ySource != nullptr && target != nullptr);
342  ocean_assert(width >= 1u && height >= 1u);
343 
344  FrameChannels::transformGeneric<uint8_t, 1u>(ySource, target, width, height, flag, ySourcePaddingElements, targetPaddingElements, worker);
345 }
346 
347 inline void FrameConverterY_U_V12::convertY_U_V12LimitedRangeToBGR24FullRange(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker* worker)
348 {
349  ocean_assert(ySource != nullptr && uSource != nullptr && vSource != nullptr && target != nullptr);
350 
351  ocean_assert(width >= 2u && width % 2u == 0u);
352  ocean_assert(height >= 2u && height % 2u == 0u);
353 
354  if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
355  {
356  return;
357  }
358 
359  // precise color space conversion:
360  // | B | | 1.1639404296875 2.0179443359375 0.0 -276.919921875 | | Y |
361  // | G | = | 1.1639404296875 -0.3909912109375 -0.81298828125 135.486328125 | * | U |
362  // | R | | 1.1639404296875 0.0 1.595947265625 -222.904296875 | | V |
363  // | 1 |
364 
365  // approximation:
366  // | B | | 1192 2066 0 -277 | | Y |
367  // | G | = | 1192 -400 -833 135 | * | U |
368  // | R | | 1192 0 1634 -223 | | V |
369  // | 1 |
370 
371  const int options[4 + 12] =
372  {
373  // padding parameters
374  int(ySourcePaddingElements), int(uSourcePaddingElements), int(vSourcePaddingElements), int(targetPaddingElements),
375 
376  // multiplication parameters (with denominator 1024)
377  1192, 1192, 1192, 2066, -400, 0, 0, -833, 1634,
378 
379  // bias/translation parameters (with denominator 1)
380  -277, 135, -223
381  };
382 
383  const void* sources[3] =
384  {
385  ySource,
386  uSource,
387  vSource
388  };
389 
391 }
392 
393 inline void FrameConverterY_U_V12::convertY_U_V12FullRangeToBGR24FullRangePrecision6Bit(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker* worker)
394 {
395  ocean_assert(ySource != nullptr && uSource != nullptr && vSource != nullptr && target != nullptr);
396 
397  ocean_assert(width >= 2u && width % 2u == 0u);
398  ocean_assert(height >= 2u && height % 2u == 0u);
399 
400  if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
401  {
402  return;
403  }
404 
405  /*
406  * | B | | 1.0 1.772 0.0 -226.816 | | Y |
407  * | G | = | 1.0 -0.34414 -0.71414 135.45984 | * | U |
408  * | R | | 1.0 0.0 1.402 -179.456 | | V |
409  * | 1 |
410  *
411  * Approximation with 6 bit precision:
412  * | B | | 64 113 0 | | Y |
413  * 64 * | G | = | 64 -22 -46 | * | U - 128 |
414  * | R | | 64 0 90 | | V - 128 |
415  */
416 
417  const int options[4 + 12] =
418  {
419  // padding parameters
420  int(ySourcePaddingElements), int(uSourcePaddingElements), int(vSourcePaddingElements), int(targetPaddingElements),
421 
422  // multiplication parameters (with denominator 1024)
423  64, 64, 64, 113, -22, 0, 0, -46, 90,
424 
425  // bias/translation parameters (with denominator 1)
426  0, 128, 128
427  };
428 
429  const void* sources[3] =
430  {
431  ySource,
432  uSource,
433  vSource
434  };
435 
437 }
438 
439 inline void FrameConverterY_U_V12::convertY_U_V12LimitedRangeToBGRA32FullRangePrecision6Bit(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, const uint8_t alphaValue, Worker* worker)
440 {
441  ocean_assert(ySource != nullptr && uSource != nullptr && vSource != nullptr && target != nullptr);
442 
443  ocean_assert(width >= 2u && width % 2u == 0u);
444  ocean_assert(height >= 2u && height % 2u == 0u);
445 
446  if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
447  {
448  return;
449  }
450 
451  // Approximation with 6 bit precision:
452  // | B | | 75 128 0 | | Y - 16 |
453  // 64 * | G | = | 75 -25 -52 | * | U - 128 |
454  // | R | | 75 0 102 | | V - 128 |
455 
456  const int options[4 + 12 + 1] =
457  {
458  // padding parameters
459  int(ySourcePaddingElements), int(uSourcePaddingElements), int(vSourcePaddingElements), int(targetPaddingElements),
460 
461  // multiplication parameters (with denominator 64)
462  75, 75, 75, 128, -25, 0, 0, -52, 102,
463 
464  // bias/translation parameters (with denominator 1)
465  16, 128, 128,
466 
467  // alpha value
468  int(alphaValue)
469  };
470 
471  const void* sources[3] =
472  {
473  ySource,
474  uSource,
475  vSource
476  };
477 
479 }
480 
481 inline void FrameConverterY_U_V12::convertY_U_V12LimitedRangeToRGB24FullRange(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker* worker)
482 {
483  ocean_assert(ySource != nullptr && uSource != nullptr && vSource != nullptr && target != nullptr);
484 
485  ocean_assert(width >= 2u && width % 2u == 0u);
486  ocean_assert(height >= 2u && height % 2u == 0u);
487 
488  if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
489  {
490  return;
491  }
492 
493  // precise color space conversion:
494  // | R | | 1.1639404296875 0.0 1.595947265625 -222.904296875 | | Y |
495  // | G | = | 1.1639404296875 -0.3909912109375 -0.81298828125 135.486328125 | * | U |
496  // | B | | 1.1639404296875 2.0179443359375 0.0 -276.919921875 | | V |
497  // | 1 |
498 
499  // approximation:
500  // | R | | 1192 0 1634 -223 | | Y |
501  // | G | = | 1192 -400 -833 135 | * | U |
502  // | B | | 1192 2066 0 -277 | | V |
503  // | 1 |
504 
505  const int options[4 + 12] =
506  {
507  // padding parameters
508  int(ySourcePaddingElements), int(uSourcePaddingElements), int(vSourcePaddingElements), int(targetPaddingElements),
509 
510  // multiplication parameters (with denominator 1024)
511  1192, 1192, 1192, 0, -400, 2066, 1634, -833, 0,
512 
513  // bias/translation parameters (with denominator 1)
514  -223, 135, -277
515  };
516 
517  const void* sources[3] =
518  {
519  ySource,
520  uSource,
521  vSource
522  };
523 
525 }
526 
527 inline void FrameConverterY_U_V12::convertY_U_V12LimitedRangeToRGB24FullRangePrecision6Bit(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker* worker)
528 {
529  ocean_assert(ySource != nullptr && uSource != nullptr && vSource != nullptr && target != nullptr);
530 
531  ocean_assert(width >= 2u && width % 2u == 0u);
532  ocean_assert(height >= 2u && height % 2u == 0u);
533 
534  if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
535  {
536  return;
537  }
538 
539  /*
540  * | R | | 1.1639404296875 0.0 1.595947265625 -222.904296875 | | Y |
541  * | G | = | 1.1639404296875 -0.3909912109375 -0.81298828125 135.486328125 | * | U |
542  * | B | | 1.1639404296875 2.0179443359375 0.0 -276.919921875 | | V |
543  * | 1 |
544  *
545  * Approximation with 6 bit precision:
546  * | R | | 75 0 102 | | Y - 16 |
547  * 64 * | G | = | 75 -25 -52 | * | U - 128 |
548  * | B | | 75 128 0 | | V - 128 |
549  */
550 
551  const int options[4 + 12] =
552  {
553  // padding parameters
554  int(ySourcePaddingElements), int(uSourcePaddingElements), int(vSourcePaddingElements), int(targetPaddingElements),
555 
556  // multiplication parameters (with denominator 1024)
557  75, 75, 75, 0, -25, 128, 102, -52, 0,
558 
559  // bias/translation parameters (with denominator 1)
560  16, 128, 128
561  };
562 
563  const void* sources[3] =
564  {
565  ySource,
566  uSource,
567  vSource
568  };
569 
571 }
572 
573 inline void FrameConverterY_U_V12::convertY_U_V12FullRangeToRGB24FullRangePrecision6Bit(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker* worker)
574 {
575  ocean_assert(ySource != nullptr && uSource != nullptr && vSource != nullptr && target != nullptr);
576 
577  ocean_assert(width >= 2u && width % 2u == 0u);
578  ocean_assert(height >= 2u && height % 2u == 0u);
579 
580  if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
581  {
582  return;
583  }
584 
585  /*
586  * | R | | 1.0 0.0 1.402 -179.456 | | Y |
587  * | G | = | 1.0 -0.34414 -0.71414 135.45984 | * | U |
588  * | B | | 1.0 1.772 0.0 -226.816 | | V |
589  * | 1 |
590  *
591  * Approximation with 6 bit precision:
592  * | R | | 64 0 90 | | Y |
593  * 64 * | G | = | 64 -22 -46 | * | U - 128 |
594  * | B | | 64 113 0 | | V - 128 |
595  */
596 
597  const int options[4 + 12] =
598  {
599  // padding parameters
600  int(ySourcePaddingElements), int(uSourcePaddingElements), int(vSourcePaddingElements), int(targetPaddingElements),
601 
602  // multiplication parameters (with denominator 1024)
603  64, 64, 64, 0, -22, 113, 90, -46, 0,
604 
605  // bias/translation parameters (with denominator 1)
606  0, 128, 128
607  };
608 
609  const void* sources[3] =
610  {
611  ySource,
612  uSource,
613  vSource
614  };
615 
617 }
618 
619 inline void FrameConverterY_U_V12::convertY_U_V12LimitedRangeToRGBA32FullRangePrecision6Bit(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, const uint8_t alphaValue, Worker* worker)
620 {
621  ocean_assert(ySource != nullptr && uSource != nullptr && vSource != nullptr && target != nullptr);
622 
623  ocean_assert(width >= 2u && width % 2u == 0u);
624  ocean_assert(height >= 2u && height % 2u == 0u);
625 
626  if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
627  {
628  return;
629  }
630 
631 #if 1
632 
633  // Approximation with 6 bit precision:
634  // | R | | 75 0 102 | | Y - 16 |
635  // 64 * | G | = | 75 -25 -52 | * | U - 128 |
636  // | B | | 75 128 0 | | V - 128 |
637 
638  const int options[4 + 12 + 1] =
639  {
640  // padding parameters
641  int(ySourcePaddingElements), int(uSourcePaddingElements), int(vSourcePaddingElements), int(targetPaddingElements),
642 
643  // multiplication parameters (with denominator 64)
644  75, 75, 75, 0, -25, 128, 102, -52, 0,
645 
646  // bias/translation parameters (with denominator 1)
647  16, 128, 128,
648 
649  // alpha value
650  int(alphaValue)
651  };
652 
653  const void* sources[3] =
654  {
655  ySource,
656  uSource,
657  vSource
658  };
659 
661 
662 #else
663 
664  const int options[4 + 1] =
665  {
666  // padding parameters
667  int(ySourcePaddingElements), int(uSourcePaddingElements), int(vSourcePaddingElements), int(targetPaddingElements),
668 
669  // alpha value
670  int(alphaValue)
671  };
672 
673  const void* sources[3] =
674  {
675  ySource,
676  uSource,
677  vSource
678  };
679 
680  FrameConverter::convertArbitraryPixelFormat(sources, (void**)(&target), width, height, flag, 1u, convertOneRowY_U_V12ToRGBA32Precision6Bit, options, worker);
681 
682 #endif
683 }
684 
685 inline void FrameConverterY_U_V12::convertY_U_V12ToYUV24(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker* worker)
686 {
687  ocean_assert(ySource != nullptr && uSource != nullptr && vSource != nullptr && target != nullptr);
688 
689  ocean_assert(width >= 2u && width % 2u == 0u);
690  ocean_assert(height >= 2u && height % 2u == 0u);
691 
692  if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
693  {
694  return;
695  }
696 
697  const unsigned int options[4] = {ySourcePaddingElements, uSourcePaddingElements, vSourcePaddingElements, targetPaddingElements};
698 
699  const void* sources[3] =
700  {
701  ySource,
702  uSource,
703  vSource
704  };
705 
706  FrameConverter::convertArbitraryPixelFormat(sources, (void**)(&target), width, height, flag, 2u, FrameConverter::mapTwoRows_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane3Channels_8BitPerChannel<0u, 1u, 2u>, options, worker);
707 }
708 
709 inline void FrameConverterY_U_V12::convertY_U_V12ToYVU24(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker* worker)
710 {
711  ocean_assert(ySource != nullptr && uSource != nullptr && vSource != nullptr && target != nullptr);
712 
713  ocean_assert(width >= 2u && width % 2u == 0u);
714  ocean_assert(height >= 2u && height % 2u == 0u);
715 
716  if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
717  {
718  return;
719  }
720 
721  const unsigned int options[4] = {ySourcePaddingElements, uSourcePaddingElements, vSourcePaddingElements, targetPaddingElements};
722 
723  const void* sources[3] =
724  {
725  ySource,
726  uSource,
727  vSource
728  };
729 
730  FrameConverter::convertArbitraryPixelFormat(sources, (void**)(&target), width, height, flag, 2u, FrameConverter::mapTwoRows_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane3Channels_8BitPerChannel<0u, 2u, 1u>, options, worker);
731 }
732 
733 inline void FrameConverterY_U_V12::convertY_U_V12ToY_UV12(const uint8_t* ySource, const uint8_t* uSource, const uint8_t* vSource, uint8_t* yTarget, uint8_t* uvTarget, const unsigned int width, const unsigned int height, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int yTargetPaddingElements, const unsigned int uvTargetPaddingElements, const unsigned int ySourcePixelStride, const unsigned int uSourcePixelStride, const unsigned int vSourcePixelStride, Worker* worker)
734 {
735  ocean_assert(ySource != nullptr && uSource != nullptr && vSource != nullptr);
736  ocean_assert(yTarget != nullptr && uvTarget != nullptr);
737 
738  if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
739  {
740  ocean_assert(false && "Invalid parameters!");
741  return;
742  }
743 
744  const uint32_t options[8] = {ySourcePaddingElements, uSourcePaddingElements, vSourcePaddingElements, yTargetPaddingElements, uvTargetPaddingElements, ySourcePixelStride, uSourcePixelStride, vSourcePixelStride};
745 
746  const void* sources[3] =
747  {
748  ySource,
749  uSource,
750  vSource
751  };
752 
753  void* targets[2] =
754  {
755  yTarget,
756  uvTarget
757  };
758 
759  FrameConverter::convertArbitraryPixelFormat(sources, targets, width, height, CONVERT_NORMAL, 2u, mapY_U_V12ToY_UV12, options, worker);
760 }
761 
762 }
763 
764 }
765 
766 #endif // META_OCEAN_CV_FRAME_CONVERTER_Y_U_V_12_H
This is the base class for all frame converter classes.
Definition: FrameConverter.h:32
ConversionFlag
Definition of individual conversion flags.
Definition: FrameConverter.h:39
@ CONVERT_NORMAL
Normal conversion, neither flips nor mirrors the image.
Definition: FrameConverter.h:49
static void convertOneRow_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane4Channels_8BitPerChannel_Precision6Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts one row of an image with e.g., a Y_U_V12 pixel format to one row of an image with e....
static void convertTwoRows_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane3Channels_8BitPerChannel_Precision10Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts two rows of an image with e.g., a Y_U_V12 pixel format to two rows of an image with e....
static void convertArbitraryPixelFormat(const void **sources, void **targets, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int multipleRowsPerIteration, const MultipleRowsConversionFunction multipleRowsConversionFunction, const void *options, Worker *worker)
Converts a frame with arbitrary pixel format (e.g., Y_UV12, Y_VU12, YUYV16, ...) to a frame with arbi...
Definition: FrameConverter.h:3234
static void convertTwoRows_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane3Channels_8BitPerChannel_Precision6Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts two rows of an image with e.g., a Y_U_V12 pixel format to two rows of an image with e....
This class provides functions to convert frames with Y_U_V12 pixel format.
Definition: FrameConverterY_U_V12.h:32
static void convertY_U_V12LimitedRangeToRGB24FullRangePrecision6Bit(const uint8_t *ySource, const uint8_t *uSource, const uint8_t *vSource, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Converts a Y_U_V12 frame to a 24 bit RGB frame into a second image buffer (with 6 bit precision).
Definition: FrameConverterY_U_V12.h:527
static void convertY_U_V12LimitedRangeToBGR24FullRange(const uint8_t *ySource, const uint8_t *uSource, const uint8_t *vSource, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Converts a Y_U_V12 frame to a 24 bit BGR frame into a second image buffer using BT....
Definition: FrameConverterY_U_V12.h:347
static void convertY_U_V12ToYUV24(const uint8_t *ySource, const uint8_t *uSource, const uint8_t *vSource, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Converts a Y_U_V12 frame to a 24 bit YUV frame into a second image buffer.
Definition: FrameConverterY_U_V12.h:685
static void convertY_U_V12FullRangeToRGB24FullRangePrecision6Bit(const uint8_t *ySource, const uint8_t *uSource, const uint8_t *vSource, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Converts a Y_U_V12 frame to a 24 bit RGB frame into a second image buffer.
Definition: FrameConverterY_U_V12.h:573
static void convertY_U_V12LimitedRangeToRGBA32FullRangePrecision6Bit(const uint8_t *ySource, const uint8_t *uSource, const uint8_t *vSource, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, const uint8_t alphaValue=0xFF, Worker *worker=nullptr)
Converts a Y_U_V12 frame to an 32 bit RGBA frame into a second image buffer.
Definition: FrameConverterY_U_V12.h:619
static void convertOneRowY_U_V12ToRGBA32Precision6Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts one row of an image with Y_U_V12 pixel format to one row of an image with RGBA32 pixel forma...
static void convertY_U_V12ToYVU24(const uint8_t *ySource, const uint8_t *uSource, const uint8_t *vSource, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Converts a Y_U_V12 frame to a 24 bit YVU frame into a second image buffer.
Definition: FrameConverterY_U_V12.h:709
static void convertY_U_V12FullRangeToBGR24FullRangePrecision6Bit(const uint8_t *ySource, const uint8_t *uSource, const uint8_t *vSource, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Converts a Y_U_V12 frame to a 24 bit BGR frame into a second image buffer using BT....
Definition: FrameConverterY_U_V12.h:393
static void convertY_U_V12LimitedRangeToRGB24FullRange(const uint8_t *ySource, const uint8_t *uSource, const uint8_t *vSource, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Converts a Y_U_V12 frame to a 24 bit RGB frame into a second image buffer.
Definition: FrameConverterY_U_V12.h:481
static void convertY_U_V12ToY_U_V12(const uint8_t *ySource, const uint8_t *uSource, const uint8_t *vSource, uint8_t *yTarget, uint8_t *uTarget, uint8_t *vTarget, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int yTargetPaddingElements, const unsigned int uTargetPaddingElements, const unsigned int vTargetPaddingElements, Worker *worker=nullptr)
Converts a Y_U_V12 frame to a Y_U_V12 frame into a second image buffer.
Definition: FrameConverterY_U_V12.h:324
static void mapY_U_V12ToY_UV12(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts two rows of an image with Y_U_V12 pixel format to two rows of an image with a Y_UV12 pixel f...
static void convertY_U_V12ToY_UV12(const uint8_t *ySource, const uint8_t *uSource, const uint8_t *vSource, uint8_t *yTarget, uint8_t *uvTarget, const unsigned int width, const unsigned int height, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int yTargetPaddingElements, const unsigned int uvTargetPaddingElements, const unsigned int ySourcePixelStride=1u, const unsigned int uSourcePixelStride=1u, const unsigned int vSourcePixelStride=1u, Worker *worker=nullptr)
Converts a Y_U_V12 frame to a Y_UV12 frame into a second image buffer.
Definition: FrameConverterY_U_V12.h:733
static void convertY_U_V12ToY8(const uint8_t *ySource, const uint8_t *uSource, const uint8_t *vSource, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Converts a Y_U_V12 frame to an 8 bit gray scale frame into a second image buffer.
Definition: FrameConverterY_U_V12.h:339
static void convertY_U_V12LimitedRangeToBGRA32FullRangePrecision6Bit(const uint8_t *ySource, const uint8_t *uSource, const uint8_t *vSource, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int ySourcePaddingElements, const unsigned int uSourcePaddingElements, const unsigned int vSourcePaddingElements, const unsigned int targetPaddingElements, const uint8_t alphaValue=0xFF, Worker *worker=nullptr)
Converts a Y_U_V12 frame to an 32 bit BGRA frame into a second image buffer (with 6 bit precision).
Definition: FrameConverterY_U_V12.h:439
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