EdgeVisDecoderSDK::RGBFrame Class Reference

Detailed Description

An RGBFrame is designed for transforming YCbCr colour space frames into RGB colour space frames.

Frames in this format may be useful for saving as .BMP formatted files, for displaying on screen or for image processing. This class is required to convert the default output format of the video decompression process from YCbCr to RGB. We create an instance of this object and then call the Convert() method with a YCbCr frame as a parameter. We can then access the RGB version of the image after conversion.

The RGBFrame is intended to be a reusable object. Convert can be called multiple times and the RGBFrame will be updated to should there be a change in the size of the image. Note that the properties BytesPerPixel, FlipVeritical and FlipHorizontal are intended to be changed before Convert() is called. Changing these values will invalidate the current bitmap image until Convert() is called and new RGB image data is created within the object.

Availability

Available in version 6.0 of Decoder SDK. Requires a server version greater than 6.0

#include <RGBFrame.h>

Public Member Functions

DB_EDGEVIS_SDK RGBFrame ()
 Creates an empty RGBFrame.
 
DB_EDGEVIS_SDK bool Convert (YCbCrFrame &yCbCrFrame, RGBFormat format, bool correctAspect)
 Converts the supplied planar YCbCr frame to an RGBFrame which will be stored in this object. More...
 
DB_EDGEVIS_SDK bool Convert (int32_t width, int32_t height, uint8_t *y_plane, uint8_t *cb_plane, uint8_t *cr_plane, EdgeVisSDKCore::AspectRatio aspect, int64_t ts, int64_t dts, RGBFormat format)
 Converts the supplied planar YCbCr frame to an RGBFrame which will be stored in this object. More...
 
DB_EDGEVIS_SDK int32_t GetBytesPerPel () const
 Get the number of bytes per pixel. More...
 
DB_EDGEVIS_SDK RGBFormat GetFormat () const
 Get the RGB format for this RGB frame. More...
 
void SetHeaderSize (int32_t header_size)
 Set the header size that will be allocated before the rgb frame, this allows platform specific users of this class to add headers such as a BMP file header without having to reallocate the memory of the frame. More...
 
DB_EDGEVIS_SDK int32_t GetHeaderSize () const
 Get the value that has been set for this frame's header size, the default value is 0. More...
 
DB_EDGEVIS_SDK int64_t GetTimeStamp () const
 Gets the frame's time stamp. More...
 
DB_EDGEVIS_SDK byte_array GetBytes () const
 Get a pointer to the byte array representing the entire RGBFrame, including the header. More...
 
DB_EDGEVIS_SDK byte_array GetPixelBytes () const
 Get a pointer to the byte array representing the RGBFrame pixels. More...
 
DB_EDGEVIS_SDK void Save (const std::string &path) const
 Save the image to a file location. More...
 
- Public Member Functions inherited from EdgeVisDecoderSDK::VideoData
DB_EDGEVIS_SDK int32_t GetWidth () const
 Return the width of the image. More...
 
DB_EDGEVIS_SDK int32_t GetHeight () const
 Return the height of the image. More...
 
DB_EDGEVIS_SDK int64_t GetEncodeTimeStamp () const
 Return the timestamp of the image. More...
 
DB_EDGEVIS_SDK int64_t GetDisplayTimeStamp () const
 Return the timestamp of the image. More...
 
DB_EDGEVIS_SDK StreamTimestampContext GetTimeStampContext () const
 Return context of the image timestamp. More...
 
DB_EDGEVIS_SDK int64_t GetViewerTimeoutTimeStamp () const
 Return the timestamp at which the stream will timeout. More...
 
DB_EDGEVIS_SDK int32_t GetInput () const
 Returns what video input this image is coming from. More...
 
DB_EDGEVIS_SDK EdgeVisSDKCore::AspectRatio GetAspectRatio () const
 Returns the aspect ratio of this image. More...
 
DB_EDGEVIS_SDK bool IsCached () const
 This flag determines if the image has been cached at the remote encoder end for the Full Resolution. More...
 
DB_EDGEVIS_SDK ArchivePlaybackSpeed GetArchivePlaybackSpeed () const
 Get the playback speed of the stream. More...
 
DB_EDGEVIS_SDK int32_t GetArchivePlaybackSpeedMultiplier () const
 Get the playback speed multiplier of the stream. More...
 
DB_EDGEVIS_SDK VideoFrameLayout GetVideoFrameLayout () const
 Returns the VideoFrameLayout describing the sources used to construct the received YCbCrFrame for the specified input. More...
 
- Public Member Functions inherited from EdgeVisDecoderSDK::StreamData
DB_EDGEVIS_SDK std::wstring TypeName () const
 Returns the type a StreamData this it. More...
 

Member Function Documentation

DB_EDGEVIS_SDK bool EdgeVisDecoderSDK::RGBFrame::Convert ( YCbCrFrame yCbCrFrame,
RGBFormat  format,
bool  correctAspect 
)

Converts the supplied planar YCbCr frame to an RGBFrame which will be stored in this object.

The RGB frame will use the dimensions of the supplied YCbCr frame but will use the bytes per pixel specified when creating this RGBFrame. Details of the YCbCr format can be found here: http://www.fourcc.org/yuv.php#IYUV

Parameters
yCbCrFrameThe YCbCrFrame to convert to RGB.
formatThe RGBFormat to use for the conversion
correctAspectCorrect the image for aspect ration
Returns
Returns true for success, false for failure
DB_EDGEVIS_SDK bool EdgeVisDecoderSDK::RGBFrame::Convert ( int32_t  width,
int32_t  height,
uint8_t *  y_plane,
uint8_t *  cb_plane,
uint8_t *  cr_plane,
EdgeVisSDKCore::AspectRatio  aspect,
int64_t  ts,
int64_t  dts,
RGBFormat  format 
)

Converts the supplied planar YCbCr frame to an RGBFrame which will be stored in this object.

The RGB frame will use the dimensions of the supplied YCbCr frame but will use the bytes per pixel specified when creating this RGBFrame. Details of the YCbCr format can be found here:

Parameters
widthThe width in pixels of the frame.
heightThe height in pixels of the frame
y_planeThe y luminance plane
cb_planeThe cb chroma plane
cr_planeThe cr chroma plane
aspectCorrect the image for aspect ration
formatThe RGBFormat to use for the conversion
Returns
Returns true for success, false for failure
DB_EDGEVIS_SDK int32_t EdgeVisDecoderSDK::RGBFrame::GetBytesPerPel ( ) const

Get the number of bytes per pixel.

Returns
The number of bytes per pixel
DB_EDGEVIS_SDK RGBFormat EdgeVisDecoderSDK::RGBFrame::GetFormat ( ) const

Get the RGB format for this RGB frame.

Returns
The current RGB format
void EdgeVisDecoderSDK::RGBFrame::SetHeaderSize ( int32_t  header_size)

Set the header size that will be allocated before the rgb frame, this allows platform specific users of this class to add headers such as a BMP file header without having to reallocate the memory of the frame.

Parameters
header_sizeThe desired header_size in bytes
DB_EDGEVIS_SDK int32_t EdgeVisDecoderSDK::RGBFrame::GetHeaderSize ( ) const

Get the value that has been set for this frame's header size, the default value is 0.

Returns
The current header size in bytes
DB_EDGEVIS_SDK int64_t EdgeVisDecoderSDK::RGBFrame::GetTimeStamp ( ) const

Gets the frame's time stamp.

This is the time the frame was encoded at the remote end

See also
GetDisplayTimeStamp()
Returns
The frame timestamp in milliseconds since the epoch.
DB_EDGEVIS_SDK byte_array EdgeVisDecoderSDK::RGBFrame::GetBytes ( ) const

Get a pointer to the byte array representing the entire RGBFrame, including the header.

Returns
The entire frame
DB_EDGEVIS_SDK byte_array EdgeVisDecoderSDK::RGBFrame::GetPixelBytes ( ) const

Get a pointer to the byte array representing the RGBFrame pixels.

Returns
The pixels!
DB_EDGEVIS_SDK void EdgeVisDecoderSDK::RGBFrame::Save ( const std::string &  path) const

Save the image to a file location.

Parameters
pathThe file name to save to

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