8#ifndef META_OCEAN_CV_FRAME_CONVERTER_Y_8_H
9#define META_OCEAN_CV_FRAME_CONVERTER_Y_8_H
77 static inline void convertY8FullRangeToBGR24(
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);
90 static inline void convertY8FullRangeToRGB24(
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);
104 static inline void convertY8FullRangeToRGBA32(
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,
const uint8_t alphaValue = 0xFF,
Worker* worker =
nullptr);
119 template <
unsigned int tPrecision = 10u>
120 static inline void convertY8LimitedRangeToRGB24(
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);
136 template <
unsigned int tPrecision = 10u>
137 static inline void convertY8LimitedRangeToRGBA32(
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,
const uint8_t alphaValue = 0xFF,
Worker* worker =
nullptr);
150 static inline void convertY8ToY8(
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);
168 static inline void convertY8ToY8GammaLUT(
const uint8_t*
const source, uint8_t*
const target,
const unsigned int width,
const unsigned int height,
const ConversionFlag flag,
const float gamma,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
Worker* worker =
nullptr);
182 template <
unsigned int tPrecision = 10u>
183 static inline void convertY8LimitedRangeToY8FullRange(
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);
197 template <
unsigned int tPrecision = 10u>
198 static inline void convertY8FullRangeToY8LimitedRange(
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);
214 ocean_assert(source !=
nullptr && target !=
nullptr);
215 ocean_assert(width >= 1u && height >= 1u);
221 constexpr unsigned int shufflePattern = 0x000u;
223 FrameChannels::shuffleChannels<uint8_t, 1u, 3u, shufflePattern>(source, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
228 ocean_assert(source !=
nullptr && target !=
nullptr);
229 ocean_assert(width >= 1u && height >= 1u);
235 constexpr unsigned int shufflePattern = 0x000u;
237 FrameChannels::shuffleChannels<uint8_t, 1u, 3u, shufflePattern>(source, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
242 ocean_assert(source !=
nullptr && target !=
nullptr);
243 ocean_assert(width >= 1u && height >= 1u);
249 constexpr unsigned int shufflePattern = 0x000u;
251 FrameChannels::shuffleChannelsAndSetLastChannelValue<uint8_t, 1u, 4u, shufflePattern>(source, alphaValue, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
256 ocean_assert(source !=
nullptr && target !=
nullptr);
257 ocean_assert(width >= 1u && height >= 1u);
259 FrameChannels::transformGeneric<uint8_t, 1u>(source, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
264 ocean_assert(source !=
nullptr && target !=
nullptr);
265 ocean_assert(width >= 1u && height >= 1u);
267 ocean_assert(gamma > 0.0f && gamma < 2.0f);
277 const unsigned int sourceStrideElements = width + sourcePaddingElements;
278 const unsigned int targetStrideElements = width + targetPaddingElements;
282 const bool areContinuous = sourcePaddingElements == 0u && targetPaddingElements == 0u;
284 FrameConverter::convertGenericPixelFormat(source, target, width, height, sourceStrideElements, targetStrideElements, flag,
convertRowY8ToY8GammaLUT, CV::FrameChannels::reverseRowPixelOrderInPlace<uint8_t, 1u>, areContinuous, options, worker);
287template <
unsigned int tPrecision>
290 static_assert(tPrecision == 6u || tPrecision == 10u,
"Precision must be 6 or 10");
292 ocean_assert(source !=
nullptr && target !=
nullptr);
293 ocean_assert(width >= 1u && height >= 1u);
296 const int32_t options[5] =
298 int32_t(sourcePaddingElements),
299 int32_t(targetPaddingElements),
301 tPrecision == 6u ? int32_t(75) : int32_t(1192),
306 const void* sources[1] = {source};
307 void* targets[1] = {target};
309 if constexpr (tPrecision == 6u)
319template <
unsigned int tPrecision>
322 static_assert(tPrecision == 6u || tPrecision == 10u,
"Precision must be 6 or 10");
324 ocean_assert(source !=
nullptr && target !=
nullptr);
325 ocean_assert(width >= 1u && height >= 1u);
328 const int32_t options[5] =
330 int32_t(sourcePaddingElements),
331 int32_t(targetPaddingElements),
333 tPrecision == 6u ? int32_t(55) : int32_t(879),
338 const void* sources[1] = {source};
339 void* targets[1] = {target};
341 if constexpr (tPrecision == 6u)
351template <
unsigned int tPrecision>
354 static_assert(tPrecision == 6u || tPrecision == 10u,
"Precision must be 6 or 10");
356 ocean_assert(source !=
nullptr && target !=
nullptr);
357 ocean_assert(width >= 1u && height >= 1u);
360 const int32_t options[5] =
362 int32_t(sourcePaddingElements),
363 int32_t(targetPaddingElements),
365 tPrecision == 6u ? int32_t(75) : int32_t(1192),
370 const void* sources[1] = {source};
371 void* targets[1] = {target};
373 if constexpr (tPrecision == 6u)
383template <
unsigned int tPrecision>
386 static_assert(tPrecision == 6u || tPrecision == 10u,
"Precision must be 6 or 10");
388 ocean_assert(source !=
nullptr && target !=
nullptr);
389 ocean_assert(width >= 1u && height >= 1u);
392 const int32_t options[6] =
394 int32_t(sourcePaddingElements),
395 int32_t(targetPaddingElements),
397 tPrecision == 6u ? int32_t(75) : int32_t(1192),
403 const void* sources[1] = {source};
404 void* targets[1] = {target};
406 if constexpr (tPrecision == 6u)
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 convertOneRow_1Plane1Channel_To_1Plane4Channels_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 one row of a single-channel image to a 4-channel image with 10-bit precision and range conve...
static void convertOneRow_1Plane1Channel_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 a single-channel image to a 4-channel image with 6-bit precision and range conver...
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:3483
static void convertOneRow_1Plane1Channel_To_1Plane1Channel_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 one row of a single-channel image to another single-channel image with 10-bit precision.
static void convertOneRow_1Plane1Channel_To_1Plane1Channel_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 a single-channel image to another single-channel image with 6-bit precision.
static void convertOneRow_1Plane1Channel_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 one row of a single-channel image to a 3-channel image with 6-bit precision and range conver...
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:3506
static void convertOneRow_1Plane1Channel_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 one row of a single-channel image to a 3-channel image with 10-bit precision and range conve...
This class implements the manager for lookup tables.
Definition FrameConverterY8.h:36
LookupTables lookupTables_
The lookup tables.
Definition FrameConverterY8.h:58
std::unordered_map< float, Memory > LookupTables
Definition of a map mapping gamma values to the memory of lookup tables.
Definition FrameConverterY8.h:40
const uint8_t * lookupTable(const float gamma)
Returns the lookup table for a gamma compression/correction function.
Lock lock_
The lock of the manager.
Definition FrameConverterY8.h:61
This class provides functions to convert frames with Y8 pixel format.
Definition FrameConverterY8.h:29
static void convertY8FullRangeToY8LimitedRange(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 Y8 full range frame [0, 255] to a Y8 limited range frame [16, 235].
Definition FrameConverterY8.h:320
static void convertY8LimitedRangeToRGB24(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 Y8 limited range frame [16, 235] to an RGB24 (full range) frame [0, 255].
Definition FrameConverterY8.h:352
static void convertY8FullRangeToBGR24(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 Y 8 bit full range [0, 255] frame to a BGR 24 bit frame.
Definition FrameConverterY8.h:212
static void convertY8LimitedRangeToY8FullRange(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 Y8 limited range frame [16, 235] to a Y8 full range frame [0, 255].
Definition FrameConverterY8.h:288
static void convertY8ToY8(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 Y 8 bit frame to a Y 8 bit frame, either limited range to limited range or full range to f...
Definition FrameConverterY8.h:254
static void convertY8ToY8GammaLUT(const uint8_t *const source, uint8_t *const target, const unsigned int width, const unsigned int height, const ConversionFlag flag, const float gamma, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Converts a Y8 frame to a Y8 frame by applying gamma compression/correction using a lookup table,...
Definition FrameConverterY8.h:262
static void convertRowY8ToY8GammaLUT(const uint8_t *source, uint8_t *target, const size_t size, const void *parameters)
Converts a Y8 row to a Y8 row by applying gamma compression/correction with a lookup table.
static void convertY8FullRangeToRGBA32(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, const uint8_t alphaValue=0xFF, Worker *worker=nullptr)
Converts a Y 8 bit full range [0, 255] frame to a RGBA 32 bit frame.
Definition FrameConverterY8.h:240
static void convertY8LimitedRangeToRGBA32(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, const uint8_t alphaValue=0xFF, Worker *worker=nullptr)
Converts a Y8 limited range frame [16, 235] to an RGBA32 (full range) frame [0, 255].
Definition FrameConverterY8.h:384
static void convertY8FullRangeToRGB24(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 Y 8 bit full range [0, 255] frame to a RGB 24 bit frame.
Definition FrameConverterY8.h:226
This class implements a recursive lock object.
Definition Lock.h:31
static bool isEqual(const T first, const T second)
Returns whether two values are equal up to a small epsilon.
Definition Numeric.h:2395
This template class is the base class for all singleton objects.
Definition Singleton.h:71
static LookupTableManager & get()
Returns a reference to the unique object.
Definition Singleton.h:115
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