VideoFormat.C File Reference

#include "Video/VideoFormat.H"
#include "Image/Dims.H"
#include "Util/StringConversions.H"
#include "Util/StringUtil.H"
#include "Util/log.H"
Include dependency graph for VideoFormat.C:

Go to the source code of this file.

Functions

std::string convertToString (const VideoFormat val)
 Conversion from VideoFormat to string.
void convertFromString (const std::string &orig, VideoFormat &val)
 Conversion from string to VideoFormat.
bool isSimplePackedMode (const VideoFormat vidformat)
 Check if the given mode is a simple packed pixel mode.
int getScanlineWidth (const VideoFormat vidformat, const int imgwidth)
 Get the width of a scanline in the given video format.
void getBytesPerPixelForMode (const VideoFormat vidformat, unsigned int *numer, unsigned int *denom)
 Get the bytes-per-pixel for the given mode as a rational number (numer/denom).
unsigned int getFrameSize (const VideoFormat vidformat, const Dims &imgdims)
 Get the size (in bytes) of a frame in the given video format.

Detailed Description

definitions of possible image grabbing modes

Definition in file VideoFormat.C.


Function Documentation

void convertFromString ( const std::string str,
VideoFormat val 
)

Conversion from string to VideoFormat.

The names used in the definition of the enum VideoFormat (minus the "VIDFMT_" prefix) will be returned.

The string is checked in a case-insensitive manner, so e.g. "YUV420P", "yuv420p", and "YuV420p" will all translate to VIDMFT_YUV420P.

Definition at line 89 of file VideoFormat.C.

References toUpperCase().

std::string convertToString ( const VideoFormat  val  ) 

Conversion from VideoFormat to string.

Use it, for example, if you got a grabmode as text from the command line and need to convert that to a VideoFormat value for the constructor. Text strings should match the symbolic names of the VideoFormat enum, minus the "VIDFMT_" prefix.

Definition at line 46 of file VideoFormat.C.

void getBytesPerPixelForMode ( const VideoFormat  vidformat,
unsigned int *  numer,
unsigned int *  denom 
)

Get the bytes-per-pixel for the given mode as a rational number (numer/denom).

Definition at line 187 of file VideoFormat.C.

References ASSERT.

Referenced by getFrameSize().

unsigned int getFrameSize ( const VideoFormat  vidformat,
const Dims imgdims 
)

Get the size (in bytes) of a frame in the given video format.

This will return a valid result for any video format, whether it is planar or packed.

Definition at line 232 of file VideoFormat.C.

References ASSERT, getBytesPerPixelForMode(), and Dims::sz().

Referenced by VideoFrame::fromStream(), VideoFrame::getBufSize(), VideoFrame::getFlippedHoriz(), VideoFrame::makeBobDeinterlaced(), MgzDecoder::readFrame(), MgzJDecoder::readFrame(), V4Lgrabber::start1(), and V4L2grabber::start1().

int getScanlineWidth ( const VideoFormat  vidformat,
const int  imgwidth 
)

Get the width of a scanline in the given video format.

This returns some multiple of the image width for packed formats, and returns -1 for planar formats (indicating that the video frame storage is not just a series of scanlines for that format).

Definition at line 143 of file VideoFormat.C.

Referenced by VideoFrame::makeBobDeinterlaced().

bool isSimplePackedMode ( const VideoFormat  vidformat  ) 

Check if the given mode is a simple packed pixel mode.

If false, the mode might be planar, or might be a "complex" packed mode that has values represented by less than a full byte (e.g. VIDFMT_RGB555 or VIDFMT_RGB565).

Definition at line 101 of file VideoFormat.C.

Referenced by BobDeinterlacer::start2().

Generated on Sun May 8 08:42:53 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3