Ocean
Ocean::FrameType Class Reference

Definition of a frame type composed by the frame dimension, pixel format and pixel origin. More...

Inheritance diagram for Ocean::FrameType:

Data Structures

class  GenericPixelFormat
 This class implements a helper class allowing to create generic pixel formats. More...
 
struct  PixelFormatProperties
 Helper struct allowing to get access to the properties of a pixel format with a debugger. More...
 
union  PixelFormatUnion
 This union mainly contains the pixel format as value. More...
 

Public Types

enum  DataType : uint8_t {
  DT_UNDEFINED = 0u , DT_UNSIGNED_INTEGER_8 , DT_SIGNED_INTEGER_8 , DT_UNSIGNED_INTEGER_16 ,
  DT_SIGNED_INTEGER_16 , DT_UNSIGNED_INTEGER_32 , DT_SIGNED_INTEGER_32 , DT_UNSIGNED_INTEGER_64 ,
  DT_SIGNED_INTEGER_64 , DT_SIGNED_FLOAT_16 , DT_SIGNED_FLOAT_32 , DT_SIGNED_FLOAT_64 ,
  DT_END
}
 Definition of individual channel data type. More...
 
enum  PixelFormat : uint64_t {
  FORMAT_UNDEFINED = 0ull , FORMAT_ABGR32 = 1ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_4, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_ARGB32 = 2ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_4, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_BGR24 = 3ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_3, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value ,
  FORMAT_BGR32 = 4ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_4, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_BGR4444 = 5ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_16, CV_CHANNELS_UNDEFINED , PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_BGR5551 = 6ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_16, CV_CHANNELS_UNDEFINED , PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_BGR565 = 7ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_16, CV_CHANNELS_UNDEFINED , PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value ,
  FORMAT_BGRA32 = 8ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_4, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_BGRA4444 = 9ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_16, CV_CHANNELS_UNDEFINED , PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_BGGR10_PACKED = 10ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_UNDEFINED , PV_PLANES_1, MV_MULTIPLE_4, MV_MULTIPLE_2>::value , FORMAT_RGB24 = 11ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_3, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value ,
  FORMAT_RGB32 = 12ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_4, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_RGB4444 = 13ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_16, CV_CHANNELS_UNDEFINED , PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_RGB5551 = 14ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_16, CV_CHANNELS_UNDEFINED , PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_RGB565 = 15ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_16, CV_CHANNELS_UNDEFINED , PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value ,
  FORMAT_RGBA32 = 16ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_4, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_RGBA4444 = 17ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_16, CV_CHANNELS_UNDEFINED , PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_RGBT32 = 18ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_4, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_RGGB10_PACKED = 19ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_UNDEFINED , PV_PLANES_1, MV_MULTIPLE_4, MV_MULTIPLE_2>::value ,
  FORMAT_Y_U_V12 = 20ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_UNDEFINED , PV_PLANES_3, MV_MULTIPLE_2, MV_MULTIPLE_2>::value , FORMAT_YUV24 = 21ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_3, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_YUVA32 = 22ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_4, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_YUVT32 = 23ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_4, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value ,
  FORMAT_Y_V_U12 = 24ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_UNDEFINED , PV_PLANES_3, MV_MULTIPLE_2, MV_MULTIPLE_2>::value , FORMAT_YVU24 = 25ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_3, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_Y_UV12 = 26ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_UNDEFINED , PV_PLANES_2, MV_MULTIPLE_2, MV_MULTIPLE_2>::value , FORMAT_Y_VU12 = 27ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_UNDEFINED , PV_PLANES_2, MV_MULTIPLE_2, MV_MULTIPLE_2>::value ,
  FORMAT_YUYV16 = 28ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_UNDEFINED , PV_PLANES_1, MV_MULTIPLE_2, MV_MULTIPLE_1>::value , FORMAT_UYVY16 = 29ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_UNDEFINED , PV_PLANES_1, MV_MULTIPLE_2, MV_MULTIPLE_1>::value , FORMAT_Y8 = 30ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_1, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_Y10 = 31ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_16, CV_CHANNELS_1, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value ,
  FORMAT_Y10_PACKED = 32ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_UNDEFINED , PV_PLANES_1, MV_MULTIPLE_4, MV_MULTIPLE_1>::value , FORMAT_Y16 = 33ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_16, CV_CHANNELS_1, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_Y32 = 34ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_32, CV_CHANNELS_1, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_Y64 = 35ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_64, CV_CHANNELS_1, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value ,
  FORMAT_YA16 = 36ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_2, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_RGB48 = 37ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_16, CV_CHANNELS_3, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_RGBA64 = 38ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_16, CV_CHANNELS_4, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_Y_U_V24 = 39ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_UNDEFINED , PV_PLANES_3, MV_MULTIPLE_1, MV_MULTIPLE_1>::value ,
  FORMAT_Y_U_V24_LIMITED_RANGE = FORMAT_Y_U_V24 , FORMAT_Y_U_V24_FULL_RANGE = 40ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_UNDEFINED , PV_PLANES_3, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_Y8_LIMITED_RANGE = 41ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_1, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_Y8_FULL_RANGE = FORMAT_Y8 ,
  FORMAT_Y_UV12_LIMITED_RANGE = FORMAT_Y_UV12 , FORMAT_Y_UV12_FULL_RANGE = 42ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_UNDEFINED , PV_PLANES_2, MV_MULTIPLE_2, MV_MULTIPLE_2>::value , FORMAT_Y_VU12_LIMITED_RANGE = FORMAT_Y_VU12 , FORMAT_Y_VU12_FULL_RANGE = 43ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_UNDEFINED , PV_PLANES_2, MV_MULTIPLE_2, MV_MULTIPLE_2>::value ,
  FORMAT_Y_U_V12_LIMITED_RANGE = FORMAT_Y_U_V12 , FORMAT_Y_U_V12_FULL_RANGE = 44ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_UNDEFINED , PV_PLANES_3, MV_MULTIPLE_2, MV_MULTIPLE_2>::value , FORMAT_Y_V_U12_LIMITED_RANGE = FORMAT_Y_V_U12 , FORMAT_Y_V_U12_FULL_RANGE = 45ull | GenericPixelFormat<DT_UNSIGNED_INTEGER_8, CV_CHANNELS_UNDEFINED , PV_PLANES_3, MV_MULTIPLE_2, MV_MULTIPLE_2>::value ,
  FORMAT_F32 = 46ull | GenericPixelFormat<DT_SIGNED_FLOAT_32, CV_CHANNELS_1, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_F64 = 47ull | GenericPixelFormat<DT_SIGNED_FLOAT_64, CV_CHANNELS_1, PV_PLANES_1, MV_MULTIPLE_1, MV_MULTIPLE_1>::value , FORMAT_END = 48ull
}
 Definition of all pixel formats available in the Ocean framework. More...
 
enum  PixelOrigin : uint32_t { ORIGIN_INVALID = 0u , ORIGIN_UPPER_LEFT , ORIGIN_LOWER_LEFT }
 Defines different types of frame origin positions. More...
 
using DataTypes = std::vector< DataType >
 Definition of a vector holding data types. More...
 
using PixelFormats = std::vector< PixelFormat >
 Definition of a vector holding pixel formats. More...
 

Public Member Functions

 FrameType ()=default
 Creates a new frame type with invalid parameters. More...
 
 FrameType (const unsigned int width, const unsigned int height, const PixelFormat pixelFormat, const PixelOrigin pixelOrigin)
 Creates a new frame type. More...
 
 FrameType (const FrameType &type, const unsigned int width, const unsigned int height)
 Creates a new frame type. More...
 
 FrameType (const FrameType &type, const PixelFormat pixelFormat)
 Creates a new frame type. More...
 
 FrameType (const FrameType &type, const PixelOrigin pixelOrigin)
 Creates a new frame type. More...
 
 FrameType (const FrameType &type, const PixelFormat pixelFormat, const PixelOrigin pixelOrigin)
 Creates a new frame type. More...
 
unsigned int width () const
 Returns the width of the frame format in pixel. More...
 
unsigned int height () const
 Returns the height of the frame in pixel. More...
 
PixelFormat pixelFormat () const
 Returns the pixel format of the frame. More...
 
void setPixelFormat (const PixelFormat pixelFormat)
 Explicitly changes the pixel format of this frame. More...
 
DataType dataType () const
 Returns the data type of the pixel format of this frame. More...
 
unsigned int bytesPerDataType () const
 Returns the number of bytes which are necessary to store the data type of this frame. More...
 
unsigned int channels () const
 Returns the number of individual channels the frame has. More...
 
uint32_t numberPlanes () const
 Returns the number of planes of the pixel format of this frame. More...
 
PixelOrigin pixelOrigin () const
 Returns the pixel origin of the frame. More...
 
unsigned int pixels () const
 Returns the number of pixels for the frame. More...
 
unsigned int frameTypeSize () const
 Returns the number of bytes necessary for the frame type, without padding at the end of frame rows. More...
 
bool isPixelFormatCompatible (const PixelFormat pixelFormat) const
 Returns whether the pixel format of this frame type is compatible with a given pixel format. More...
 
bool isFrameTypeCompatible (const FrameType &frameType, const bool allowDifferentPixelOrigins) const
 Returns whether this frame type is compatible with a given frame type. More...
 
bool operator== (const FrameType &right) const
 Returns whether two frame types are equal. More...
 
bool operator!= (const FrameType &right) const
 Returns whether two frame types are not equal. More...
 
bool operator< (const FrameType &right) const
 Returns whether the left frame type is 'smaller' than the right one. More...
 
bool isValid () const
 Returns whether this frame type is valid. More...
 
template<FrameType::DataType tDataType, uint32_t tChannels, uint32_t tPlanes, uint32_t tWidthMultiple, uint32_t tHeightMultiple>
constexpr FrameType::PixelFormat genericPixelFormat ()
 
template<FrameType::DataType tDataType>
constexpr FrameType::PixelFormat genericPixelFormat (const uint32_t channels, const uint32_t planes, const uint32_t widthMultiple, const uint32_t heightMultiple)
 

Static Public Member Functions

static unsigned int channels (const PixelFormat pixelFormat)
 Returns the number of individual channels of a given pixel format. More...
 
static uint32_t numberPlanes (const PixelFormat pixelFormat)
 Returns the number of planes of a pixel format. More...
 
template<typename T >
static constexpr DataType dataType ()
 Returns the (pixel format) data type of a given C++ data type. More...
 
static DataType dataType (const PixelFormat pixelFormat)
 Returns the data type of a pixel format. More...
 
static unsigned int bytesPerDataType (const DataType dataType)
 Returns the number of bytes which are necessary to store a specified data type. More...
 
static constexpr PixelFormat genericPixelFormat (const DataType dataType, const uint32_t channels, const uint32_t planes=1u, const uint32_t widthMultiple=1u, const uint32_t heightMultiple=1u)
 Returns a specific generic pixel format with a specified data type, channel number, and plane number. More...
 
static PixelFormat genericPixelFormat (const unsigned int bitsPerPixelChannel, const uint32_t channels, const uint32_t planes=1u, const uint32_t widthMultiple=1u, const uint32_t heightMultiple=1u)
 Returns a specific generic pixel format with specified bit per pixel per channel, channel number, and plane number. More...
 
template<DataType tDataType, uint32_t tChannels, uint32_t tPlanes = 1u, uint32_t tWidthMultiple = 1u, uint32_t tHeightMultiple = 1u>
constexpr static PixelFormat genericPixelFormat ()
 Returns a specific generic pixel format with a specified data type and channel number. More...
 
template<DataType tDataType>
constexpr static PixelFormat genericPixelFormat (const uint32_t channels, const uint32_t planes=1u, const uint32_t widthMultiple=1u, const uint32_t heightMultiple=1u)
 Returns a specific generic pixel format with a specified data type and channel number. More...
 
template<typename TDataType , uint32_t tChannels, uint32_t tPlanes = 1u, uint32_t tWidthMultiple = 1u, uint32_t tHeightMultiple = 1u>
constexpr static PixelFormat genericPixelFormat ()
 Returns a specific generic pixel format with a specified data type and channel number. More...
 
template<typename TDataType >
constexpr static PixelFormat genericPixelFormat (uint32_t channels, const uint32_t planes=1u, const uint32_t widthMultiple=1u, const uint32_t heightMultiple=1u)
 Returns a specific generic pixel format with a specified data type and channel number. More...
 
static PixelFormat makeGenericPixelFormat (const PixelFormat pixelFormat)
 Converts a any pixel format into a generic one This function has no effect for input pixel formats which are already generic. More...
 
static bool formatIsGeneric (const PixelFormat pixelFormat, const DataType dataType, const uint32_t channels, const uint32_t planes=1u, const uint32_t widthMultiple=1u, const uint32_t heightMultiple=1u)
 Checks whether a given pixel format is a specific layout regarding data channels and data type. More...
 
static bool formatIsGeneric (const PixelFormat pixelFormat)
 Checks whether a given pixel format is a generic pixel format. More...
 
static bool formatIsPureGeneric (const PixelFormat pixelFormat)
 Checks whether a given pixel format is a pure generic pixel format. More...
 
static unsigned int formatGenericNumberChannels (const PixelFormat pixelFormat)
 Returns the number of individual channels of a given generic pixel format. More...
 
static unsigned int formatGenericBitsPerPixel (const PixelFormat pixelFormat)
 Returns the number of bits of one pixel for a given generic pixel format. More...
 
static unsigned int formatBitsPerPixelRedChannel (const PixelFormat pixelFormat)
 Returns the number of bits of one pixel for the red channel. More...
 
static unsigned int formatBitsPerPixelGreenChannel (const PixelFormat pixelFormat)
 Returns the number of bits of one pixel for the green channel. More...
 
static unsigned int formatBitsPerPixelBlueChannel (const PixelFormat pixelFormat)
 Returns the number of bits of one pixel for the blue channel. More...
 
static unsigned int formatBitsPerPixelAlphaChannel (const PixelFormat pixelFormat)
 Returns the number of bits of one pixel for the alpha channel. More...
 
static bool formatHasAlphaChannel (const PixelFormat pixelFormat, bool *isLastChannel=nullptr)
 Returns whether a given pixel format holds an alpha channel. More...
 
static bool formatIsPacked (const PixelFormat pixelFormat)
 Returns whether a given pixel format is a packed pixel format. More...
 
static PixelFormat genericSinglePlanePixelFormat (const PixelFormat pixelFormat)
 Returns the most suitable 1-plane pixel format for a given pixel format which may be composed of several planes. More...
 
static PixelFormat formatAddAlphaChannel (const PixelFormat pixelFormat, const bool lastChannel=true)
 Adds an alpha channel to a given pixel format. More...
 
static PixelFormat formatRemoveAlphaChannel (const PixelFormat pixelFormat)
 Removes an alpha channel from a given pixel format. More...
 
static unsigned int widthMultiple (const PixelFormat pixelFormat)
 Returns the number of pixels the width of a frame must be a multiple of. More...
 
static unsigned int heightMultiple (const PixelFormat pixelFormat)
 Returns the number of pixels the height of a frame must be a multiple of. More...
 
static unsigned int planeChannels (const PixelFormat &imagePixelFormat, const unsigned int planeIndex)
 Returns the channels of a plane for a pixel format. More...
 
static unsigned int planeBytesPerPixel (const PixelFormat &imagePixelFormat, const unsigned int planeIndex)
 Returns the number of bytes of one pixel of a plane for a pixel format. More...
 
static bool planeLayout (const PixelFormat imagePixelFormat, const unsigned int imageWidth, const unsigned int imageHeight, const unsigned int planeIndex, unsigned int &planeWidth, unsigned int &planeHeight, unsigned int &planeChannels, unsigned int *planeWidthElementsMultiple=nullptr, unsigned int *planeHeightElementsMultiple=nullptr)
 Returns the plane layout of a given pixel format. More...
 
static bool planeLayout (const FrameType &frameType, const unsigned int planeIndex, unsigned int &planeWidth, unsigned int &planeHeight, unsigned int &planeChannels, unsigned int *planeWidthElementsMultiple=nullptr, unsigned int *planeHeightElementsMultiple=nullptr)
 Returns the plane layout of a given frame type. More...
 
static DataType translateDataType (const std::string &dataType)
 Translates a string containing a data type into the data type. More...
 
static PixelFormat translatePixelFormat (const std::string &pixelFormat)
 Translates a string containing a pixel format into the pixel format. More...
 
static PixelOrigin translatePixelOrigin (const std::string &pixelOrigin)
 Translates a string containing the pixel origin into the pixel origin value. More...
 
static std::string translateDataType (const DataType dataType)
 Translates a data type value into a string containing the data type. More...
 
static std::string translatePixelFormat (const PixelFormat pixelFormat)
 Translates a pixel format value into a string containing the pixel format. More...
 
static std::string translatePixelOrigin (const PixelOrigin pixelOrigin)
 Translates a pixel origin value into a string containing the pixel origin. More...
 
static PixelFormat findPixelFormat (const unsigned int bitsPerPixel)
 Returns a best fitting pixel format having the given number of bits per pixels. More...
 
static PixelFormat findPixelFormat (const DataType dataType, const unsigned int channels)
 Returns a best fitting pixel format having the given number of bits per pixels. More...
 
static bool arePixelFormatsCompatible (const PixelFormat pixelFormatA, const PixelFormat pixelFormatB)
 Returns whether two given pixel formats are compatible. More...
 
static bool areFrameTypesCompatible (const FrameType &frameTypeA, const FrameType &frameTypeB, const bool allowDifferentPixelOrigins)
 Returns whether two given frame types are compatible. More...
 
template<typename T >
static bool dataIsAligned (const void *data)
 Returns whether a given pointer has the same byte alignment as the size of the data type the pointer is pointing to. More...
 
static const FrameType::DataTypesdefinedDataTypes ()
 Returns all defined data types. More...
 
static const FrameType::PixelFormatsdefinedPixelFormats ()
 Returns all defined pixel formats. More...
 
template<>
constexpr FrameType::DataType dataType ()
 
template<>
constexpr FrameType::DataType dataType ()
 
template<>
constexpr FrameType::DataType dataType ()
 
template<>
constexpr FrameType::DataType dataType ()
 
template<>
constexpr FrameType::DataType dataType ()
 
template<>
constexpr FrameType::DataType dataType ()
 
template<>
constexpr FrameType::DataType dataType ()
 
template<>
constexpr FrameType::DataType dataType ()
 
template<>
constexpr FrameType::DataType dataType ()
 
template<>
constexpr FrameType::DataType dataType ()
 
template<>
constexpr FrameType::DataType dataType ()
 
template<>
constexpr FrameType::DataType dataType ()
 
template<>
constexpr FrameType::DataType dataType ()
 

Protected Types

enum  ChannelsValue : uint32_t {
  CV_CHANNELS_UNDEFINED = 0u , CV_CHANNELS_1 = 1u , CV_CHANNELS_2 = 2u , CV_CHANNELS_3 = 3u ,
  CV_CHANNELS_4 = 4u
}
 Definition of a protected helper enum that simplifies to read the definition of a predefined pixel format. More...
 
enum  PlanesValue : uint32_t { PV_PLANES_1 = 1u , PV_PLANES_2 = 2u , PV_PLANES_3 = 3u , PV_PLANES_4 = 4u }
 Definition of a protected helper enum that simplifies to read the definition of a predefined pixel format. More...
 
enum  MultipleValue : uint32_t { MV_MULTIPLE_1 = 1u , MV_MULTIPLE_2 = 2u , MV_MULTIPLE_3 = 3u , MV_MULTIPLE_4 = 4u }
 Definition of a protected helper enum that simplifies to read the definition of a predefined pixel format. More...
 

Static Protected Attributes

static constexpr uint32_t pixelFormatBitOffsetChannels = 16u
 The number of bits the channel value is shifted within the PixelFormat value. More...
 
static constexpr uint32_t pixelFormatBitOffsetDatatype = pixelFormatBitOffsetChannels + 8u
 The number of bits the data type value is shifted within the PixelFormat value. More...
 
static constexpr uint32_t pixelFormatBitOffsetPlanes = pixelFormatBitOffsetDatatype + 8u
 The number of bits the planes value is shifted within the PixelFormat value. More...
 
static constexpr uint32_t pixelFormatBitOffsetWidthMultiple = pixelFormatBitOffsetPlanes + 8u
 The number of bits the width-multiple value is shifted within the PixelFormat value. More...
 
static constexpr uint32_t pixelFormatBitOffsetHeightMultiple = pixelFormatBitOffsetWidthMultiple + 8u
 The number of bits the height-multiple value is shifted within the PixelFormat value. More...
 

Private Attributes

unsigned int width_ = 0u
 Frame width in pixel, with range [0, infinity) More...
 
unsigned int height_ = 0u
 Frame height in pixel, with range [0, infinity) More...
 
PixelFormatUnion pixelFormat_ = PixelFormatUnion(FORMAT_UNDEFINED)
 The pixel format of the frame encapsulated in a union (mainly holding PixelFormat). More...
 
PixelOrigin pixelOrigin_ = ORIGIN_INVALID
 The origin of the pixel data, either the upper left corner or the bottom left corner (if valid). More...
 

Detailed Description

Definition of a frame type composed by the frame dimension, pixel format and pixel origin.

The frame dimension of a frame specifies the number of pixels in horizontal (width) and vertical (height) direction.
The pixel format specifies which kind of image information is stored.
The pixel origin defines whether the image data starts at the top left corner or at the bottom left corner.

Member Typedef Documentation

◆ DataTypes

using Ocean::FrameType::DataTypes = std::vector<DataType>

Definition of a vector holding data types.

◆ PixelFormats

Definition of a vector holding pixel formats.

Member Enumeration Documentation

◆ ChannelsValue

enum Ocean::FrameType::ChannelsValue : uint32_t
protected

Definition of a protected helper enum that simplifies to read the definition of a predefined pixel format.

Enumerator
CV_CHANNELS_UNDEFINED 

An invalid channel number, used for non-generic pixel formats.

CV_CHANNELS_1 

One channel.

CV_CHANNELS_2 

Two channels.

CV_CHANNELS_3 

Three channels.

CV_CHANNELS_4 

Four channels.

◆ DataType

Definition of individual channel data type.

Enumerator
DT_UNDEFINED 

Undefined data type.

DT_UNSIGNED_INTEGER_8 

Unsigned 8 bit integer data type (uint8_t).

DT_SIGNED_INTEGER_8 

Signed 8 bit integer data type (int8_t).

DT_UNSIGNED_INTEGER_16 

Unsigned 16 bit integer data type (uint16_t).

DT_SIGNED_INTEGER_16 

Signed 16 bit integer data type (int16_t).

DT_UNSIGNED_INTEGER_32 

Unsigned 32 bit integer data type (uint32_t).

DT_SIGNED_INTEGER_32 

Signed 232 bit integer data type (int32_t).

DT_UNSIGNED_INTEGER_64 

Unsigned 64 bit integer data type (uint64_t).

DT_SIGNED_INTEGER_64 

Signed 64 bit integer data type (int64_t).

DT_SIGNED_FLOAT_16 

Signed 16 bit float data type.

DT_SIGNED_FLOAT_32 

Signed 32 bit float data type (float).

DT_SIGNED_FLOAT_64 

Signed 64 bit float data type (double).

DT_END 

The helper data type which can be used to identify the last defined data type, DT_END is exclusive.

◆ MultipleValue

enum Ocean::FrameType::MultipleValue : uint32_t
protected

Definition of a protected helper enum that simplifies to read the definition of a predefined pixel format.

Enumerator
MV_MULTIPLE_1 

The size can have any value (as the value must be a multiple of 1).

MV_MULTIPLE_2 

The size must have a multiple of 2.

MV_MULTIPLE_3 

The size must have a multiple of 3.

MV_MULTIPLE_4 

The size must have a multiple of 4.

◆ PixelFormat

Definition of all pixel formats available in the Ocean framework.

Several common pixel formats are predefined specifying a unique representation of the image information of a frame.
Further, generic pixel formats can be defined. Generic formats can have up to 31 zipped data channels and can be composed of any kind of data type.
The value of a pixel format can be separated into individual parts.
The lower two bytes can be used for predefined pixel formats.
The third byte define the number of data channels of all generic zipped pixel formats.
The fourth byte define the data type.
The fifth byte holds the number of planes.
The sixth byte holds the number of pixels the width of a frame must be a multiple of.
The seventh byte holds the number of pixels the height of a frame must be a multiple of:

Byte:   |     7      |         6         |         5        |     4      |       3      |       2        |      1      |      0      |
        |   unused   |  height-multiple  |  width-multiple  |   planes   |   data type  | channel number |  predefined pixel format  |

A generic zipped pixel format may have the same data layout compared to a predefined pixel format while the actual value of the pixel format may be different.

The naming convention of predefined pixel formats is:
Left to right is equivalent from first to last bytes in memory.
For example RGB24 stored the red color value in the first byte and the blue color value in the last byte.
BGRA32 stores the blue color value in the first byte, green in the second bytes, red in the third byte and the alpha value in the last byte.

The following code can be used to define a generic pixel format, in case the predefined pixel formats in 'PixelFormat' do not have the desired format:

// define a used-defined pixel format with three double values per channel
const FrameType::PixelFormat newPixelFormat = FrameType::genericPixelFormat<double, 3u>();
PixelFormat
Definition of all pixel formats available in the Ocean framework.
Definition: Frame.h:183
Enumerator
FORMAT_UNDEFINED 

Undefined pixel format.

FORMAT_ABGR32 

Pixel format with byte order ABGR and 32 bits per pixel.

Here is the memory layout:

  Pixel:  0                                1
   Byte:  0       1       2       3        4
    Bit:  0123456789ABCDEF0123456789ABCDEF 01234567
Channel:  0       1       2       3        0
  Color:  AAAAAAAABBBBBBBBGGGGGGGGRRRRRRRR AAAAAAAA ........
FORMAT_ARGB32 

Pixel format with byte order ARGB and 32 bits per pixel.

Here is the memory layout:

  Pixel:  0                                1
   Byte:  0       1       2       3        4
    Bit:  0123456789ABCDEF0123456789ABCDEF 01234567
Channel:  0       1       2       3        0
  Color:  AAAAAAAARRRRRRRRGGGGGGGGBBBBBBBB AAAAAAAA ........
FORMAT_BGR24 

Pixel format with byte order BGR and 24 bits per pixel.

Here is the memory layout:

  Pixel:  0                        1                        2
   Byte:  0       1        2       3       4       5        6
    Bit:  0123456789ABCDEF01234567 89ABCDEF0123456789ABCDEF 01234567
Channel:  0       1       2        0       1       2        0
  Color:  BBBBBBBBGGGGGGGGRRRRRRRR BBBBBBBBGGGGGGGGRRRRRRRR BBBBBBBB ........
FORMAT_BGR32 

Pixel format with byte order BGR and 24 bits per pixel and 8 unused bits.

Here is the memory layout:

  Pixel:  0                                1
   Byte:  0       1       2       3        4
    Bit:  0123456789ABCDEF0123456789ABCDEF 01234567
Channel:  0       1       2                0
  Color:  BBBBBBBBGGGGGGGGRRRRRRRR         BBBBBBBB ........
FORMAT_BGR4444 

Pixel format with entirely 16 bits per pixel, 12 bits for BGR and 4 unused bits.

FORMAT_BGR5551 

Pixel format with entirely 16 bits per pixel, 15 bits for BGR and 1 unused bit.

FORMAT_BGR565 

Pixel format with 16 bits per pixel, 5 bits for blue, 6 bits for green and 5 bits for red.

Here is the memory layout:

  Pixel:  0                1                2
   Byte:  0       1        2       3        4
    Bit:  0123456789ABCDEF 0123456789ABCDEF 01234
Channel:  0    1     2     0    1     2     0
  Color:  BBBBBGGGGGGRRRRR BBBBBGGGGGGRRRRR BBBBB ........

This pixel format is equivalent to the following pixel formats on Android (note the inverse order or RGB):
Native code: ANDROID_BITMAP_FORMAT_RGB_565, Java: Bitmap.Config.RGB_565.

FORMAT_BGRA32 

Pixel format with byte order BGRA and 32 bits per pixel.

Here is the memory layout:

  Pixel:  0                                1
   Byte:  0       1       2       3        4
    Bit:  0123456789ABCDEF0123456789ABCDEF 01234567
Channel:  0       1       2       3        0
  Color:  BBBBBBBBGGGGGGGGRRRRRRRRAAAAAAAA BBBBBBBB ........
FORMAT_BGRA4444 

Pixel format with entirely 16 bits per pixel, 4 bits for each channel.

FORMAT_BGGR10_PACKED 

The packed pixel format representing a Bayer mosaic pattern for images with blue, green, and red channels with order BGGR for a 2x2 pixel block.

The format has the byte order B G for the upper two pixels, and G R for the lower two pixels in a 2x2 pixel block.
Images with this pixel format have a resolution which is a multiple of 4x2 pixels.
The Pixel format stores 10 bits per pixel (and channel), packed so that four consecutive pixels fit into five bytes.
The higher 8 bits of each pixel are stored in the first four bytes, the lower 2 bits of all four pixels are stored in the fifth byte.
Here is the memory layout:

  Pixel:        0        1        2        3        0 1 2 3    4        5        6        7        4 5 6 7
   Byte:        0        1        2        3        4          5        6        7        8        9
    Bit:        01234567 89ABCDEF 01234567 89ABCDEF 01234567   01234567 89ABCDEF 01234567 89ABCDEF 01234567
Channel: row 0: 0        1        0        1        0 1 0 1    0        1        0        1        0 1 0 1
Channel: row 1: 1        2        1        2        1 2 1 2    1        2        1        2        1 2 1 2
  Color: row 1: BBBBBBBB GGGGGGGG BBBBBBBB GGGGGGGG BBGGBBGG   BBBBBBBB GGGGGGGG BBBBBBBB GGGGGGGG BBGGBBGG ........
  Color: row 0: GGGGGGGG RRRRRRRR GGGGGGGG RRRRRRRR GGRRGGRR   GGGGGGGG RRRRRRRR GGGGGGGG RRRRRRRR GGRRGGRR ........
  Color: row 2: BBBBBBBB GGGGGGGG ........
FORMAT_RGB24 

Pixel format with byte order RGB and 24 bits per pixel.

Here is the memory layout:

  Pixel:  0                        1                        2
   Byte:  0       1        2       3       4       5        6
    Bit:  0123456789ABCDEF01234567 89ABCDEF0123456789ABCDEF 01234567
Channel:  0       1       2        0       1       2        0
  Color:  RRRRRRRRGGGGGGGGBBBBBBBB RRRRRRRRGGGGGGGGBBBBBBBB RRRRRRRR ........
FORMAT_RGB32 

Pixel format with byte order RGB and 24 bits per pixel and 8 unused bits.

Here is the memory layout:

  Pixel:  0                                1
   Byte:  0       1       2       3        4
    Bit:  0123456789ABCDEF0123456789ABCDEF 01234567
Channel:  0       1       2                0
  Color:  RRRRRRRRGGGGGGGGBBBBBBBB         RRRRRRRR ........
FORMAT_RGB4444 

Pixel format with entirely 16 bits per pixel, 12 bits for RGB and 4 unused bits.

Here is the memory layout:

  Pixel:  0                1                2
   Byte:  0       1        2       3        4
    Bit:  0123456789ABCDEF 0123456789ABCDEF 01234
Channel:  0    1     2     0    1     2     0
  Color:  RRRRGGGGBBBB     RRRRGGGGBBBB     RRRRR ........
FORMAT_RGB5551 

Pixel format with entirely 16 bits per pixel, 15 bits for RGB and 1 unused bit.

Here is the memory layout:

  Pixel:  0                1                2
   Byte:  0       1        2       3        4
    Bit:  0123456789ABCDEF 0123456789ABCDEF 01234
Channel:  0    1     2     0    1     2     0
  Color:  RRRRRGGGGGBBBBB  RRRRRGGGGGBBBBB  RRRRR ........
FORMAT_RGB565 

Pixel format with entirely 16 bits per pixel, 5 bits for red, 6 bits for green and 5 bits for blue.

Here is the memory layout:

  Pixel:  0                1                2
   Byte:  0       1        2       3        4
    Bit:  0123456789ABCDEF 0123456789ABCDEF 01234
Channel:  0    1     2     0    1     2     0
  Color:  RRRRRGGGGGGBBBBB RRRRRGGGGGGBBBBB RRRRR ........
FORMAT_RGBA32 

Pixel format with byte order RGBA and 32 bits per pixel.

Here is the memory layout:

  Pixel:  0                                1
   Byte:  0       1       2       3        4
    Bit:  0123456789ABCDEF0123456789ABCDEF 01234567
Channel:  0       1       2       3        0
  Color:  RRRRRRRRGGGGGGGGBBBBBBBBAAAAAAAA RRRRRRRR ........

This pixel format is equivalent to the following pixel formats on Android (note the inverse order of ARGB):
Native code: ANDROID_BITMAP_FORMAT_RGBA_8888, Java: Bitmap.Config.ARGB_8888.

FORMAT_RGBA4444 

Pixel format with entirely 16 bits per pixel, 4 bits for each channel.

Here is the memory layout:

  Pixel:  0                1                2
   Byte:  0       1        2       3        4
    Bit:  0123456789ABCDEF 0123456789ABCDEF 01234
Channel:  0    1     2     0    1     2     0
  Color:  RRRRGGGGBBBBAAAA RRRRGGGGBBBBAAAA RRRRR ........
FORMAT_RGBT32 

Pixel format with byte order RGBT and 24 bits for the RGB channels and 8 bits for an arbitrary texture channel.

Here is the memory layout:

  Pixel:  0                                1
   Byte:  0       1       2       3        4
    Bit:  0123456789ABCDEF0123456789ABCDEF 01234567
Channel:  0       1       2       3        0
  Color:  RRRRRRRRGGGGGGGGBBBBBBBBTTTTTTTT RRRRRRRR ........
FORMAT_RGGB10_PACKED 

The packed pixel format representing a Bayer mosaic pattern for images with red, green, and blue channels with order RGGB for a 2x2 pixel block.

The format has the byte order R G for the upper two pixels, and G B for the lower two pixels in a 2x2 pixel block.
Images with this pixel format have a resolution which is a multiple of 4x2 pixels.
The Pixel format stores 10 bits per pixel (and channel), packed so that four consecutive pixels fit into five bytes.
The higher 8 bits of each pixel are stored in the first four bytes, the lower 2 bits of all four pixels are stored in the fifth byte.
Here is the memory layout:

  Pixel:        0        1        2        3        0 1 2 3    4        5        6        7        4 5 6 7
   Byte:        0        1        2        3        4          5        6        7        8        9
    Bit:        01234567 89ABCDEF 01234567 89ABCDEF 01234567   01234567 89ABCDEF 01234567 89ABCDEF 01234567
Channel: row 0: 0        1        0        1        0 1 0 1    0        1        0        1        0 1 0 1
Channel: row 1: 1        2        1        2        1 2 1 2    1        2        1        2        1 2 1 2
  Color: row 0: RRRRRRRR GGGGGGGG RRRRRRRR GGGGGGGG RRGGRRGG   RRRRRRRR GGGGGGGG RRRRRRRR GGGGGGGG RRGGRRGG ........
  Color: row 1: GGGGGGGG BBBBBBBB GGGGGGGG BBBBBBBB GGBBGGBB   GGGGGGGG BBBBBBBB GGGGGGGG BBBBBBBB GGBBGGBB ........
  Color: row 2: RRRRRRRR GGGGGGGG ........
FORMAT_Y_U_V12 

Pixel format with 8 bits Y frame as individual block, followed by 8 bits 2x2 sub-sampled U frame and 8 bits 2x2 sub-sampled V frame, both as individual blocks, resulting in 12 bits per pixel.

Sometimes also denoted as 'I420'.

The memory layout of a Y_U_V12 image looks like this:

 y-plane:        u-plane:      v-plane:
 ---------       -----         -----
| Y Y Y Y |     | U U |       | V V |
| Y Y Y Y |     | U U |       | V V |
| Y Y Y Y |      -----         -----
| Y Y Y Y |
 ---------

Width and height must be even (multiple of two).

FORMAT_YUV24 

Pixel format with byte order YUV and 24 bits per pixel.

Here is the memory layout:

  Pixel:  0                        1                        2
   Byte:  0       1       2        3       4       5        6
    Bit:  0123456789ABCDEF01234567 89ABCDEF0123456789ABCDEF 01234567
Channel:  0       1       2        0       1       2        0
  Color:  YYYYYYYYUUUUUUUUVVVVVVVV YYYYYYYYUUUUUUUUVVVVVVVV YYYYYYYY ........
FORMAT_YUVA32 

Pixel format with byte order YUVA and 32 bits per pixel.

Here is the memory layout:

  Pixel:  0                                1
   Byte:  0       1       2       3        4
    Bit:  0123456789ABCDEF0123456789ABCDEF 01234567
Channel:  0       1       2       3        0
  Color:  YYYYYYYYUUUUUUUUVVVVVVVVAAAAAAAA YYYYYYYY ........
FORMAT_YUVT32 

Pixel format with byte order YUVA and 24 bits for the YUV channels and 8 bit for an arbitrary texture channel.

FORMAT_Y_V_U12 

Pixel format with 8 bits Y frame as individual block, followed by 8 bits 2x2 sub-sampled V frame and 8 bits 2x2 sub-sampled U frame, both as individual blocks, resulting in 12 bits per pixel.

Sometimes also denoted as 'YV12'.

The memory layout of a Y_V_U12 image looks like this:

 y-plane:        v-plane:      u-plane:
 ---------       -----         -----
| Y Y Y Y |     | V V |       | U U |
| Y Y Y Y |     | V V |       | U U |
| Y Y Y Y |      -----         -----
| Y Y Y Y |
 ---------

Width and height must be even (multiple of two).

FORMAT_YVU24 

Pixel format with byte order YVU and 24-bits per pixel.

Here is the memory layout:

  Pixel:  0                        1                        2
   Byte:  0       1       2        3       4       5        6
    Bit:  0123456789ABCDEF01234567 89ABCDEF0123456789ABCDEF 01234567
Channel:  0       1       2        0       1       2        0
  Color:  YYYYYYYYVVVVVVVVUUUUUUUU YYYYYYYYVVVVVVVVUUUUUUUU YYYYYYYY ........
FORMAT_Y_UV12 

This pixel format is deprecated and is currently an alias for FORMAT_Y_UV12_LIMITED_RANGE.

Pixel format with 8 bits Y frame as entire block, followed by 8 bits 2x2 sub-sampled U and V zipped (interleaved) pixels, resulting in 12 bits per pixel. Sometimes also denoted as 'NV12'.

The memory layout of a Y_UV12 image looks like this:

 y-plane:        u/v-plane:
 ---------       ---------
| Y Y Y Y |     | U V U V |
| Y Y Y Y |     | U V U V |
| Y Y Y Y |      ---------
| Y Y Y Y |
 ---------

Width and height must be even (multiple of two).

FORMAT_Y_VU12 

Pixel format with 8 bits Y frame as entire block, followed by 8 bits 2x2 sub-sampled V and U zipped (interleaved) pixels, resulting in 12 bits per pixel.

Sometimes also denoted as 'NV21'.

The memory layout of a Y_VU12 image looks like this:

 y-plane:        v/u-plane:
 ---------       ---------
| Y Y Y Y |     | V U V U |
| Y Y Y Y |     | V U V U |
| Y Y Y Y |      ---------
| Y Y Y Y |
 ---------

Width and height must be even (multiple of two).

FORMAT_YUYV16 

Pixel format with 8 bit Y pixel values zipped (interleaved) with 8 bits 2x1 (horizontal) sub-sampled U and V pixel values respectively, resulting in 16 bits per pixel.

Sometimes also denoted as 'YUY2'.

The memory layout of a YUYV16 image looks like this:

 y/u/v-plane:
 -----------------
| Y U Y V Y U Y V |
| Y U Y V Y U Y V |
| Y U Y V Y U Y V |
| Y U Y V Y U Y V |
 -----------------

The width must be even (multiple of two).

FORMAT_UYVY16 

Pixel format with 8 bit Y pixel values zipped (interleaved) with 8 bits 2x1 (horizontal) sub-sampled U and V pixel values respectively, resulting in 16 bits per pixel.

Sometimes also denoted as 'UYVY'.

The memory layout of a UYVY16 image looks like this:

 y/u/v-plane:
 -----------------
| U Y V Y U Y V Y |
| U Y V Y U Y V Y |
| U Y V Y U Y V Y |
| U Y V Y U Y V Y |
 -----------------

The width must be even (multiple of two).

FORMAT_Y8 

Pixel format for grayscale images with byte order Y and 8 bits per pixel.

Here is the memory layout:

  Pixel:  0        1
   Byte:  0        1
    Bit:  01234567 89ABCDEF
Channel:  0        0
  Color:  YYYYYYYY YYYYYYYY ........
FORMAT_Y10 

Pixel format with byte order Y and 10 bits per pixel, the upper 6 bits are unused.

Here is the memory layout:

  Pixel:  0                 1
   Byte:  0        1        2        3
    Bit:  01234567 89ABCDEF 01234567 89ABCDEF
Channel:  0                 0
  Color:  YYYYYYYY YY       YYYYYYYY YY       ........
FORMAT_Y10_PACKED 

Pixel format with byte order Y and 10 bits per pixel, packed so that four consecutive pixels fit into five bytes.

The higher 8 bits of each pixel are stored in the first four bytes, the lower 2 bits of all four pixels are stored in the fifth byte. Here is the memory layout:

  Pixel:  0        1        2        3        0 1 2 3    4        5        6        7        4 5 6 7
   Byte:  0        1        2        3        4          5        6        7        8        9
    Bit:  01234567 89ABCDEF 01234567 89ABCDEF 01234567   01234567 89ABCDEF 01234567 89ABCDEF 01234567
Channel:  0        0        0        0        0 0 0 0    0        0        0        0        0 0 0 0
  Color:  YYYYYYYY YYYYYYYY YYYYYYYY YYYYYYYY YYYYYYYY   YYYYYYYY YYYYYYYY YYYYYYYY YYYYYYYY YYYYYYYY ........
FORMAT_Y16 

Pixel format with 16 bits Y frame.

Here is the memory layout:

  Pixel:  0                1                2
   Byte:  0        1       2       3        4
    Bit:  0123456789ABCDEF 0123456789ABCDEF 01
Channel:  0                0
  Color:  YYYYYYYYYYYYYYYY YYYYYYYYYYYYYYYY YY ........
FORMAT_Y32 

Pixel format with 32 bits Y frame.

FORMAT_Y64 

Pixel format with 64 bits Y frame.

FORMAT_YA16 

Pixel format with byte order YA and 16 bits per pixel.

FORMAT_RGB48 

Pixel format with byte order RGB and 48 bits per pixel, with 16 bit per component.

Here is the memory layout:

  Pixel:  0                                                1
   Byte:  0       1       2       3       4       5        6       7
    Bit:  0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF 0123456789ABCDEF
Channel:  0               1               2                0
  Color:  RRRRRRRRRRRRRRRRGGGGGGGGGGGGGGGGBBBBBBBBBBBBBBBB RRRRRRRRRRRRRRRR ........
FORMAT_RGBA64 

Pixel format with byte order RGBA and 64 bits per pixel, with 16 bit per component.

Here is the memory layout:

  Pixel:  0                                                                1
   Byte:  0       1       2       3       4       5       6       7        8       9
    Bit:  0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF 0123456789ABCDEF
Channel:  0               1               2               3                0
  Color:  RRRRRRRRRRRRRRRRGGGGGGGGGGGGGGGGBBBBBBBBBBBBBBBBAAAAAAAAAAAAAAAA RRRRRRRRRRRRRRRR ........
FORMAT_Y_U_V24 

This pixel format is deprecated and is currently an alias for FORMAT_Y_U_V24_LIMITED_RANGE.

Pixel format with 8 bits Y frame as individual block, followed 8 bits U frame as individual block, followed by a V frame as individual block, resulting in 24 bits per pixel. Sometimes also denoted as 'I444'.

The memory layout of a Y_U_V24 image looks like this:

 y-plane:        u-plane:        v-plane:
 ---------       ---------       ---------
| Y Y Y Y |     | U U U U |     | V V V V |
| Y Y Y Y |     | U U U U |     | V V V V |
| Y Y Y Y |     | U U U U |     | V V V V |
| Y Y Y Y |     | U U U U |     | V V V V |
 ---------       ---------       ---------
FORMAT_Y_U_V24_LIMITED_RANGE 

Pixel format with 8 bits Y frame as individual block, followed 8 bits U frame as individual block, followed by a V frame as individual block, resulting in 24 bits per pixel.

Sometimes also denoted as 'I444'.

The pixel format is using a limited value range for the individual channels:

Y channel: [16, 235]
U channel: [16, 240]
V channel: [16, 240]

The memory layout of a Y_U_V24 image looks like this:

 y-plane:        u-plane:        v-plane:
 ---------       ---------       ---------
| Y Y Y Y |     | U U U U |     | V V V V |
| Y Y Y Y |     | U U U U |     | V V V V |
| Y Y Y Y |     | U U U U |     | V V V V |
| Y Y Y Y |     | U U U U |     | V V V V |
 ---------       ---------       ---------
See also
FORMAT_Y_U_V24_FULL_RANGE.
FORMAT_Y_U_V24_FULL_RANGE 

Pixel format with 8 bits Y frame as individual block, followed 8 bits U frame as individual block, followed by a V frame as individual block, resulting in 24 bits per pixel.

Sometimes also denoted as 'I444'.

The pixel format is using a full value range for all three channels:

Y channel: [0, 255]
U channel: [0, 255]
V channel: [0, 255]

The memory layout of a Y_U_V24 image looks like this:

 y-plane:        u-plane:        v-plane:
 ---------       ---------       ---------
| Y Y Y Y |     | U U U U |     | V V V V |
| Y Y Y Y |     | U U U U |     | V V V V |
| Y Y Y Y |     | U U U U |     | V V V V |
| Y Y Y Y |     | U U U U |     | V V V V |
 ---------       ---------       ---------
See also
FORMAT_Y_U_V24_LIMITED_RANGE.
FORMAT_Y8_LIMITED_RANGE 

Pixel format for grayscale images with byte order Y and 8 bits per pixel (with limited range).

The pixel format is using a limited value range:

Y channel: [16, 235]

Here is the memory layout:

  Pixel:  0        1
   Byte:  0        1
    Bit:  01234567 89ABCDEF
Channel:  0        0
  Color:  YYYYYYYY YYYYYYYY ........
See also
FORMAT_Y8_FULL_RANGE.
FORMAT_Y8_FULL_RANGE 

Pixel format for grayscale images with byte order Y and 8 bits per pixel (with full range).

The pixel format is using a full value range:

Y channel: [0, 255]

Here is the memory layout:

  Pixel:  0        1
   Byte:  0        1
    Bit:  01234567 89ABCDEF
Channel:  0        0
  Color:  YYYYYYYY YYYYYYYY ........
See also
FORMAT_Y8_LIMITED_RANGE.
FORMAT_Y_UV12_LIMITED_RANGE 

Pixel format with 8 bits Y frame as entire block, followed by 8 bits 2x2 sub-sampled U and V zipped (interleaved) pixels, resulting in 12 bits per pixel.

Sometimes also denoted as 'NV12'.

The pixel format is using a limited value range for all three channels:

Y channel: [16, 235]
U channel: [16, 240]
V channel: [16, 240]

The memory layout of a Y_UV12 image looks like this:

 y-plane:        u/v-plane:
 ---------       ---------
| Y Y Y Y |     | U V U V |
| Y Y Y Y |     | U V U V |
| Y Y Y Y |      ---------
| Y Y Y Y |
 ---------
See also
FORMAT_Y_UV12_FULL_RANGE.
FORMAT_Y_UV12_FULL_RANGE 

Pixel format with 8 bits Y frame as entire block, followed by 8 bits 2x2 sub-sampled U and V zipped (interleaved) pixels, resulting in 12 bits per pixel.

Sometimes also denoted as 'NV12'.

The pixel format is using a full value range for all three channels:

Y channel: [0, 255]
U channel: [0, 255]
V channel: [0, 255]

The memory layout of a Y_UV12 image looks like this:

 y-plane:        u/v-plane:
 ---------       ---------
| Y Y Y Y |     | U V U V |
| Y Y Y Y |     | U V U V |
| Y Y Y Y |      ---------
| Y Y Y Y |
 ---------
See also
FORMAT_Y_UV12_LIMITED_RANGE. Width and height must be even (multiple of two).
FORMAT_Y_VU12_LIMITED_RANGE 

Pixel format with 8 bits Y frame as entire block, followed by 8 bits 2x2 sub-sampled V and U zipped (interleaved) pixels, resulting in 12 bits per pixel.

Sometimes also denoted as 'NV21'.

The pixel format is using a limited value range for all three channels:

Y channel: [16, 235]
V channel: [16, 240]
U channel: [16, 240]

The memory layout of a Y_VU12 image looks like this:

 y-plane:        u/v-plane:
 ---------       ---------
| Y Y Y Y |     | V U V U |
| Y Y Y Y |     | V U V U |
| Y Y Y Y |      ---------
| Y Y Y Y |
 ---------
See also
FORMAT_Y_VU12_FULL_RANGE.
FORMAT_Y_VU12_FULL_RANGE 

Pixel format with 8 bits Y frame as entire block, followed by 8 bits 2x2 sub-sampled V and U zipped (interleaved) pixels, resulting in 12 bits per pixel.

Sometimes also denoted as 'NV21'.

The pixel format is using a full value range for all three channels:

Y channel: [0, 255]
V channel: [0, 255]
U channel: [0, 255]

The memory layout of a Y_VU12 image looks like this:

 y-plane:        u/v-plane:
 ---------       ---------
| Y Y Y Y |     | V U V U |
| Y Y Y Y |     | V U V U |
| Y Y Y Y |      ---------
| Y Y Y Y |
 ---------
See also
FORMAT_Y_VU12_LIMITED_RANGE. Width and height must be even (multiple of two).
FORMAT_Y_U_V12_LIMITED_RANGE 

Pixel format with 8 bits Y frame as individual block, followed by 8 bits 2x2 sub-sampled U frame and 8 bits 2x2 sub-sampled V frame, both as individual blocks, resulting in 12 bits per pixel.

Sometimes also denoted as 'I420'.

The pixel format is using a limited value range for all three channels:

Y channel: [16, 235]
V channel: [16, 240]
U channel: [16, 240]

The memory layout of a Y_U_V12 image looks like this:

 y-plane:        u-plane:      v-plane:
 ---------       -----         -----
| Y Y Y Y |     | U U |       | V V |
| Y Y Y Y |     | U U |       | V V |
| Y Y Y Y |      -----         -----
| Y Y Y Y |
 ---------
See also
FORMAT_Y_U_V12_FULL_RANGE.
FORMAT_Y_U_V12_FULL_RANGE 

Pixel format with 8 bits Y frame as individual block, followed by 8 bits 2x2 sub-sampled U frame and 8 bits 2x2 sub-sampled V frame, both as individual blocks, resulting in 12 bits per pixel.

Sometimes also denoted as 'I420'.

The pixel format is using a full value range for all three channels:

Y channel: [0, 255]
V channel: [0, 255]
U channel: [0, 255]

The memory layout of a Y_U_V12 image looks like this:

 y-plane:        u-plane:      v-plane:
 ---------       -----         -----
| Y Y Y Y |     | U U |       | V V |
| Y Y Y Y |     | U U |       | V V |
| Y Y Y Y |      -----         -----
| Y Y Y Y |
 ---------
See also
FORMAT_Y_U_V12_LIMITED_RANGE. Width and height must be even (multiple of two).
FORMAT_Y_V_U12_LIMITED_RANGE 

Pixel format with 8 bits Y frame as individual block, followed by 8 bits 2x2 sub-sampled V frame and 8 bits 2x2 sub-sampled U frame, both as individual blocks, resulting in 12 bits per pixel.

Sometimes also denoted as 'YV12'.

The pixel format is using a limited value range for all three channels:

Y channel: [16, 235]
V channel: [16, 240]
U channel: [16, 240]

The memory layout of a Y_V_U12 image looks like this:

 y-plane:        v-plane:      u-plane:
 ---------       -----         -----
| Y Y Y Y |     | V V |       | U U |
| Y Y Y Y |     | V V |       | U U |
| Y Y Y Y |      -----         -----
| Y Y Y Y |
 ---------
See also
FORMAT_Y_V_U12_FULL_RANGE.
FORMAT_Y_V_U12_FULL_RANGE 

Pixel format with 8 bits Y frame as individual block, followed by 8 bits 2x2 sub-sampled V frame and 8 bits 2x2 sub-sampled U frame, both as individual blocks, resulting in 12 bits per pixel.

Sometimes also denoted as 'YV12'.

The pixel format is using a full value range for all three channels:

Y channel: [0, 255]
V channel: [0, 255]
U channel: [0, 255]

The memory layout of a Y_V_U12 image looks like this:

 y-plane:        v-plane:      u-plane:
 ---------       -----         -----
| Y Y Y Y |     | V V |       | U U |
| Y Y Y Y |     | V V |       | U U |
| Y Y Y Y |      -----         -----
| Y Y Y Y |
 ---------
See also
FORMAT_Y_V_U12_LIMITED_RANGE. Width and height must be even (multiple of two).
FORMAT_F32 

Pixel format for a frame with one channel and 32 bit floating point precision per element.

FORMAT_F64 

Pixel format for a frame with one channel and 64 bit floating point precision per element.

FORMAT_END 

The helper pixel format which can be used to identify the last defined pixel format, FORMAT_END is exclusive.

◆ PixelOrigin

Defines different types of frame origin positions.

Enumerator
ORIGIN_INVALID 

Invalid origin type.

ORIGIN_UPPER_LEFT 

The first pixel lies in the upper left corner, the last pixel in the lower right corner.

ORIGIN_LOWER_LEFT 

The first pixel lies in the lower left corner, the last pixel in the upper right corner.

◆ PlanesValue

enum Ocean::FrameType::PlanesValue : uint32_t
protected

Definition of a protected helper enum that simplifies to read the definition of a predefined pixel format.

Enumerator
PV_PLANES_1 

One plane.

PV_PLANES_2 

Two planes.

PV_PLANES_3 

Three planes.

PV_PLANES_4 

Four planes.

Constructor & Destructor Documentation

◆ FrameType() [1/6]

Ocean::FrameType::FrameType ( )
default

Creates a new frame type with invalid parameters.

◆ FrameType() [2/6]

Ocean::FrameType::FrameType ( const unsigned int  width,
const unsigned int  height,
const PixelFormat  pixelFormat,
const PixelOrigin  pixelOrigin 
)
inline

Creates a new frame type.

Parameters
widthThe width of the frame in pixel, must match with the pixel format condition, widthMultiple()
heightThe height of the frame in pixel, must match with the pixel format condition, heightMultiple()
pixelFormatPixel format of the frame
pixelOriginPixel origin of the frame

◆ FrameType() [3/6]

Ocean::FrameType::FrameType ( const FrameType type,
const unsigned int  width,
const unsigned int  height 
)
inline

Creates a new frame type.

Parameters
typeFrame type to copy most properties from
widthThe width of the frame in pixel to be used instead of the width defined in the given frame type, must match with the pixel format condition, widthMultiple()
heightThe height of the frame in pixel to be used instead of the height defined in the given frame type, must match with the pixel format condition, heightMultiple()

◆ FrameType() [4/6]

Ocean::FrameType::FrameType ( const FrameType type,
const PixelFormat  pixelFormat 
)
inline

Creates a new frame type.

Parameters
typeFrame type to copy most properties from
pixelFormatPixel format to be used instead of the pixel format defined in the given frame type

◆ FrameType() [5/6]

Ocean::FrameType::FrameType ( const FrameType type,
const PixelOrigin  pixelOrigin 
)
inline

Creates a new frame type.

Parameters
typeFrame type to copy most properties from
pixelOriginPixel origin to be used instead of the pixel origin defined in the given frame type

◆ FrameType() [6/6]

Ocean::FrameType::FrameType ( const FrameType type,
const PixelFormat  pixelFormat,
const PixelOrigin  pixelOrigin 
)
inline

Creates a new frame type.

Parameters
typeFrame type to copy most properties from
pixelFormatPixel format of the frame
pixelOriginPixel origin to be used instead of the pixel origin defined in the given frame type

Member Function Documentation

◆ areFrameTypesCompatible()

static bool Ocean::FrameType::areFrameTypesCompatible ( const FrameType frameTypeA,
const FrameType frameTypeB,
const bool  allowDifferentPixelOrigins 
)
static

Returns whether two given frame types are compatible.

Two frame types are compatible if:

  • Both types are identical, or
  • Both types have the same dimension and compatible pixel formats
    Parameters
    frameTypeAThe first frame type to be checked, must be valid
    frameTypeBThe second frame type to be checked, must be valid
    allowDifferentPixelOriginsTrue, to allow different pixel origins; False, so that both frame types must have the same pixel origin
    Returns
    True, if both frame types are compatible
    See also
    arePixelFormatsCompatible().

◆ arePixelFormatsCompatible()

static bool Ocean::FrameType::arePixelFormatsCompatible ( const PixelFormat  pixelFormatA,
const PixelFormat  pixelFormatB 
)
static

Returns whether two given pixel formats are compatible.

Two pixel formats are compatible if:

  • Both pixel formats are identical, or
  • Both pixel formats are pure generic pixel formats with identical data type and channel number, or
  • One pixel format is not pure generic (e.g., FORMAT_RGB24), while the other pixel format is pure generic but has the same data type and channel number
    Parameters
    pixelFormatAThe first pixel format to be checked, must be valid
    pixelFormatBThe second pixel format to be checked, must be valid
    Returns
    True, if both pixel formats are compatible
    See also
    areFrameTypesCompatible().

◆ bytesPerDataType() [1/2]

unsigned int Ocean::FrameType::bytesPerDataType ( ) const
inline

Returns the number of bytes which are necessary to store the data type of this frame.

Returns
The number of bytes of the frame's data type, with range [1, infinity)

◆ bytesPerDataType() [2/2]

static unsigned int Ocean::FrameType::bytesPerDataType ( const DataType  dataType)
static

Returns the number of bytes which are necessary to store a specified data type.

Parameters
dataTypeThe data type for which the number of bytes is requested
Returns
The number of bytes per data type, with range [1, infinity)

◆ channels() [1/2]

unsigned int Ocean::FrameType::channels ( ) const
inline

Returns the number of individual channels the frame has.

An invalid frame or a frame with undefined pixel format has 0 channels.

Returns
Number of channels, with range [0, infinity)

◆ channels() [2/2]

static unsigned int Ocean::FrameType::channels ( const PixelFormat  pixelFormat)
static

Returns the number of individual channels of a given pixel format.

Parameters
pixelFormatPixel format to be check
Returns
Number of channels

◆ dataIsAligned()

template<typename T >
bool Ocean::FrameType::dataIsAligned ( const void *  data)
inlinestatic

Returns whether a given pointer has the same byte alignment as the size of the data type the pointer is pointing to.

Actually, this function returns whether the following condition is true:

size_t(data) % sizeof(T) == 0
Parameters
dataThe pointer to the memory to be checked, must be valid
Returns
True, if so

◆ dataType() [1/16]

template<typename T >
constexpr FrameType::DataType Ocean::FrameType::dataType
staticconstexpr

Returns the (pixel format) data type of a given C++ data type.

Returns
The data type of the given template parameter, DT_UNDEFINED if the C++ data type is not supported
Template Parameters
TThe C++ data type for which the (pixel format) data type is returned

◆ dataType() [2/16]

template<>
constexpr FrameType::DataType Ocean::FrameType::dataType ( )
staticconstexpr

◆ dataType() [3/16]

template<>
constexpr FrameType::DataType Ocean::FrameType::dataType ( )
staticconstexpr

◆ dataType() [4/16]

template<>
constexpr FrameType::DataType Ocean::FrameType::dataType ( )
staticconstexpr

◆ dataType() [5/16]

template<>
constexpr FrameType::DataType Ocean::FrameType::dataType ( )
staticconstexpr

◆ dataType() [6/16]

template<>
constexpr FrameType::DataType Ocean::FrameType::dataType ( )
staticconstexpr

◆ dataType() [7/16]

template<>
constexpr FrameType::DataType Ocean::FrameType::dataType ( )
staticconstexpr

◆ dataType() [8/16]

template<>
constexpr FrameType::DataType Ocean::FrameType::dataType ( )
staticconstexpr

◆ dataType() [9/16]

template<>
constexpr FrameType::DataType Ocean::FrameType::dataType ( )
staticconstexpr

◆ dataType() [10/16]

template<>
constexpr FrameType::DataType Ocean::FrameType::dataType ( )
staticconstexpr

◆ dataType() [11/16]

template<>
constexpr FrameType::DataType Ocean::FrameType::dataType ( )
staticconstexpr

◆ dataType() [12/16]

template<>
constexpr FrameType::DataType Ocean::FrameType::dataType ( )
staticconstexpr

◆ dataType() [13/16]

template<>
constexpr FrameType::DataType Ocean::FrameType::dataType ( )
staticconstexpr

◆ dataType() [14/16]

template<>
constexpr FrameType::DataType Ocean::FrameType::dataType ( )
staticconstexpr

◆ dataType() [15/16]

FrameType::DataType Ocean::FrameType::dataType ( ) const
inline

Returns the data type of the pixel format of this frame.

Returns
The frame's data type

◆ dataType() [16/16]

FrameType::DataType Ocean::FrameType::dataType ( const PixelFormat  pixelFormat)
inlinestatic

Returns the data type of a pixel format.

Parameters
pixelFormatPixel format to be check
Returns
The data type of the given pixel format, DT_UNDEFINED if the pixel format is not supported

◆ definedDataTypes()

static const FrameType::DataTypes& Ocean::FrameType::definedDataTypes ( )
static

Returns all defined data types.

Returns
Ocean's defined data types

◆ definedPixelFormats()

static const FrameType::PixelFormats& Ocean::FrameType::definedPixelFormats ( )
static

Returns all defined pixel formats.

Returns
Ocean's defined pixel formats

◆ findPixelFormat() [1/2]

static PixelFormat Ocean::FrameType::findPixelFormat ( const DataType  dataType,
const unsigned int  channels 
)
static

Returns a best fitting pixel format having the given number of bits per pixels.

The following mappings are defined:

DataType:                 Channels:    PixelFormat:
DT_UNSIGNED_INTEGER_8     1            FORMAT_Y8
DT_UNSIGNED_INTEGER_8     2            FORMAT_YA16
DT_UNSIGNED_INTEGER_8     3            FORMAT_RGB24
DT_UNSIGNED_INTEGER_8     4            FORMAT_RGBA32
Parameters
dataTypeThe data type of each pixel element for which a pixel type is determined, must be valid
channelsThe number of channels for which a pixel format will be determined, with range [1, infinity)
Returns
Resulting pixel format, FORMAT_UNDEFINED if no pixel format can be found

◆ findPixelFormat() [2/2]

static PixelFormat Ocean::FrameType::findPixelFormat ( const unsigned int  bitsPerPixel)
static

Returns a best fitting pixel format having the given number of bits per pixels.

Parameters
bitsPerPixelNumber of bits per pixel the resulting pixel format will have, with range [1, infinity)
Returns
Resulting pixel format, FORMAT_UNDEFINED if no pixel format can be found

◆ formatAddAlphaChannel()

static PixelFormat Ocean::FrameType::formatAddAlphaChannel ( const PixelFormat  pixelFormat,
const bool  lastChannel = true 
)
static

Adds an alpha channel to a given pixel format.

Parameters
pixelFormatPixel format without alpha channel
lastChannelTrue, to add the alpha channel at the end of the data channels, otherwise the alpha channel will be added in front of the data channels
Returns
Pixel format with alpha channel, if existing

◆ formatBitsPerPixelAlphaChannel()

static unsigned int Ocean::FrameType::formatBitsPerPixelAlphaChannel ( const PixelFormat  pixelFormat)
static

Returns the number of bits of one pixel for the alpha channel.

Parameters
pixelFormatPixel format to check
Returns
Number of bits per pixel

◆ formatBitsPerPixelBlueChannel()

static unsigned int Ocean::FrameType::formatBitsPerPixelBlueChannel ( const PixelFormat  pixelFormat)
static

Returns the number of bits of one pixel for the blue channel.

Parameters
pixelFormatPixel format to check
Returns
Number of bits per pixel

◆ formatBitsPerPixelGreenChannel()

static unsigned int Ocean::FrameType::formatBitsPerPixelGreenChannel ( const PixelFormat  pixelFormat)
static

Returns the number of bits of one pixel for the green channel.

Parameters
pixelFormatPixel format to check
Returns
Number of bits per pixel

◆ formatBitsPerPixelRedChannel()

static unsigned int Ocean::FrameType::formatBitsPerPixelRedChannel ( const PixelFormat  pixelFormat)
static

Returns the number of bits of one pixel for the red channel.

Parameters
pixelFormatPixel format to check
Returns
Number of bits per pixel

◆ formatGenericBitsPerPixel()

uint32_t Ocean::FrameType::formatGenericBitsPerPixel ( const PixelFormat  pixelFormat)
inlinestatic

Returns the number of bits of one pixel for a given generic pixel format.

Parameters
pixelFormatPixel format to check
Returns
Number of bits per pixel

◆ formatGenericNumberChannels()

uint32_t Ocean::FrameType::formatGenericNumberChannels ( const PixelFormat  pixelFormat)
inlinestatic

Returns the number of individual channels of a given generic pixel format.

Parameters
pixelFormatGeneric pixel format to be checked
Returns
The number of channels, 0 if the pixel format is not generic (e.g., FORMAT_Y_UV12)

◆ formatHasAlphaChannel()

static bool Ocean::FrameType::formatHasAlphaChannel ( const PixelFormat  pixelFormat,
bool *  isLastChannel = nullptr 
)
static

Returns whether a given pixel format holds an alpha channel.

Parameters
pixelFormatPixel format to check
isLastChannelOptional returning whether the alpha channel is the last channel (true) or whether it is the first channel (false)
Returns
True, if so

◆ formatIsGeneric() [1/2]

bool Ocean::FrameType::formatIsGeneric ( const PixelFormat  pixelFormat)
inlinestatic

Checks whether a given pixel format is a generic pixel format.

Parameters
pixelFormatThe pixel format to be checked
Returns
True, if succeeded

◆ formatIsGeneric() [2/2]

bool Ocean::FrameType::formatIsGeneric ( const PixelFormat  pixelFormat,
const DataType  dataType,
const uint32_t  channels,
const uint32_t  planes = 1u,
const uint32_t  widthMultiple = 1u,
const uint32_t  heightMultiple = 1u 
)
inlinestatic

Checks whether a given pixel format is a specific layout regarding data channels and data type.

Parameters
pixelFormatThe pixel format to be checked
dataTypeThe expected data type of the given pixel format
channelsThe expected number of channels of the given pixel format, with range [0, 31]
planesThe number of planes of the generic pixel format, with range [0, 255]
widthMultipleThe number of pixels the width of a frame must be a multiple of, with range [1, 255]
heightMultipleThe number of pixels the height of a frame must be a multiple of, with range [1, 255]
Returns
True, if succeeded

◆ formatIsPacked()

static bool Ocean::FrameType::formatIsPacked ( const PixelFormat  pixelFormat)
static

Returns whether a given pixel format is a packed pixel format.

Packed pixel formats like FORMAT_BGGR10_PACKED or FORMAT_Y10_PACKED contain bytes providing color information for several individual pixels.

Returns
True, if so

◆ formatIsPureGeneric()

bool Ocean::FrameType::formatIsPureGeneric ( const PixelFormat  pixelFormat)
inlinestatic

Checks whether a given pixel format is a pure generic pixel format.

Parameters
pixelFormatThe pixel format to be checked
Returns
True, if succeeded

◆ formatRemoveAlphaChannel()

static PixelFormat Ocean::FrameType::formatRemoveAlphaChannel ( const PixelFormat  pixelFormat)
static

Removes an alpha channel from a given pixel format.

Parameters
pixelFormatPixel format with alpha channel
Returns
Pixel format without alpha channel, if existing

◆ frameTypeSize()

unsigned int Ocean::FrameType::frameTypeSize ( ) const

Returns the number of bytes necessary for the frame type, without padding at the end of frame rows.

In case the pixel format holds more than one plane, the resulting number of bytes is the sum of all planes. Beware: An actual frame may have a larger size if the frame comes with padding at end of rows.

Returns
The size of the memory necessary for this frame type in bytes, with range [0, infinity)
See also
Frame::size().

◆ genericPixelFormat() [1/8]

template<DataType tDataType, uint32_t tChannels, uint32_t tPlanes = 1u, uint32_t tWidthMultiple = 1u, uint32_t tHeightMultiple = 1u>
constexpr static PixelFormat Ocean::FrameType::genericPixelFormat ( )
staticconstexpr

Returns a specific generic pixel format with a specified data type and channel number.

Returns
Pixel format the resulting pixel format
Template Parameters
tDataTypeThe data type of the generic format
tChannelsThe number of channels of the generic format, with range [1, 31]
tPlanesThe number of planes of the generic pixel format, with range [1, 255]
tWidthMultipleThe number of pixels the width of a frame must be a multiple of, with range [1, 255]
tHeightMultipleThe number of pixels the height of a frame must be a multiple of, with range [1, 255]
// a pixel format with 3 channels storing 'unsigned char' values for each channel
const FrameType::PixelFormat pixelFormat3Channels = FrameType::genericPixelFormat<FrameType::DT_UNSIGNED_INTEGER_8, 3u>();
// a pixel format with 1 channel composed of 'float' values
const FrameType::PixelFormat pixelFormat1Channel = FrameType::genericPixelFormat<FrameType::DT_SIGNED_FLOAT_32, 1u>();
See also
genericPixelFormat<TDataType, tChannels>();

◆ genericPixelFormat() [2/8]

template<typename TDataType , uint32_t tChannels, uint32_t tPlanes = 1u, uint32_t tWidthMultiple = 1u, uint32_t tHeightMultiple = 1u>
constexpr static PixelFormat Ocean::FrameType::genericPixelFormat ( )
staticconstexpr

Returns a specific generic pixel format with a specified data type and channel number.

Returns
Pixel format the resulting pixel format
Template Parameters
TDataTypeThe C++ data type for which the (pixel format) data type is returned
tChannelsThe number of channels of the generic format, with range [1, 31]
tPlanesThe number of planes of the generic pixel format, with range [1, 255]
tWidthMultipleThe number of pixels the width of a frame must be a multiple of, with range [1, 255]
tHeightMultipleThe number of pixels the height of a frame must be a multiple of, with range [1, 255]

The following code snippet shows how to use this function:

// a pixel format with 3 channels storing 'unsigned char' values for each channel
const FrameType::PixelFormat pixelFormat3Channels = FrameType::genericPixelFormat<unsigned char, 3u>();
// a pixel format with 1 channel composed of 'float' values
const FrameType::PixelFormat pixelFormat1Channel = FrameType::genericPixelFormat<float, 1u>();
See also
genericPixelFormat<tDataType, tChannels>();

◆ genericPixelFormat() [3/8]

template<typename TDataType , uint32_t tChannels, uint32_t tPlanes, uint32_t tWidthMultiple, uint32_t tHeightMultiple>
constexpr FrameType::PixelFormat Ocean::FrameType::genericPixelFormat
constexpr

◆ genericPixelFormat() [4/8]

constexpr FrameType::PixelFormat Ocean::FrameType::genericPixelFormat ( const DataType  dataType,
const uint32_t  channels,
const uint32_t  planes = 1u,
const uint32_t  widthMultiple = 1u,
const uint32_t  heightMultiple = 1u 
)
inlinestaticconstexpr

Returns a specific generic pixel format with a specified data type, channel number, and plane number.

Parameters
dataTypeThe data type of the generic format
channelsThe number of channels of the generic format, with range [1, 31]
planesThe number of planes of the generic pixel format, with range [1, 255]
widthMultipleThe number of pixels the width of a frame must be a multiple of, with range [1, 255]
heightMultipleThe number of pixels the height of a frame must be a multiple of, with range [1, 255]
Returns
Pixel format the resulting pixel format

◆ genericPixelFormat() [5/8]

template<typename TDataType >
constexpr FrameType::PixelFormat Ocean::FrameType::genericPixelFormat ( const uint32_t  channels,
const uint32_t  planes,
const uint32_t  widthMultiple,
const uint32_t  heightMultiple 
)
constexpr

◆ genericPixelFormat() [6/8]

template<DataType tDataType>
constexpr static PixelFormat Ocean::FrameType::genericPixelFormat ( const uint32_t  channels,
const uint32_t  planes = 1u,
const uint32_t  widthMultiple = 1u,
const uint32_t  heightMultiple = 1u 
)
staticconstexpr

Returns a specific generic pixel format with a specified data type and channel number.

Returns
Pixel format the resulting pixel format
Parameters
channelsThe number of channels of the generic format, with range [1, 31]
planesThe number of planes of the generic pixel format, with range [1, 255]
widthMultipleThe number of pixels the width of a frame must be a multiple of, with range [1, 255]
heightMultipleThe number of pixels the height of a frame must be a multiple of, with range [1, 255]
Template Parameters
tDataTypeThe data type of the generic format
// a pixel format with 3 channels storing 'unsigned char' values for each channel
const FrameType::PixelFormat pixelFormat3Channels = FrameType::genericPixelFormat<FrameType::DT_UNSIGNED_INTEGER_8>(3u);
// a pixel format with 1 channel composed of 'float' values
const FrameType::PixelFormat pixelFormat1Channel = FrameType::genericPixelFormat<FrameType::DT_SIGNED_FLOAT_32>(1u);

◆ genericPixelFormat() [7/8]

static PixelFormat Ocean::FrameType::genericPixelFormat ( const unsigned int  bitsPerPixelChannel,
const uint32_t  channels,
const uint32_t  planes = 1u,
const uint32_t  widthMultiple = 1u,
const uint32_t  heightMultiple = 1u 
)
static

Returns a specific generic pixel format with specified bit per pixel per channel, channel number, and plane number.

The overall number of bits per pixel will be bitsPerPixelChannel * channels

Parameters
bitsPerPixelChannelThe number of bits each pixel and channel of the pixel format will have, with values (4, 8, 16, 32, 64)
channelsThe number of channels of the generic format, with range [1, 31]
planesThe number of planes of the generic pixel format, with range [1, 255]
widthMultipleThe number of pixels the width of a frame must be a multiple of, with range [1, 255]
heightMultipleThe number of pixels the height of a frame must be a multiple of, with range [1, 255]
Returns
Pixel format the resulting pixel format

◆ genericPixelFormat() [8/8]

template<typename TDataType >
constexpr static PixelFormat Ocean::FrameType::genericPixelFormat ( uint32_t  channels,
const uint32_t  planes = 1u,
const uint32_t  widthMultiple = 1u,
const uint32_t  heightMultiple = 1u 
)
staticconstexpr

Returns a specific generic pixel format with a specified data type and channel number.

Returns
Pixel format the resulting pixel format
Parameters
channelsThe number of channels of the generic format, with range [1, 31]
planesThe number of planes of the generic pixel format, with range [1, 255]
widthMultipleThe number of pixels the width of a frame must be a multiple of, with range [1, 255]
heightMultipleThe number of pixels the height of a frame must be a multiple of, with range [1, 255]
Template Parameters
TDataTypeThe C++ data type for which the (pixel format) data type is returned

The following code snippet shows how to use this function:

// a pixel format with 3 channels storing 'unsigned char' values for each channel
const FrameType::PixelFormat pixelFormat3Channels = FrameType::genericPixelFormat<unsigned char>(3u);
// a pixel format with 1 channel composed of 'float' values
const FrameType::PixelFormat pixelFormat1Channel = FrameType::genericPixelFormat<float>(1u);

◆ genericSinglePlanePixelFormat()

static PixelFormat Ocean::FrameType::genericSinglePlanePixelFormat ( const PixelFormat  pixelFormat)
static

Returns the most suitable 1-plane pixel format for a given pixel format which may be composed of several planes.

If the given pixel format is a generic 1-plane pixel format already, the same pixel format will be returned. Here is a table with some examples:

Output pixel format:       Input pixel format:
<generic pixel format>     <generic pixel format> (e.g., FORMAT_RGB24)
FORMAT_BGR24               FORMAT_BGR4444, FORMAT_BGR5551, FORMAT_BGR565
FORMAT_BGRA32              FORMAT_BGRA4444
FORMAT_RGB24               FORMAT_RGB4444, FORMAT_RGB5551, FORMAT_RGB565
FORMAT_RGBA32              FORMAT_RGBA4444
FORMAT_YUV24,              FORMAT_Y_UV12, FORMAT_UYVY16, FORMAT_Y_U_V12, FORMAT_YUYV16, FORMAT_Y_U_V24
FORMAT_YVU24               FORMAT_Y_VU12, FORMAT_Y_V_U12
Parameters
pixelFormatPixel format for which the 1-plane pixel format will be returned
Returns
The resulting 1-plane pixel format, FORMAT_UNDEFINED if no matching pixel format could be found

◆ height()

unsigned int Ocean::FrameType::height ( ) const
inline

Returns the height of the frame in pixel.

Returns
Height in pixel

◆ heightMultiple()

uint32_t Ocean::FrameType::heightMultiple ( const PixelFormat  pixelFormat)
inlinestatic

Returns the number of pixels the height of a frame must be a multiple of.

Parameters
pixelFormatPixel format to return the number of pixels for
Returns
Number of pixels

◆ isFrameTypeCompatible()

bool Ocean::FrameType::isFrameTypeCompatible ( const FrameType frameType,
const bool  allowDifferentPixelOrigins 
) const
inline

Returns whether this frame type is compatible with a given frame type.

Two frame types are compatible if:

  • Both types are identical, or
  • Both types have the same dimension and compatible pixel formats
    Parameters
    frameTypeThe first frame type to be checked, must be valid
    allowDifferentPixelOriginsTrue, to allow different pixel origins; False, so that both frame types must have the same pixel origin
    Returns
    True, if the given frame type is compatible
    See also
    isPixelFormatCompatible().

◆ isPixelFormatCompatible()

bool Ocean::FrameType::isPixelFormatCompatible ( const PixelFormat  pixelFormat) const
inline

Returns whether the pixel format of this frame type is compatible with a given pixel format.

Two pixel formats are compatible if:

  • Both pixel formats are identical, or
  • Both pixel formats are pure generic pixel formats with identical data type and channel number, or
  • One pixel format is not pure generic (e.g., FORMAT_RGB24), while the other pixel format is pure generic but has the same data type and channel number
    Parameters
    pixelFormatThe pixel format to be checked, must be valid
    Returns
    True, if the given pixel format is compatible
    See also
    isFrameTypeCompatible().

◆ isValid()

bool Ocean::FrameType::isValid ( ) const
inline

Returns whether this frame type is valid.

Returns
True, if so

◆ makeGenericPixelFormat()

FrameType::PixelFormat Ocean::FrameType::makeGenericPixelFormat ( const PixelFormat  pixelFormat)
inlinestatic

Converts a any pixel format into a generic one This function has no effect for input pixel formats which are already generic.

Parameters
pixelFormatA pixel format
Returns
The generic pixel format; for generic pixel formats output will be identical to input

◆ numberPlanes() [1/2]

uint32_t Ocean::FrameType::numberPlanes ( ) const
inline

Returns the number of planes of the pixel format of this frame.

Returns
The number of planes, with range [0, infinity)

◆ numberPlanes() [2/2]

uint32_t Ocean::FrameType::numberPlanes ( const PixelFormat  pixelFormat)
inlinestatic

Returns the number of planes of a pixel format.

Parameters
pixelFormatThe pixel format for which the number of planes will be returned
Returns
The number of planes, with range [0, infinity)

◆ operator!=()

bool Ocean::FrameType::operator!= ( const FrameType right) const
inline

Returns whether two frame types are not equal.

Parameters
rightThe right frame type
Returns
True, if so

◆ operator<()

bool Ocean::FrameType::operator< ( const FrameType right) const

Returns whether the left frame type is 'smaller' than the right one.

The operator does not compare the area of both frames but considers 'width', 'height', pixel format, and pixel origin to create a unique order between frame types.

Parameters
rightThe right frame type
Returns
True, if so

◆ operator==()

bool Ocean::FrameType::operator== ( const FrameType right) const

Returns whether two frame types are equal.

Parameters
rightThe right frame type
Returns
True, if so

◆ pixelFormat()

FrameType::PixelFormat Ocean::FrameType::pixelFormat ( ) const
inline

Returns the pixel format of the frame.

Returns
Pixel format

◆ pixelOrigin()

FrameType::PixelOrigin Ocean::FrameType::pixelOrigin ( ) const
inline

Returns the pixel origin of the frame.

Returns
Pixel origin

◆ pixels()

unsigned int Ocean::FrameType::pixels ( ) const
inline

Returns the number of pixels for the frame.

Returns
Number of frame pixels

◆ planeBytesPerPixel()

unsigned int Ocean::FrameType::planeBytesPerPixel ( const PixelFormat imagePixelFormat,
const unsigned int  planeIndex 
)
inlinestatic

Returns the number of bytes of one pixel of a plane for a pixel format.

Beware: This function will return 0 if the pixel format is a special packed format (e.g., FORMAT_Y10_PACKED) which does not allow to calculate the number of bytes per pixel.

Parameters
imagePixelFormatThe pixel format of the entire frame, must be valid
planeIndexThe index of the plane for which the bytes per pixel will be returned, with range [0, numberPlanes(imagePixelFormat))
Returns
The plane's number of bytes per pixel, will be 0 for special packed pixel formats like FORMAT_Y10_PACKED

◆ planeChannels()

static unsigned int Ocean::FrameType::planeChannels ( const PixelFormat imagePixelFormat,
const unsigned int  planeIndex 
)
static

Returns the channels of a plane for a pixel format.

Parameters
imagePixelFormatThe pixel format of the entire frame, must be valid
planeIndexThe index of the plane for which the channels will be returned, with range [0, numberPlanes(imagePixelFormat))
Returns
The plane's channels, with range [0, infinity)

◆ planeLayout() [1/2]

bool Ocean::FrameType::planeLayout ( const FrameType frameType,
const unsigned int  planeIndex,
unsigned int &  planeWidth,
unsigned int &  planeHeight,
unsigned int &  planeChannels,
unsigned int *  planeWidthElementsMultiple = nullptr,
unsigned int *  planeHeightElementsMultiple = nullptr 
)
inlinestatic

Returns the plane layout of a given frame type.

Parameters
frameTypeThe frame type for which the plane layout will be returned, must be valid
planeIndexThe index of the plane for which the layout will be returned, with range [0, numberPlanes(imagePixelFormat) - 1]
planeWidthThe resulting width of the specified plane, in (plane) pixel, with range [1, infinity)
planeHeightThe resulting height of the specified plane, in (plane) pixel, with range [1, infinity)
planeChannelsThe resulting number of channels the plane has, with range [1, infinity)
planeWidthElementsMultipleOptional the resulting number of (plane) elements the width of the plane must be a multiple of, in elements, with range [1, infinity)
planeHeightElementsMultipleOptional the resulting number of (plane) elements the height of the plane must be a multiple of, in elements, with range [1, infinity)
Returns
True, if succeeded

◆ planeLayout() [2/2]

static bool Ocean::FrameType::planeLayout ( const PixelFormat  imagePixelFormat,
const unsigned int  imageWidth,
const unsigned int  imageHeight,
const unsigned int  planeIndex,
unsigned int &  planeWidth,
unsigned int &  planeHeight,
unsigned int &  planeChannels,
unsigned int *  planeWidthElementsMultiple = nullptr,
unsigned int *  planeHeightElementsMultiple = nullptr 
)
static

Returns the plane layout of a given pixel format.

Parameters
imagePixelFormatThe pixel format of the image for which the plane layout will be returned, must be valid
imageWidthThe width of the image, in (image) pixel, with range [1, infinity)
imageHeightThe height of the image, in (image) pixel, with range [1, infinity)
planeIndexThe index of the plane for which the layout will be returned, with range [0, numberPlanes(imagePixelFormat) - 1]
planeWidthThe resulting width of the specified plane, in (plane) pixel, with range [1, infinity)
planeHeightThe resulting height of the specified plane, in (plane) pixel, with range [1, infinity)
planeChannelsThe resulting number of channels the plane has, with range [1, infinity)
planeWidthElementsMultipleOptional the resulting number of (plane) elements the width of the plane must be a multiple of, in elements, with range [1, infinity)
planeHeightElementsMultipleOptional the resulting number of (plane) elements the height of the plane must be a multiple of, in elements, with range [1, infinity)
Returns
True, if succeeded

◆ setPixelFormat()

void Ocean::FrameType::setPixelFormat ( const PixelFormat  pixelFormat)
inline

Explicitly changes the pixel format of this frame.

Beware: Commonly there is no need to change the pixel format explicitly.

Parameters
pixelFormatThe new pixel format to be set, can be invalid

◆ translateDataType() [1/2]

static std::string Ocean::FrameType::translateDataType ( const DataType  dataType)
static

Translates a data type value into a string containing the data type.


For example the DT_UNSIGNED_INTEGER_8 will be translated into 'UNSIGNED_INTEGER_8'.

Parameters
dataTypethe data type as value
Returns
The data type as string, 'UNDEFINED' if the data type is invalid or cannot be translated

◆ translateDataType() [2/2]

static DataType Ocean::FrameType::translateDataType ( const std::string &  dataType)
static

Translates a string containing a data type into the data type.


For example 'UNSIGNED_INTEGER_8' will be translated into DT_UNSIGNED_INTEGER_8.

Parameters
dataTypeData type as string
Returns
Data type as value

◆ translatePixelFormat() [1/2]

static std::string Ocean::FrameType::translatePixelFormat ( const PixelFormat  pixelFormat)
static

Translates a pixel format value into a string containing the pixel format.


For example the FORMAT_BGR24 will be translated into 'BGR24'.

Parameters
pixelFormatPixel format as value
Returns
Pixel format as string, 'UNDEFINED' if the pixel format is invalid or cannot be translated

◆ translatePixelFormat() [2/2]

static PixelFormat Ocean::FrameType::translatePixelFormat ( const std::string &  pixelFormat)
static

Translates a string containing a pixel format into the pixel format.


For example 'BGR24' will be translated into FORMAT_BGR24.

Parameters
pixelFormatPixel format as string
Returns
Pixel format as value

◆ translatePixelOrigin() [1/2]

static std::string Ocean::FrameType::translatePixelOrigin ( const PixelOrigin  pixelOrigin)
static

Translates a pixel origin value into a string containing the pixel origin.


For example the ORIGIN_UPPER_LEFT will be translated into 'UPPER_LEFT'.

Parameters
pixelOriginPixel origin as value
Returns
Pixel origin as string, 'INVALID' if the pixel origin is invalid or cannot be translated

◆ translatePixelOrigin() [2/2]

static PixelOrigin Ocean::FrameType::translatePixelOrigin ( const std::string &  pixelOrigin)
static

Translates a string containing the pixel origin into the pixel origin value.


For example 'UPPER_LEFT' will be translated into ORIGIN_UPPER_LEFT.

Parameters
pixelOriginPixel origin as string
Returns
Pixel origin as value

◆ width()

unsigned int Ocean::FrameType::width ( ) const
inline

Returns the width of the frame format in pixel.

Returns
Width in pixel

◆ widthMultiple()

uint32_t Ocean::FrameType::widthMultiple ( const PixelFormat  pixelFormat)
inlinestatic

Returns the number of pixels the width of a frame must be a multiple of.

Parameters
pixelFormatPixel format to return the number of pixels for
Returns
Number of pixels

Field Documentation

◆ height_

unsigned int Ocean::FrameType::height_ = 0u
private

Frame height in pixel, with range [0, infinity)

◆ pixelFormat_

PixelFormatUnion Ocean::FrameType::pixelFormat_ = PixelFormatUnion(FORMAT_UNDEFINED)
private

The pixel format of the frame encapsulated in a union (mainly holding PixelFormat).

◆ pixelFormatBitOffsetChannels

constexpr uint32_t Ocean::FrameType::pixelFormatBitOffsetChannels = 16u
staticconstexprprotected

The number of bits the channel value is shifted within the PixelFormat value.

◆ pixelFormatBitOffsetDatatype

constexpr uint32_t Ocean::FrameType::pixelFormatBitOffsetDatatype = pixelFormatBitOffsetChannels + 8u
staticconstexprprotected

The number of bits the data type value is shifted within the PixelFormat value.

◆ pixelFormatBitOffsetHeightMultiple

constexpr uint32_t Ocean::FrameType::pixelFormatBitOffsetHeightMultiple = pixelFormatBitOffsetWidthMultiple + 8u
staticconstexprprotected

The number of bits the height-multiple value is shifted within the PixelFormat value.

◆ pixelFormatBitOffsetPlanes

constexpr uint32_t Ocean::FrameType::pixelFormatBitOffsetPlanes = pixelFormatBitOffsetDatatype + 8u
staticconstexprprotected

The number of bits the planes value is shifted within the PixelFormat value.

◆ pixelFormatBitOffsetWidthMultiple

constexpr uint32_t Ocean::FrameType::pixelFormatBitOffsetWidthMultiple = pixelFormatBitOffsetPlanes + 8u
staticconstexprprotected

The number of bits the width-multiple value is shifted within the PixelFormat value.

◆ pixelOrigin_

PixelOrigin Ocean::FrameType::pixelOrigin_ = ORIGIN_INVALID
private

The origin of the pixel data, either the upper left corner or the bottom left corner (if valid).

◆ width_

unsigned int Ocean::FrameType::width_ = 0u
private

Frame width in pixel, with range [0, infinity)


The documentation for this class was generated from the following file: