Simd Library Documentation.

Home | Release Notes | Download | Documentation | Issues | GitHub | SourceForge

The Frame structure provides storage and manipulation of frames (multiplanar images). More...

Public Types

enum  Format {
  None = 0,
  Nv12,
  Yuv420p,
  Bgra32,
  Bgr24,
  Gray8
}
 
typedef A< uint8_t > Allocator
 

Public Member Functions

 Frame ()
 
 Frame (const Frame &frame)
 
 Frame (const View< A > &view, bool flipped_=false, double timestamp_=0)
 
 Frame (size_t width_, size_t height_, Format format_, bool flipped_=false, double timestamp_=0)
 
 Frame (const Point< ptrdiff_t > &size, Format format_, bool flipped_=false, double timestamp_=0)
 
 ~Frame ()
 
FrameClone () const
 
Frameoperator= (const Frame &frame)
 
FrameRef ()
 
void Recreate (size_t width_, size_t height_, Format format_)
 
void Recreate (const Point< ptrdiff_t > &size, Format format_)
 
Frame Region (const ptrdiff_t &left, const ptrdiff_t &top, const ptrdiff_t &right, const ptrdiff_t &bottom) const
 
Frame Region (ptrdiff_t &left, ptrdiff_t &top, ptrdiff_t &right, ptrdiff_t &bottom) const
 
Frame Region (const Point< ptrdiff_t > &topLeft, const Point< ptrdiff_t > &bottomRight) const
 
Frame Region (Point< ptrdiff_t > &topLeft, Point< ptrdiff_t > &bottomRight) const
 
Frame Region (const Rectangle< ptrdiff_t > &rect) const
 
Frame Region (Rectangle< ptrdiff_t > &rect) const
 
Frame Flipped () const
 
Point< ptrdiff_t > Size () const
 
size_t DataSize () const
 
size_t Area () const
 
size_t PlaneCount () const
 

Static Public Member Functions

static size_t PlaneCount (Format format)
 

Data Fields

const size_t width
 A width of the frame.
 
const size_t height
 A height of the frame.
 
const Format format
 A pixel format types of the frame.
 
View< A > planes [PLANE_COUNT_MAX]
 Planes of the frame.
 
bool flipped
 A flag of vertically flipped image (false - frame point (0, 0) is placed at top left corner of the frame, true - frame point (0, 0) is placed at bottom left corner of the frame.
 
double timestamp
 A timestamp of the frame.
 

Static Public Attributes

static const size_t PLANE_COUNT_MAX = 4
 

Detailed Description

template<template< class > class A>
struct Simd::Frame< A >

The Frame structure provides storage and manipulation of frames (multiplanar images).

Related Functions.

Member Typedef Documentation

◆ Allocator

typedef A<uint8_t> Allocator

Allocator type definition.

Member Enumeration Documentation

◆ Format

enum Format

Describes pixel format types of a frame.

Enumerator
None 

An undefined pixel format.

Nv12 

Two planes (8-bit full size Y plane, 16-bit interlived half size UV plane) NV12 pixel format.

Yuv420p 

Three planes (8-bit full size Y plane, 8-bit half size U plane, 8-bit half size V plane) YUV420P pixel format.

Bgra32 

One plane 32-bit (4 8-bit channels) BGRA (Blue, Green, Red, Alpha) pixel format.

Bgr24 

One plane 24-bit (3 8-bit channels) BGR (Blue, Green, Red) pixel format.

Gray8 

One plane 8-bit gray pixel format.

Constructor & Destructor Documentation

◆ Frame() [1/5]

SIMD_INLINE Frame ( )

Creates a new empty Frame structure.

◆ Frame() [2/5]

SIMD_INLINE Frame ( const Frame< A > &  frame)

Creates a new Frame structure on the base of the other frame.

Note
This constructor is not create new frame! It only creates a reference to the same frame. If you want to create a copy then must use method Simd::FRame::Clone.
Parameters
[in]frame- an original frame.

◆ Frame() [3/5]

SIMD_INLINE Frame ( const View< A > &  view,
bool  flipped_ = false,
double  timestamp_ = 0 
)

Creates a new one plane Frame structure on the base of the image view.

Note
This constructor is not create new image frame! It only creates a reference to the same image. If you want to create a copy then must use method Simd::Frame::Clone.
Parameters
[in]view- an original image view.
[in]flipped_- a flag of vertically flipped image of created frame. It is equal to false by default.
[in]timestamp_- a timestamp of created frame. It is equal to 0 by default.

◆ Frame() [4/5]

SIMD_INLINE Frame ( size_t  width_,
size_t  height_,
Format  format_,
bool  flipped_ = false,
double  timestamp_ = 0 
)

Creates a new Frame structure with specified width, height and pixel format.

Parameters
[in]width_- a width of created frame.
[in]height_- a height of created frame.
[in]format_- a pixel format of created frame.
[in]flipped_- a flag of vertically flipped image of created frame. It is equal to false by default.
[in]timestamp_- a timestamp of created frame. It is equal to 0 by default.

◆ Frame() [5/5]

SIMD_INLINE Frame ( const Point< ptrdiff_t > &  size,
Format  format_,
bool  flipped_ = false,
double  timestamp_ = 0 
)

Creates a new Frame structure with specified width, height and pixel format.

Parameters
[in]size- a size (width and height) of created frame.
[in]format_- a pixel format of created frame.
[in]flipped_- a flag of vertically flipped image of created frame. It is equal to false by default.
[in]timestamp_- a timestamp of created frame. It is equal to 0 by default.

◆ ~Frame()

SIMD_INLINE ~Frame ( )

A Frame destructor.

Member Function Documentation

◆ Clone()

SIMD_INLINE Frame< A > * Clone ( ) const

Gets a copy of current frame.

Returns
a pointer to the new Frame structure. The user must free this pointer after usage.

◆ operator=()

SIMD_INLINE Frame< A > & operator= ( const Frame< A > &  frame)

Creates reference to other Frame structure.

Note
This function is not create copy of the frame! It only create a reference to the same frame.
Parameters
[in]frame- an original frame.
Returns
a reference to itself.

◆ Ref()

SIMD_INLINE Frame< A > & Ref ( )

Creates reference to itself.

Returns
a reference to itself.

◆ Recreate() [1/2]

SIMD_INLINE void Recreate ( size_t  width_,
size_t  height_,
Format  format_ 
)

Re-creates a Frame structure with specified width, height and pixel format.

Parameters
[in]width_- a width of re-created frame.
[in]height_- a height of re-created frame.
[in]format_- a pixel format of re-created frame.

◆ Recreate() [2/2]

SIMD_INLINE void Recreate ( const Point< ptrdiff_t > &  size,
Format  format_ 
)

Re-creates a Frame structure with specified width, height and pixel format.

Parameters
[in]size- a size (width and height) of re-created frame.
[in]format_- a pixel format of re-created frame.

◆ Region() [1/6]

SIMD_INLINE Frame< A > Region ( const ptrdiff_t &  left,
const ptrdiff_t &  top,
const ptrdiff_t &  right,
const ptrdiff_t &  bottom 
) const

Creates a new Frame structure which points to the region of current frame bounded by the rectangle with specified coordinates.

Parameters
[in]left- a left side of the region.
[in]top- a top side of the region.
[in]right- a right side of the region.
[in]bottom- a bottom side of the region.
Returns
- a new Frame structure which points to the region of frame.

◆ Region() [2/6]

SIMD_INLINE Frame< A > Region ( ptrdiff_t &  left,
ptrdiff_t &  top,
ptrdiff_t &  right,
ptrdiff_t &  bottom 
) const

Creates a new Frame structure which points to the region of current frame bounded by the rectangle with specified coordinates.

Parameters
[in,out]left- a left side of the required region. Returns the left side of the actual region.
[in,out]top- a top side of the required region. Returns the top side of the actual region.
[in,out]right- a right side of the required region. Returns the right side of the actual region.
[in,out]bottom- a bottom side of the required region. Returns the bottom side of the actual region.
Returns
- a new Frame structure which points to the region of frame.

◆ Region() [3/6]

SIMD_INLINE Frame< A > Region ( const Point< ptrdiff_t > &  topLeft,
const Point< ptrdiff_t > &  bottomRight 
) const

Creates a new Frame structure which points to the region of frame bounded by the rectangle with specified coordinates.

Parameters
[in]topLeft- a top-left corner of the region.
[in]bottomRight- a bottom-right corner of the region.
Returns
- a new Frame structure which points to the region of frame.

◆ Region() [4/6]

SIMD_INLINE Frame< A > Region ( Point< ptrdiff_t > &  topLeft,
Point< ptrdiff_t > &  bottomRight 
) const

Creates a new Frame structure which points to the region of frame bounded by the rectangle with specified coordinates.

Parameters
[in,out]topLeft- a top-left corner of the required region. Returns the top-left corner of the actual region.
[in,out]bottomRight- a bottom-right corner of the required region. Returns the bottom-right corner of the actual region.
Returns
- a new Frame structure which points to the region of frame.

◆ Region() [5/6]

SIMD_INLINE Frame< A > Region ( const Rectangle< ptrdiff_t > &  rect) const

Creates a new Frame structure which points to the region of frame bounded by the rectangle with specified coordinates.

Parameters
[in]rect- a rectangle which bound the region.
Returns
- a new Frame structure which points to the region of frame.

◆ Region() [6/6]

SIMD_INLINE Frame< A > Region ( Rectangle< ptrdiff_t > &  rect) const

Creates a new Frame structure which points to the region of frame bounded by the rectangle with specified coordinates.

Parameters
[in,out]rect- a rectangle which bound the required region. Returns the actual region.
Returns
- a new Frame structure which points to the region of frame.

◆ Flipped()

SIMD_INLINE Frame< A > Flipped ( ) const

Creates a new Frame structure which points to the vertically flipped frame.

Returns
- a new Frame structure which points to the flipped frame.

◆ Size()

SIMD_INLINE Point< ptrdiff_t > Size ( ) const

Gets size (width and height) of the frame.

Returns
- a new Point structure with frame width and height.

◆ DataSize()

SIMD_INLINE size_t DataSize ( ) const

Gets size in bytes required to store pixel data of current Frame structure.

Returns
- a size of data pixels in bytes.

◆ Area()

SIMD_INLINE size_t Area ( ) const

Gets area in pixels of of current Frame structure.

Returns
- a area of current Frame in pixels.

◆ PlaneCount() [1/2]

SIMD_INLINE size_t PlaneCount ( Format  format)
static

Gets number of planes in the frame for current pixel format.

Parameters
[in]format- a pixel format.
Returns
- a number of planes.

◆ PlaneCount() [2/2]

SIMD_INLINE size_t PlaneCount ( ) const

Gets number of planes for current frame.

Returns
- a number of planes.

Field Documentation

◆ PLANE_COUNT_MAX

const size_t PLANE_COUNT_MAX = 4
static

Maximal count of pixel planes in a frame.