Ocean
Ocean::Frame::Plane Class Reference

Definition of an image plane, a block of memory storing pixel data with interleaved channels (or just one channel). More...

Public Member Functions

 Plane ()=default
 Creates a new invalid plane. More...
 
 Plane (Plane &&plane) noexcept
 Move constructor. More...
 
 Plane (const Plane &plane, const AdvancedCopyMode advancedCopyMode=ACM_USE_OR_COPY_KEEP_LAYOUT) noexcept
 Copy constructor. More...
 
 Plane (const unsigned int width, const unsigned int height, const unsigned int channels, const unsigned int elementTypeSize, const unsigned int paddingElements) noexcept
 Creates a new plane object with own allocated memory. More...
 
template<typename T >
 Plane (const unsigned int width, const unsigned int height, const unsigned int channels, const T *dataToUse, const unsigned int paddingElements) noexcept
 Creates a new plane object which is not creating a copy of the given memory. More...
 
template<typename T >
 Plane (const unsigned int width, const unsigned int height, const unsigned int channels, T *dataToUse, const unsigned int paddingElements) noexcept
 Creates a new plane object which is not creating a copy of the given memory. More...
 
template<typename T >
 Plane (const T *sourceDataToCopy, const unsigned int width, const unsigned int height, const unsigned int channels, const unsigned int targetPaddingElements, const unsigned int sourcePaddingElements, const bool makeCopyOfPaddingData=false) noexcept
 Creates a new plane object by making a copy of the given memory. More...
 
template<typename T >
 Plane (const T *sourceDataToCopy, const unsigned int width, const unsigned int height, const unsigned int channels, const unsigned int sourcePaddingElements, const CopyMode copyMode) noexcept
 Creates a new plane object by making a copy of the given memory. More...
 
 ~Plane ()
 Destructs a Plane object. More...
 
unsigned int width () const
 Returns the width of the plane in pixel. More...
 
unsigned int height () const
 Returns the height of the plane in pixel. More...
 
unsigned int channels () const
 Returns the channels of the plane. More...
 
template<typename T >
const T * constdata () const
 Returns the read-only memory pointer to this plane with a specific data type compatible with elementTypeSize(). More...
 
template<typename T >
T * data ()
 Returns the writable memory pointer to this plane with a specific data type compatible with elementTypeSize(). More...
 
unsigned int paddingElements () const
 Returns the number of padding elements at the end of each plane row, in elements. More...
 
unsigned int paddingBytes () const
 Returns the number of padding bytes at the end of each plane row, in bytes. More...
 
unsigned int elementTypeSize () const
 Returns the size of each element of this plane. More...
 
unsigned int widthElements () const
 Returns the width of the plane in elements, the width does not contain optional padding elements. More...
 
unsigned int widthBytes () const
 Returns the width of the plane in bytes, the width does not contain optional padding elements. More...
 
unsigned int strideElements () const
 Returns the number of elements between the start positions of two consecutive rows, in elements. More...
 
unsigned int strideBytes () const
 Returns the number of bytes between the start positions of two consecutive rows, in bytes. More...
 
unsigned int bytesPerPixel () const
 Returns the number of bytes which is used for each pixel. More...
 
void release ()
 Releases this plane and all resources of this plane. More...
 
template<typename T >
bool isCompatibleWithDataType () const
 Returns whether this plane is compatible with a given element data type. More...
 
unsigned int size () const
 Returns the number of bytes necessary for the entire plane data including optional padding elements at the end of each row. More...
 
bool isContinuous () const
 Returns whether this plane is based on continuous memory and thus does not have any padding at the end of rows. More...
 
bool isOwner () const
 Returns whether this plane is the owner of the memory. More...
 
bool isReadOnly () const
 Returns whether this plane holds read-only memory. More...
 
bool isValid () const
 Returns whether this plane holds valid data. More...
 
bool copy (const Plane &sourcePlane, const AdvancedCopyMode advancedCopyMode=ACM_COPY_KEEP_LAYOUT_DO_NOT_COPY_PADDING_DATA, const bool reallocateIfNecessary=true)
 Copies data from another plane into this plane. More...
 
Planeoperator= (Plane &&plane) noexcept
 Move operator. More...
 
Planeoperator= (const Plane &plane) noexcept
 Copy operator. More...
 

Static Public Member Functions

static void * alignedMemory (const size_t size, const size_t alignment, void *&alignedData)
 Allocates memory with specific byte alignment. More...
 

Protected Member Functions

 Plane (const unsigned int width, const unsigned int height, const unsigned int channels, const unsigned int elementTypeSize, const void *constData, void *data, const unsigned int paddingElements) noexcept
 Creates a new plane object which is not creating a copy of the given memory. More...
 
 Plane (const unsigned int width, const unsigned int height, const unsigned int channels, const unsigned int elementTypeSize, const void *dataToUse, const unsigned int paddingElements) noexcept
 Creates a new plane object which is not creating a copy of the given memory. More...
 
 Plane (const unsigned int width, const unsigned int height, const unsigned int channels, const unsigned int elementTypeSize, void *dataToUse, const unsigned int paddingElements) noexcept
 Creates a new plane object which is not creating a copy of the given memory. More...
 
 Plane (const unsigned int width, const unsigned int height, const unsigned int channels, const unsigned int elementTypeSize, const void *sourceDataToCopy, const unsigned int targetPaddingElements, const unsigned int sourcePaddingElements, const bool makeCopyOfPaddingData=false) noexcept
 Creates a new plane object by making a copy of the given memory. More...
 
 Plane (const unsigned int width, const unsigned int height, const unsigned int channels, const unsigned int elementTypeSize, const void *sourceDataToCopy, const unsigned int sourcePaddingElements, const CopyMode copyMode) noexcept
 Creates a new plane object by making a copy of the given memory. More...
 
void copy (const void *sourceData, const unsigned int sourceStrideBytes, const unsigned int sourcePaddingElements, const bool makeCopyOfPaddingData=false)
 Copies memory into this plane which has compatible memory already. More...
 
unsigned int calculateStrideBytes () const
 Calculates the number of bytes between the start positions of two consecutive rows, in bytes. More...
 
unsigned int calculateBytesPerPixel () const
 Calculates the number of bytes per pixel. More...
 

Protected Attributes

void * allocatedData_ = nullptr
 The pointer to the memory which this plane has allocated, this pointer is pointing to the memory which needs to be freed when disposing the plane object, nullptr if the plane is not owner of the memory. More...
 
const void * constData_ = nullptr
 The pointer to the read-only memory of the plane (not the pointer to the allocated memory), nullptr, if the plane is not read-only, or invalid. More...
 
void * data_ = nullptr
 The pointer to the writable memory of the plane (not the pointer to the allocated memory), nullptr if the plane is not writable. More...
 
unsigned int width_ = 0u
 The width of the plane in pixel, with range [0, infinity). More...
 
unsigned int height_ = 0u
 The height of the plane in pixel, with range [0, infinity). More...
 
unsigned int channels_ = 0u
 The number of channels the plane has, with range [0, infinity). More...
 
unsigned int elementTypeSize_ = 0u
 The size of each element of this plane, in bytes, with range [0, infinity). More...
 
unsigned int paddingElements_ = 0u
 The number of padding elements at the end of each plane row, in elements, with range [0, infinity). More...
 
unsigned int strideBytes_ = 0u
 The number of bytes between the start positions of two consecutive rows, in bytes, identical to '(width_ * channels_ + paddingElements_) * elementTypeSize_`. More...
 
unsigned int bytesPerPixel_ = 0u
 The number of bytes per pixel, with range [1, infinity), 0 if unknown. More...
 

Friends

class Frame
 

Detailed Description

Definition of an image plane, a block of memory storing pixel data with interleaved channels (or just one channel).

The plane does not store the specific pixel format or the width of the plane, as this information is part of the frame which owns the plane. A plane has the following memory layout:

|<-------- plane width ----------->|<-- paddingElements -->|

 ---------------------------------- -----------------------       ---
|A0 A1 An-1 B0 B1 Bn-1 ...         |                       |       ^
|...                               |                       |       |
|                                  |                       |  plane height
|                                  |                       |       |
|                                  |                       |       V
 ---------------------------------- -----------------------       ---

|<------------------- stride bytes ----------------------->|

With A0 first channel (or element) of first pixel, A1 second channel of first pixel, ...
And B0 first channel of second pixel, ...

Note that: strideBytes == (planeWidth * channels + paddingElements) * bytesPerElement.
A plane can have a different number of channels than a frame's pixel format which is owning the plane.
The plane's channels are defined in relation to the data type of each pixel:
A frame with pixel format FORMAT_RGB24 has three channels, one plane, and the plane has three channels (as the data type of each pixel element is uint8_t).
However, a frame with pixel format FORMAT_RGB565 has three channels, one plane, but the plane has one channel only (as the data type of each pixel is uint16_t).

Constructor & Destructor Documentation

◆ Plane() [1/13]

Ocean::Frame::Plane::Plane ( )
default

Creates a new invalid plane.

◆ Plane() [2/13]

Ocean::Frame::Plane::Plane ( Plane &&  plane)
inlinenoexcept

Move constructor.

Parameters
planeThe plane to be moved

◆ Plane() [3/13]

Ocean::Frame::Plane::Plane ( const Plane plane,
const AdvancedCopyMode  advancedCopyMode = ACM_USE_OR_COPY_KEEP_LAYOUT 
)
noexcept

Copy constructor.

Parameters
planeThe plane to be copied, can be invalid
advancedCopyModeThe copy mode specifying whether the source memory is used or copied

◆ Plane() [4/13]

Ocean::Frame::Plane::Plane ( const unsigned int  width,
const unsigned int  height,
const unsigned int  channels,
const unsigned int  elementTypeSize,
const unsigned int  paddingElements 
)
noexcept

Creates a new plane object with own allocated memory.

Parameters
widthThe width of the plane in pixel, with range [1, infinity)
heightThe height of the plane in pixel, with range [1, infinity)
channelsThe number of channels the plane has, with respect to the specified data type T, with range [1, infinity)
elementTypeSizeThe size of each element of the new plane, in bytes, with range [1, infinity)
paddingElementsThe optional number of padding elements at the end of each row, in elements, with range [0, infinity)

◆ Plane() [5/13]

template<typename T >
Ocean::Frame::Plane::Plane ( const unsigned int  width,
const unsigned int  height,
const unsigned int  channels,
const T *  dataToUse,
const unsigned int  paddingElements 
)
inlinenoexcept

Creates a new plane object which is not creating a copy of the given memory.

Instead, the memory pointer is just used.

Parameters
widthThe width of the plane in pixels, one pixel has size sizeof(T) * channels, with range [1, infinity)
heightThe height of the plane in pixel, with range [1, infinity)
channelsThe number of channels the plane has, with respect to the specified data type T, with range [1, infinity)
dataToUseMemory pointer of the read-only memory which will not be copied, must be valid
paddingElementsThe optional number of padding elements at the end of each row, in elements, with range [0, infinity)
Template Parameters
TThe data type of each element

◆ Plane() [6/13]

template<typename T >
Ocean::Frame::Plane::Plane ( const unsigned int  width,
const unsigned int  height,
const unsigned int  channels,
T *  dataToUse,
const unsigned int  paddingElements 
)
inlinenoexcept

Creates a new plane object which is not creating a copy of the given memory.

Instead, the memory pointer is just used.

Parameters
widthThe width of the plane in pixels, one pixel has size sizeof(T) * channels, with range [1, infinity)
heightThe height of the plane in pixel, with range [1, infinity)
channelsThe number of channels the plane has, with respect to the specified data type T, with range [1, infinity)
dataToUseMemory pointer of the writable memory which will not be copied, must be valid
paddingElementsThe optional number of padding elements at the end of each row, in elements, with range [0, infinity)
Template Parameters
TThe data type of each element

◆ Plane() [7/13]

template<typename T >
Ocean::Frame::Plane::Plane ( const T *  sourceDataToCopy,
const unsigned int  width,
const unsigned int  height,
const unsigned int  channels,
const unsigned int  targetPaddingElements,
const unsigned int  sourcePaddingElements,
const bool  makeCopyOfPaddingData = false 
)
inlinenoexcept

Creates a new plane object by making a copy of the given memory.

Parameters
sourceDataToCopyThe source data to be copied, must be valid
widthThe width of the plane in pixels, one pixel has size sizeof(T) * channels, with range [1, infinity)
heightThe height of the plane in pixels, with range [1, infinity)
channelsThe number of channels the plane has, with respect to the specified data type T, with range [1, infinity)
targetPaddingElementsThe optional number of padding elements at the end of each row this new plane will have, in elements, with range [0, infinity)
sourcePaddingElementsThe number of padding elements at the end of each row the given source memory has, in elements, with range [0, infinity)
makeCopyOfPaddingDataTrue, to copy the entire padding data of the source plane (both planes must have the same padding layout: targetPaddingElements == sourcePaddingElements); False, to skip the padding data when copying the plane
Template Parameters
TThe data type of each element

◆ Plane() [8/13]

template<typename T >
Ocean::Frame::Plane::Plane ( const T *  sourceDataToCopy,
const unsigned int  width,
const unsigned int  height,
const unsigned int  channels,
const unsigned int  sourcePaddingElements,
const CopyMode  copyMode 
)
inlinenoexcept

Creates a new plane object by making a copy of the given memory.

Parameters
sourceDataToCopyThe source data to be copied, must be valid
widthThe width of the plane in pixels, one pixel has size sizeof(T) * channels, with range [1, infinity)
heightThe height of the plane in pixels, with range [1, infinity)
channelsThe number of channels the plane has, with respect to the specified data type T, with range [1, infinity)
sourcePaddingElementsThe number of padding elements at the end of each row the given source memory has, in elements, with range [0, infinity)
copyModeThe copy mode to be applied
Template Parameters
TThe data type of each element

◆ ~Plane()

Ocean::Frame::Plane::~Plane ( )
inline

Destructs a Plane object.

◆ Plane() [9/13]

Ocean::Frame::Plane::Plane ( const unsigned int  width,
const unsigned int  height,
const unsigned int  channels,
const unsigned int  elementTypeSize,
const void *  constData,
void *  data,
const unsigned int  paddingElements 
)
inlineprotectednoexcept

Creates a new plane object which is not creating a copy of the given memory.

Instead, the memory pointer is just used.

Parameters
widthThe width of the plane, in pixel, with range [0, infinity)
heightThe height of the plane, in pixel, with range [0, infinity)
channelsThe channels of the plane, with range [0, infinity)
elementTypeSizeThe size of each element in bytes, which is sizeof(T), with range [1, infinity)
constDataThe value for constData to be set
dataThe value for data to be set
paddingElementsThe optional number of padding elements at the end of each row, in elements, with range [0, infinity)

◆ Plane() [10/13]

Ocean::Frame::Plane::Plane ( const unsigned int  width,
const unsigned int  height,
const unsigned int  channels,
const unsigned int  elementTypeSize,
const void *  dataToUse,
const unsigned int  paddingElements 
)
protectednoexcept

Creates a new plane object which is not creating a copy of the given memory.

Instead, the memory pointer is just used.

Parameters
widthThe width of the plane, in pixel, with range [0, infinity)
heightThe height of the plane, in pixel, with range [0, infinity)
channelsThe channels of the plane, with range [0, infinity)
elementTypeSizeThe size of each element in bytes, which is sizeof(T), with range [1, infinity)
dataToUseMemory pointer of the read-only memory which will not be copied, must be valid
paddingElementsThe number of padding elements at the end of each row, in elements, with range [0, infinity)

◆ Plane() [11/13]

Ocean::Frame::Plane::Plane ( const unsigned int  width,
const unsigned int  height,
const unsigned int  channels,
const unsigned int  elementTypeSize,
void *  dataToUse,
const unsigned int  paddingElements 
)
protectednoexcept

Creates a new plane object which is not creating a copy of the given memory.

Instead, the memory pointer is just used.

Parameters
widthThe width of the plane, in pixel, with range [0, infinity)
heightThe height of the plane, in pixel, with range [0, infinity)
channelsThe channels of the plane, with range [0, infinity)
elementTypeSizeThe size of each element in bytes, which is sizeof(T), with range [1, infinity)
dataToUseMemory pointer of the read-only memory which will not be copied, must be valid
paddingElementsThe number of padding elements at the end of each row, in elements, with range [0, infinity)

◆ Plane() [12/13]

Ocean::Frame::Plane::Plane ( const unsigned int  width,
const unsigned int  height,
const unsigned int  channels,
const unsigned int  elementTypeSize,
const void *  sourceDataToCopy,
const unsigned int  targetPaddingElements,
const unsigned int  sourcePaddingElements,
const bool  makeCopyOfPaddingData = false 
)
protectednoexcept

Creates a new plane object by making a copy of the given memory.

Parameters
widthThe width of the plane in pixels, one pixel has size sizeof(T) * channels, with range [1, infinity)
heightThe height of the plane in pixels, with range [1, infinity)
channelsThe number of channels the plane has, with respect to the specified data type, with range [1, infinity)
elementTypeSizeThe size of each element in bytes, which is sizeof(T), with range [1, infinity)
sourceDataToCopyThe source data to be copied, must be valid
targetPaddingElementsThe number of padding elements at the end of each row this new plane will have, in elements, with range [0, infinity)
sourcePaddingElementsThe number of padding elements at the end of each row the given source memory has, in elements, with range [0, infinity)
makeCopyOfPaddingDataTrue, to copy the entire padding data of the source plane (both planes must have the same padding layout: targetPaddingElements == sourcePaddingElements); False, to skip the padding data when copying the plane

◆ Plane() [13/13]

Ocean::Frame::Plane::Plane ( const unsigned int  width,
const unsigned int  height,
const unsigned int  channels,
const unsigned int  elementTypeSize,
const void *  sourceDataToCopy,
const unsigned int  sourcePaddingElements,
const CopyMode  copyMode 
)
protectednoexcept

Creates a new plane object by making a copy of the given memory.

Parameters
widthThe width of the plane in pixels, one pixel has size sizeof(T) * channels, with range [1, infinity)
heightThe height of the plane in pixels, with range [1, infinity)
channelsThe number of channels the plane has, with respect to the specified data type, with range [1, infinity)
elementTypeSizeThe size of each element in bytes, which is sizeof(T), with range [1, infinity)
sourceDataToCopyThe source data to be copied, must be valid
sourcePaddingElementsThe number of padding elements at the end of each row the given source memory has, in elements, with range [0, infinity)
copyModeThe copy mode to be applied

Member Function Documentation

◆ alignedMemory()

static void* Ocean::Frame::Plane::alignedMemory ( const size_t  size,
const size_t  alignment,
void *&  alignedData 
)
static

Allocates memory with specific byte alignment.

Parameters
sizeThe size of the resulting buffer in bytes, with range [0, infinity)
alignmentThe requested byte alignment, with range [1, infinity)
alignedDatathe resulting pointer to the aligned memory
Returns
The allocated memory with arbitrary alignment

◆ bytesPerPixel()

unsigned int Ocean::Frame::Plane::bytesPerPixel ( ) const
inline

Returns the number of bytes which is used for each pixel.

Returns
The number of bytes, with range [1, infinity), 0 if unknown

◆ calculateBytesPerPixel()

unsigned int Ocean::Frame::Plane::calculateBytesPerPixel ( ) const
protected

Calculates the number of bytes per pixel.

Returns
The number of bytes, with range [1, infinity), 0 if unknown

◆ calculateStrideBytes()

unsigned int Ocean::Frame::Plane::calculateStrideBytes ( ) const
inlineprotected

Calculates the number of bytes between the start positions of two consecutive rows, in bytes.

Returns
The number of bytes, with range [width * bytesPerPlanePixel, infinity).

◆ channels()

unsigned int Ocean::Frame::Plane::channels ( ) const
inline

Returns the channels of the plane.

Returns
The plane's channels, with range [0, infinity)

◆ constdata()

template<typename T >
const T * Ocean::Frame::Plane::constdata ( ) const
inline

Returns the read-only memory pointer to this plane with a specific data type compatible with elementTypeSize().

Returns
The plane's read-only memory pointer, nullptr if this plane is invalid
Template Parameters
Tthe data type of the resulting memory pointer, with sizeof(T) == elementTypeSize()

◆ copy() [1/2]

bool Ocean::Frame::Plane::copy ( const Plane sourcePlane,
const AdvancedCopyMode  advancedCopyMode = ACM_COPY_KEEP_LAYOUT_DO_NOT_COPY_PADDING_DATA,
const bool  reallocateIfNecessary = true 
)

Copies data from another plane into this plane.

If this plane does not have a compatible memory, or if this plane's memory is not writable, reallocation will be done if reallocateIfNecessary == true.

Parameters
sourcePlaneThe source plane from which the memory will be copied, an invalid plane to release this plane
advancedCopyModeThe copy mode specifying whether the source memory is used or copied
reallocateIfNecessaryTrue, to reallocate new memory if this plane is not compatible with the source plane; False, to prevent a reallocation and to skip to copy the source plane
Returns
True, if succeeded

◆ copy() [2/2]

void Ocean::Frame::Plane::copy ( const void *  sourceData,
const unsigned int  sourceStrideBytes,
const unsigned int  sourcePaddingElements,
const bool  makeCopyOfPaddingData = false 
)
protected

Copies memory into this plane which has compatible memory already.

Parameters
sourceDataThe source data from a compatible plane, must be valid
sourceStrideBytesThe number of bytes between the start positions of two consecutive rows in the source plane, in bytes, with range [strideBytes(), infinity)
sourcePaddingElementsThe number of padding elements at the end of each row, in elements, with range [0, infinity)
makeCopyOfPaddingDataTrue, to copy the entire padding data of the source plane (this plane mast have the same padding layout); False, to skip the padding data when copying the plane

◆ data()

template<typename T >
T * Ocean::Frame::Plane::data ( )
inline

Returns the writable memory pointer to this plane with a specific data type compatible with elementTypeSize().

Returns
The plane's writable memory pointer, nullptr if this plane is not writable or invalid
Template Parameters
Tthe data type of the resulting memory pointer, with sizeof(T) == elementTypeSize()

◆ elementTypeSize()

unsigned int Ocean::Frame::Plane::elementTypeSize ( ) const
inline

Returns the size of each element of this plane.

Returns
The element size, in bytes

◆ height()

unsigned int Ocean::Frame::Plane::height ( ) const
inline

Returns the height of the plane in pixel.

Returns
The plane's height, in pixel, with range [0, infinity)

◆ isCompatibleWithDataType()

template<typename T >
bool Ocean::Frame::Plane::isCompatibleWithDataType ( ) const
inline

Returns whether this plane is compatible with a given element data type.

Template Parameters
TThe data type to be checked
Returns
True, if so

◆ isContinuous()

bool Ocean::Frame::Plane::isContinuous ( ) const
inline

Returns whether this plane is based on continuous memory and thus does not have any padding at the end of rows.

Returns
True, if so

◆ isOwner()

bool Ocean::Frame::Plane::isOwner ( ) const
inline

Returns whether this plane is the owner of the memory.

Returns
True, if the plane is the owner; False, if someone else is the owner

◆ isReadOnly()

bool Ocean::Frame::Plane::isReadOnly ( ) const
inline

Returns whether this plane holds read-only memory.

Returns
True, if the memory of the plane is not writable

◆ isValid()

bool Ocean::Frame::Plane::isValid ( ) const
inline

Returns whether this plane holds valid data.

Returns
True, if so; False, if the plane is empty

◆ operator=() [1/2]

Plane& Ocean::Frame::Plane::operator= ( const Plane plane)
noexcept

Copy operator.

This plane will have the same stride/padding layout. However, the padding memory will not be copied. If the source plane is owner of the memory, this plane will be owner of an own copy of the memory. If the source plane is not the owner of the memory, this plane will also not be the owner but will use the memory of the source plane as well.

Parameters
planeThe plane to be copied
Returns
Reference to this object

◆ operator=() [2/2]

Plane& Ocean::Frame::Plane::operator= ( Plane &&  plane)
noexcept

Move operator.

Parameters
planeThe plane to be moved
Returns
The reference to this object

◆ paddingBytes()

unsigned int Ocean::Frame::Plane::paddingBytes ( ) const
inline

Returns the number of padding bytes at the end of each plane row, in bytes.

This function actually returns paddingElements() * elementTypeSize().

Returns
The number of padding bytes, with range [0, infinity)
See also
paddingElements().

◆ paddingElements()

unsigned int Ocean::Frame::Plane::paddingElements ( ) const
inline

Returns the number of padding elements at the end of each plane row, in elements.

Returns
The number of padding elements, with range [0, infinity)
See also
paddingBytes().

◆ release()

void Ocean::Frame::Plane::release ( )

Releases this plane and all resources of this plane.

◆ size()

unsigned int Ocean::Frame::Plane::size ( ) const
inline

Returns the number of bytes necessary for the entire plane data including optional padding elements at the end of each row.

This function actually returns strideBytes() * height().

Returns
Plane size in bytes, with range [0, infinity)

◆ strideBytes()

unsigned int Ocean::Frame::Plane::strideBytes ( ) const
inline

Returns the number of bytes between the start positions of two consecutive rows, in bytes.

Returns
The number of bytes, with range [width * bytesPerPlanePixel, infinity)

◆ strideElements()

unsigned int Ocean::Frame::Plane::strideElements ( ) const
inline

Returns the number of elements between the start positions of two consecutive rows, in elements.

This function actually returns width * channels + paddingElements.

Returns
The number of elements, with range [width * elementsPerPixel, infinity)

◆ width()

unsigned int Ocean::Frame::Plane::width ( ) const
inline

Returns the width of the plane in pixel.

Returns
The plane's width, in pixel, with range [0, infinity)

◆ widthBytes()

unsigned int Ocean::Frame::Plane::widthBytes ( ) const
inline

Returns the width of the plane in bytes, the width does not contain optional padding elements.

This is the number of bytes in which image data is stored (the number of bytes between start of a row and start of the padding elements):

widthBytes == width * channels * elementTypeSize() == strideBytes - elementTypeSize() * paddingElements()
Returns
The number of bytes, with range [0, infinity)

◆ widthElements()

unsigned int Ocean::Frame::Plane::widthElements ( ) const
inline

Returns the width of the plane in elements, the width does not contain optional padding elements.

This is the number of elements in which image data is stored (the number of elements between start of a row and start of the padding elements):

widthElements == width * channels == strideElements() - paddingElements()
Returns
The number of elements, with range [0, infinity)

Friends And Related Function Documentation

◆ Frame

friend class Frame
friend

Field Documentation

◆ allocatedData_

void* Ocean::Frame::Plane::allocatedData_ = nullptr
protected

The pointer to the memory which this plane has allocated, this pointer is pointing to the memory which needs to be freed when disposing the plane object, nullptr if the plane is not owner of the memory.

◆ bytesPerPixel_

unsigned int Ocean::Frame::Plane::bytesPerPixel_ = 0u
protected

The number of bytes per pixel, with range [1, infinity), 0 if unknown.

◆ channels_

unsigned int Ocean::Frame::Plane::channels_ = 0u
protected

The number of channels the plane has, with range [0, infinity).

◆ constData_

const void* Ocean::Frame::Plane::constData_ = nullptr
protected

The pointer to the read-only memory of the plane (not the pointer to the allocated memory), nullptr, if the plane is not read-only, or invalid.

◆ data_

void* Ocean::Frame::Plane::data_ = nullptr
protected

The pointer to the writable memory of the plane (not the pointer to the allocated memory), nullptr if the plane is not writable.

◆ elementTypeSize_

unsigned int Ocean::Frame::Plane::elementTypeSize_ = 0u
protected

The size of each element of this plane, in bytes, with range [0, infinity).

◆ height_

unsigned int Ocean::Frame::Plane::height_ = 0u
protected

The height of the plane in pixel, with range [0, infinity).

◆ paddingElements_

unsigned int Ocean::Frame::Plane::paddingElements_ = 0u
protected

The number of padding elements at the end of each plane row, in elements, with range [0, infinity).

◆ strideBytes_

unsigned int Ocean::Frame::Plane::strideBytes_ = 0u
protected

The number of bytes between the start positions of two consecutive rows, in bytes, identical to '(width_ * channels_ + paddingElements_) * elementTypeSize_`.

◆ width_

unsigned int Ocean::Frame::Plane::width_ = 0u
protected

The width of the plane in pixel, with range [0, infinity).


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