Ocean
Ocean::Media::Special::ImagePfm Class Reference

This class implements read and write functions for PFM images. More...

Static Public Member Functions

static Frame decodeImage (const void *buffer, const size_t size)
 Decodes a PFM image from a given binary buffer. More...
 
static bool encodeImage (const Frame &frame, std::vector< uint8_t > &buffer)
 Encodes a given frame as PFM image to a resulting buffer. More...
 
static bool isPixelFormatSupported (const FrameType::PixelFormat pixelFormat)
 Returns whether a given pixel format is supported natively. More...
 
static bool isPixelOriginSupported (const FrameType::PixelOrigin pixelOrigin)
 Returns whether a given pixel origin is supported natively. More...
 
static bool isFrameTypeSupported (const FrameType::PixelFormat pixelFormat, const FrameType::PixelOrigin pixelOrigin)
 Returns whether a given pixel format together with a given pixel origin is supported natively. More...
 

Static Protected Member Functions

static bool readHeader (const uint8_t *&data, size_t &size, FrameType &frameType, bool &isLittleEndian)
 Reads the header of a PFM file. More...
 
static bool readValue (const uint8_t *&data, size_t &size, std::string &value)
 Reads one number value from a given data buffer. More...
 

Detailed Description

This class implements read and write functions for PFM images.

Member Function Documentation

◆ decodeImage()

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

Decodes a PFM 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::ImagePfm::encodeImage ( const Frame frame,
std::vector< uint8_t > &  buffer 
)
static

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

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

◆ isFrameTypeSupported()

bool Ocean::Media::Special::ImagePfm::isFrameTypeSupported ( const FrameType::PixelFormat  pixelFormat,
const FrameType::PixelOrigin  pixelOrigin 
)
inlinestatic

Returns whether a given pixel format together with a given pixel origin is supported natively.

Parameters
pixelFormatThe pixel format to be checked
pixelOriginThe pixel origin to be checked
Returns
True, if so; False, if a conversion will be necessary

◆ isPixelFormatSupported()

bool Ocean::Media::Special::ImagePfm::isPixelFormatSupported ( const FrameType::PixelFormat  pixelFormat)
inlinestatic

Returns whether a given pixel format is supported natively.

Parameters
pixelFormatThe pixel format to be checked
Returns
True, if so; False, if a conversion will be necessary

◆ isPixelOriginSupported()

bool Ocean::Media::Special::ImagePfm::isPixelOriginSupported ( const FrameType::PixelOrigin  pixelOrigin)
inlinestatic

Returns whether a given pixel origin is supported natively.

Parameters
pixelOriginThe pixel origin to be checked
Returns
True, if so; False, if a conversion will be necessary

◆ readHeader()

static bool Ocean::Media::Special::ImagePfm::readHeader ( const uint8_t *&  data,
size_t &  size,
FrameType frameType,
bool &  isLittleEndian 
)
staticprotected

Reads the header of a PFM file.

Parameters
dataThe data buffer, will be moved if the header could be read successfully, must be valid
sizeThe size of the buffer in bytes, will be reduced if the header could be read successfully, must be valid
frameTypeThe resulting frame type
isLittleEndianTrue, if the buffer provides the data with little endian encoding; False, if the buffer provides the data with big endian encoding
Returns
True, if succeeded

◆ readValue()

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

Reads one number value from a given data buffer.

The value ends with a space or a new line.

Parameters
dataThe data buffer, will be moved if the value could be read successfully, must be valid
sizeThe size of the buffer in bytes, will be reduced if the value could be read successfully, must be valid
valueThe resulting value
Returns
True, if succeeded

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