Ocean
Ocean::Media::Special::ImageOcn Class Reference

This class implements read and write functions for Ocean frames. More...

Static Public Member Functions

static Frame decodeImage (const void *buffer, const size_t size)
 Decodes a OCN image from a given binary buffer. More...
 
static bool encodeImage (const Frame &frame, std::vector< uint8_t > &buffer)
 Encodes a given frame as OCN image to a resulting buffer. More...
 

Static Protected Member Functions

template<typename T >
static bool readValue (const uint8_t *&data, size_t &remainingSize, T &value)
 Reads a value from memory. More...
 
static bool readValue (const uint8_t *&data, size_t &remainingSize, const size_t numberCharacters, std::string &value)
 Reads a string from memory. More...
 
template<typename T >
static bool writeValue (const T &value, uint8_t *&data, size_t &remainingSize)
 Writes a value to memory. More...
 
static bool writeValue (const std::string &value, const size_t numberCharacters, uint8_t *&data, size_t &remainingSize)
 Writes a string to memory and fills remaining memory with zero values. More...
 

Static Protected Attributes

static constexpr size_t headerMagicNumberSize_ = 4
 The size of the magic number header part in bytes. More...
 
static constexpr size_t headerPixelFormatSize_ = 40
 The size of the pixel format header part in bytes. More...
 
static constexpr size_t headerPixelOriginSize_ = 16
 The size of the pixel origin header part in bytes. More...
 
static constexpr size_t headerDataTypeSize_ = 32
 The size of the data type header part in bytes. More...
 

Detailed Description

This class implements read and write functions for Ocean frames.

Member Function Documentation

◆ decodeImage()

static Frame Ocean::Media::Special::ImageOcn::decodeImage ( const void *  buffer,
const size_t  size 
)
static

Decodes a OCN image from a given binary buffer.

Parameters
bufferThe buffer from which the image will be loaded, must be valid
sizeThe size of the given buffer in bytes, with range [1, infinity)
Returns
The frame containing the image information, an invalid frame if the image could not be loaded

◆ encodeImage()

static bool Ocean::Media::Special::ImageOcn::encodeImage ( const Frame frame,
std::vector< uint8_t > &  buffer 
)
static

Encodes a given frame as OCN image to a resulting buffer.

Parameters
frameThe frame to be written, must be valid
bufferThe resulting buffer storing the binary information of the OCN image
Returns
True, if succeeded

◆ readValue() [1/2]

static bool Ocean::Media::Special::ImageOcn::readValue ( const uint8_t *&  data,
size_t &  remainingSize,
const size_t  numberCharacters,
std::string &  value 
)
staticprotected

Reads a string from memory.

Parameters
dataThe memory from which the string will be read, will be moved, must be valid
remainingSizeThe remaining size of the memory, in bytes, will be adjusted, with range [numberCharacters, infinity)
numberCharactersThe maximal size of the string to read, in bytes, with range [1, remainingSize]
valueThe resulting string
Returns
True, if succeeded

◆ readValue() [2/2]

template<typename T >
static bool Ocean::Media::Special::ImageOcn::readValue ( const uint8_t *&  data,
size_t &  remainingSize,
T &  value 
)
staticprotected

Reads a value from memory.

Parameters
dataThe memory from which the value will be read, will be moved, must be valid
remainingSizeThe remaining size of the memory, in bytes, will be adjusted, with range [sizeof(T), infinity)
valueThe resulting value
Returns
True, if succeeded
Template Parameters
TThe data type of the value

◆ writeValue() [1/2]

static bool Ocean::Media::Special::ImageOcn::writeValue ( const std::string &  value,
const size_t  numberCharacters,
uint8_t *&  data,
size_t &  remainingSize 
)
staticprotected

Writes a string to memory and fills remaining memory with zero values.

Parameters
valueThe string to write
numberCharactersThe number of characters that will be written, with range [value.size(), infinity)
dataThe memory receiving the value, will be moved, must be valid
remainingSizeThe remaining size of the memory, in bytes, will be adjusted, with range [numberCharacters, infinity)
Returns
True, if succeeded

◆ writeValue() [2/2]

template<typename T >
static bool Ocean::Media::Special::ImageOcn::writeValue ( const T &  value,
uint8_t *&  data,
size_t &  remainingSize 
)
staticprotected

Writes a value to memory.

Parameters
valueThe value to write
dataThe memory receiving the value, will be moved, must be valid
remainingSizeThe remaining size of the memory, in bytes, will be adjusted, with range [sizeof(T), infinity)
Returns
True, if succeeded
Template Parameters
TThe data type of the value

Field Documentation

◆ headerDataTypeSize_

constexpr size_t Ocean::Media::Special::ImageOcn::headerDataTypeSize_ = 32
staticconstexprprotected

The size of the data type header part in bytes.

◆ headerMagicNumberSize_

constexpr size_t Ocean::Media::Special::ImageOcn::headerMagicNumberSize_ = 4
staticconstexprprotected

The size of the magic number header part in bytes.

◆ headerPixelFormatSize_

constexpr size_t Ocean::Media::Special::ImageOcn::headerPixelFormatSize_ = 40
staticconstexprprotected

The size of the pixel format header part in bytes.

◆ headerPixelOriginSize_

constexpr size_t Ocean::Media::Special::ImageOcn::headerPixelOriginSize_ = 16
staticconstexprprotected

The size of the pixel origin header part in bytes.


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