8 #ifndef META_OCEAN_CV_FRAME_CONVERTER_YVU_24_H
9 #define META_OCEAN_CV_FRAME_CONVERTER_YVU_24_H
43 static inline void convertYVU24ToBGR24(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
Worker* worker =
nullptr);
56 static inline void convertYVU24ToRGB24(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
Worker* worker =
nullptr);
69 static inline void convertYVU24ToY8(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
Worker* worker =
nullptr);
82 static inline void convertYVU24ToYUV24(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
Worker* worker =
nullptr);
95 static inline void convertYVU24ToYVU24(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
Worker* worker =
nullptr);
112 static inline void convertYVU24ToY_V_U12(
const uint8_t* source, uint8_t* yTarget, uint8_t* vTarget, uint8_t* uTarget,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int yTargetPaddingElements,
const unsigned int vTargetPaddingElements,
const unsigned int uTargetPaddingElements,
Worker* worker =
nullptr);
123 static inline void convertYVU24ToRGB24Pixel(
const uint8_t y,
const uint8_t v,
const uint8_t u, uint8_t& r, uint8_t& g, uint8_t& b);
128 ocean_assert(source !=
nullptr && target !=
nullptr);
129 ocean_assert(width >= 1u && height >= 1u);
131 const unsigned int sourceStrideElements = width * 3u + sourcePaddingElements;
132 const unsigned int targetStrideElements = width * 3u + targetPaddingElements;
146 const int parameters[12] = {1192, 1192, 1192, 0, -833, 1634, 2066, -400, 0, -277, 135, -223};
148 const bool areContinuous = sourcePaddingElements == 0u && targetPaddingElements == 0u;
150 FrameConverter::convertGenericPixelFormat(source, target, width, height, sourceStrideElements, targetStrideElements, flag,
CV::FrameChannels::convertRow3ChannelsTo3Channels8BitPerChannel10BitPrecision, CV::FrameChannels::reverseRowPixelOrderInPlace<uint8_t, 3u>, areContinuous, parameters, worker);
155 ocean_assert(source !=
nullptr && target !=
nullptr);
156 ocean_assert(width >= 1u && height >= 1u);
158 const unsigned int sourceStrideElements = width * 3u + sourcePaddingElements;
159 const unsigned int targetStrideElements = width * 3u + targetPaddingElements;
173 const int parameters[12] = {1192, 1192, 1192, 1634, -833, 0, 0, -400, 2066, -223, 135, -277};
175 const bool areContinuous = sourcePaddingElements == 0u && targetPaddingElements == 0u;
177 FrameConverter::convertGenericPixelFormat(source, target, width, height, sourceStrideElements, targetStrideElements, flag,
CV::FrameChannels::convertRow3ChannelsTo3Channels8BitPerChannel10BitPrecision, CV::FrameChannels::reverseRowPixelOrderInPlace<uint8_t, 3u>, areContinuous, parameters, worker);
182 ocean_assert(source !=
nullptr && target !=
nullptr);
183 ocean_assert(width >= 1u && height >= 1u);
189 constexpr
unsigned int shufflePattern = 0x0u;
191 FrameChannels::shuffleChannels<uint8_t, 3u, 1u, shufflePattern>(source, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
196 ocean_assert(source !=
nullptr && target !=
nullptr);
197 ocean_assert(width >= 1u && height >= 1u);
203 constexpr
unsigned int shufflePattern = 0x120u;
205 FrameChannels::shuffleChannels<uint8_t, 3u, 3u, shufflePattern>(source, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
210 ocean_assert(source !=
nullptr && target !=
nullptr);
211 ocean_assert(width >= 1u && height >= 1u);
213 FrameChannels::transformGeneric<uint8_t, 3u>(source, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
216 inline void FrameConverterYVU24::convertYVU24ToY_V_U12(
const uint8_t* source, uint8_t* yTarget, uint8_t* vTarget, uint8_t* uTarget,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const unsigned int sourcePaddingElements,
const unsigned int yTargetPaddingElements,
const unsigned int vTargetPaddingElements,
const unsigned int uTargetPaddingElements,
Worker* worker)
218 ocean_assert(source !=
nullptr && yTarget !=
nullptr && vTarget !=
nullptr && uTarget !=
nullptr);
220 ocean_assert(width >= 2u && width % 2u == 0u);
221 ocean_assert(height >= 2u && height % 2u == 0u);
223 if (width < 2u || height < 2u || width % 2u != 0u || height % 2u != 0u)
228 const unsigned int options[4] = {sourcePaddingElements, yTargetPaddingElements, vTargetPaddingElements, uTargetPaddingElements};
237 FrameConverter::convertArbitraryPixelFormat((
const void**)(&source), targets, width, height, flag, 2u, FrameConverter::mapTwoRows_1Plane3Channels_To_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_8BitPerChannel<0u, 1u, 2u>, options, worker);
242 const int y_ = (y - 16) * 298 + 128;
243 const int v_ = v - 128;
244 const int u_ = u - 128;
246 r = (uint8_t)(
minmax(0, (y_ + 409 * v_) >> 8, 255));
247 g = (uint8_t)(
minmax(0, (y_ - 100 * u_ - 208 * v_) >> 8, 255));
248 b = (uint8_t)(
minmax(0, (y_ + 516 * u_) >> 8, 255));
static void convertRow3ChannelsTo3Channels8BitPerChannel10BitPrecision(const uint8_t *source, uint8_t *target, const size_t size, const void *parameters)
Converts a row of pixels with 3 channels to pixels with 3 channels by a linear combination of the thr...
This is the base class for all frame converter classes.
Definition: FrameConverter.h:32
ConversionFlag
Definition of individual conversion flags.
Definition: FrameConverter.h:39
static void convertGenericPixelFormat(const TSource *source, TTarget *target, const unsigned int width, const unsigned int height, const unsigned int sourceStrideElements, const unsigned int targetStrideElements, const ConversionFlag flag, const RowConversionFunction< TSource, TTarget > rowConversionFunction, const RowReversePixelOrderInPlaceFunction< TTarget > targetReversePixelOrderInPlaceFunction, const bool areContinuous, const void *options, Worker *worker)
Converts a frame with generic pixel format (e.g., RGBA32, BGR24, YUV24, ...) to a frame with generic ...
Definition: FrameConverter.h:3211
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
This class provides functions to convert frames with YVU24 pixel format to other pixel formats.
Definition: FrameConverterYVU24.h:29
static void convertYVU24ToRGB24Pixel(const uint8_t y, const uint8_t v, const uint8_t u, uint8_t &r, uint8_t &g, uint8_t &b)
Converts one YVU 24 bit pixel to a RGB 24 bit pixel.
Definition: FrameConverterYVU24.h:240
static void convertYVU24ToBGR24(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Converts a YVU 24 bit frame to a BGR 24 bit frame using the conversion.
Definition: FrameConverterYVU24.h:126
static void convertYVU24ToY_V_U12(const uint8_t *source, uint8_t *yTarget, uint8_t *vTarget, uint8_t *uTarget, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int yTargetPaddingElements, const unsigned int vTargetPaddingElements, const unsigned int uTargetPaddingElements, Worker *worker=nullptr)
Converts a YVU 24 bit frame to a Y_V_U 12 bit frame using the conversion.
Definition: FrameConverterYVU24.h:216
static void convertYVU24ToRGB24(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Converts a YVU 24 bit frame to a RGB 24 bit frame using the conversion.
Definition: FrameConverterYVU24.h:153
static void convertYVU24ToYVU24(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Converts a YVU 24 bit frame to a YVU 24 bit frame using the conversion.
Definition: FrameConverterYVU24.h:208
static void convertYVU24ToY8(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Converts a YVU 24 bit frame to a Y 8 bit frame using the conversion.
Definition: FrameConverterYVU24.h:180
static void convertYVU24ToYUV24(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Converts a YVU 24 bit frame to a YUV 24 bit frame using the conversion.
Definition: FrameConverterYVU24.h:194
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
T minmax(const T &lowerBoundary, const T &value, const T &upperBoundary)
This function fits a given parameter into a specified value range.
Definition: base/Utilities.h:903
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15