8 #ifndef META_OCEAN_CV_FRAME_CONVERTER_Y_8_H
9 #define META_OCEAN_CV_FRAME_CONVERTER_Y_8_H
77 static inline void convertY8ToBGR24(
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 convertY8ToRGB24(
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 convertY8ToRGBA32(
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);
117 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);
135 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);
151 ocean_assert(source !=
nullptr && target !=
nullptr);
152 ocean_assert(width >= 1u && height >= 1u);
158 constexpr
unsigned int shufflePattern = 0x000u;
160 FrameChannels::shuffleChannels<uint8_t, 1u, 3u, shufflePattern>(source, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
165 ocean_assert(source !=
nullptr && target !=
nullptr);
166 ocean_assert(width >= 1u && height >= 1u);
172 constexpr
unsigned int shufflePattern = 0x000u;
174 FrameChannels::shuffleChannels<uint8_t, 1u, 3u, shufflePattern>(source, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
177 inline void FrameConverterY8::convertY8ToRGBA32(
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,
Worker* worker)
179 ocean_assert(source !=
nullptr && target !=
nullptr);
180 ocean_assert(width >= 1u && height >= 1u);
186 constexpr
unsigned int shufflePattern = 0x000u;
188 FrameChannels::shuffleChannelsAndSetLastChannelValue<uint8_t, 1u, 4u, shufflePattern>(source, alphaValue, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
193 ocean_assert(source !=
nullptr && target !=
nullptr);
194 ocean_assert(width >= 1u && height >= 1u);
196 FrameChannels::transformGeneric<uint8_t, 1u>(source, target, width, height, flag, sourcePaddingElements, targetPaddingElements, worker);
201 ocean_assert(source !=
nullptr && target !=
nullptr);
202 ocean_assert(width >= 1u && height >= 1u);
204 ocean_assert(gamma > 0.0f && gamma < 2.0f);
206 const unsigned int sourceStrideElements = width + sourcePaddingElements;
207 const unsigned int targetStrideElements = width + targetPaddingElements;
211 const bool areContinuous = sourcePaddingElements == 0u && targetPaddingElements == 0u;
213 FrameConverter::convertGenericPixelFormat(source, target, width, height, sourceStrideElements, targetStrideElements, flag,
convertRowY8ToY8GammaLUT, CV::FrameChannels::reverseRowPixelOrderInPlace<uint8_t, 1u>, areContinuous, options, worker);
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
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 convertY8ToRGB24(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 RGB 24 bit frame.
Definition: FrameConverterY8.h:163
static void convertY8ToRGBA32(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 frame to a RGBA 32 bit frame.
Definition: FrameConverterY8.h:177
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.
Definition: FrameConverterY8.h:191
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:199
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 convertY8ToBGR24(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 BGR 24 bit frame.
Definition: FrameConverterY8.h:149
This class implements a recursive lock object.
Definition: Lock.h:31
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