#include <vconvert.h>
Public Member Functions | |
PColourConverter (const PString &srcColourFormat, const PString &dstColourFormat, unsigned width, unsigned height) | |
BOOL | GetVFlipState () |
void | SetVFlipState (BOOL vFlipState) |
virtual BOOL | SetFrameSize (unsigned width, unsigned height) |
virtual BOOL | SetSrcFrameSize (unsigned width, unsigned height) |
virtual BOOL | SetDstFrameSize (unsigned width, unsigned height, BOOL bScale) |
const PString & | GetSrcColourFormat () |
const PString & | GetDstColourFormat () |
PINDEX | GetMaxSrcFrameBytes () |
PINDEX | GetMaxDstFrameBytes () |
virtual BOOL | Convert (const BYTE *srcFrameBuffer, BYTE *dstFrameBuffer, PINDEX *bytesReturned=NULL)=0 |
virtual BOOL | Convert (const BYTE *srcFrameBuffer, BYTE *dstFrameBuffer, unsigned int srcFrameBytes, PINDEX *bytesReturned=NULL)=0 |
virtual BOOL | ConvertInPlace (BYTE *frameBuffer, PINDEX *bytesReturned=NULL, BOOL noIntermediateFrame=FALSE) |
BOOL | GetDstFrameSize (unsigned &width, unsigned &height) const |
BOOL | GetSrcFrameSize (unsigned &width, unsigned &height) const |
Static Public Member Functions | |
static PColourConverter * | Create (const PString &srcColourFormat, const PString &dstColourFormat, unsigned width, unsigned height) |
Protected Attributes | |
PString | srcColourFormat |
PString | dstColourFormat |
unsigned | srcFrameWidth |
unsigned | srcFrameHeight |
unsigned | srcFrameBytes |
unsigned | dstFrameBytes |
unsigned | dstFrameWidth |
unsigned | dstFrameHeight |
BOOL | scaleNotCrop |
BOOL | verticalFlip |
PBYTEArray | intermediateFrameStore |
struct jdec_private * | jdec |
Friends | |
class | PColourConverterRegistration |
PColourConverter::PColourConverter | ( | const PString & | srcColourFormat, | |
const PString & | dstColourFormat, | |||
unsigned | width, | |||
unsigned | height | |||
) |
Create a new converter.
srcColourFormat | Name of source colour format |
dstColourFormat | Name of destination colour format |
width | Width of frame |
height | Height of frame |
BOOL PColourConverter::GetVFlipState | ( | ) | [inline] |
Get the video conversion vertical flip state
void PColourConverter::SetVFlipState | ( | BOOL | vFlipState | ) | [inline] |
Set the video conversion vertical flip state
virtual BOOL PColourConverter::SetFrameSize | ( | unsigned | width, | |
unsigned | height | |||
) | [virtual] |
Set the frame size to be used.
Default behaviour calls SetSrcFrameSize() and SetDstFrameSize().
width | New width of frame |
height | New height of frame |
virtual BOOL PColourConverter::SetSrcFrameSize | ( | unsigned | width, | |
unsigned | height | |||
) | [virtual] |
Set the source frame size to be used.
Default behaviour sets the srcFrameWidth and srcFrameHeight variables and recalculates the frame buffer size in bytes then returns TRUE if the size was calculated correctly.
width | New width of frame |
height | New height of frame |
virtual BOOL PColourConverter::SetDstFrameSize | ( | unsigned | width, | |
unsigned | height, | |||
BOOL | bScale | |||
) | [virtual] |
Set the destination frame size to be used.
Default behaviour sets the dstFrameWidth and dstFrameHeight variables, and the scale / crop preference. It then recalculates the frame buffer size in bytes then returns TRUE if the size was calculated correctly.
width | New width of target frame |
height | New height of target frame |
bScale | TRUE if scaling is preferred over crop |
const PString& PColourConverter::GetSrcColourFormat | ( | ) | [inline] |
Get the source colour format.
const PString& PColourConverter::GetDstColourFormat | ( | ) | [inline] |
Get the destination colour format.
PINDEX PColourConverter::GetMaxSrcFrameBytes | ( | ) | [inline] |
Get the maximum frame size in bytes for source frames.
Note a particular device may be able to provide variable length frames (eg motion JPEG) so will be the maximum size of all frames.
PINDEX PColourConverter::GetMaxDstFrameBytes | ( | ) | [inline] |
Get the maximum frame size in bytes for destination frames.
Note a particular device may be able to provide variable length frames (eg motion JPEG) so will be the maximum size of all frames.
virtual BOOL PColourConverter::Convert | ( | const BYTE * | srcFrameBuffer, | |
BYTE * | dstFrameBuffer, | |||
PINDEX * | bytesReturned = NULL | |||
) | [pure virtual] |
Convert from one colour format to another. This version will copy the data from one frame buffer to another. An implementation of this function should allow for the case of where srcFrameBuffer and dstFrameBuffer are the same, if the conversion algorithm allows for that to occur without an intermediate frame store.
The function should return FALSE if srcFrameBuffer and dstFrameBuffer are the same and that form pf conversion is not allowed
srcFrameBuffer | Frame store for source pixels |
dstFrameBuffer | Frame store for destination pixels |
bytesReturned | Bytes written to dstFrameBuffer |
Implemented in PSynonymColour.
virtual BOOL PColourConverter::Convert | ( | const BYTE * | srcFrameBuffer, | |
BYTE * | dstFrameBuffer, | |||
unsigned int | srcFrameBytes, | |||
PINDEX * | bytesReturned = NULL | |||
) | [pure virtual] |
srcFrameBuffer | Frame store for source pixels |
dstFrameBuffer | Frame store for destination pixels |
bytesReturned | Bytes written to dstFrameBuffer |
Implemented in PSynonymColour.
virtual BOOL PColourConverter::ConvertInPlace | ( | BYTE * | frameBuffer, | |
PINDEX * | bytesReturned = NULL , |
|||
BOOL | noIntermediateFrame = FALSE | |||
) | [virtual] |
Convert from one colour format to another. This version will copy the data from one frame buffer to the same frame buffer. Not all conversions can do this so an intermediate store and copy may be required. If the noIntermediateFrame parameter is TRUE and the conversion cannot be done in place then the function returns FALSE. If the in place conversion can be done then that parameter is ignored.
Note that the frame should be large enough to take the destination pixels.
Default behaviour calls Convert() from the frameBuffer to itself, and if that returns FALSE then calls it again (provided noIntermediateFrame is FALSE) using an intermediate store, copying the intermediate store back to the original frame store.
frameBuffer | Frame buffer to translate data |
bytesReturned | Bytes written to frameBuffer |
noIntermediateFrame | Flag to use intermediate store |
static PColourConverter* PColourConverter::Create | ( | const PString & | srcColourFormat, | |
const PString & | dstColourFormat, | |||
unsigned | width, | |||
unsigned | height | |||
) | [static] |
Create an instance of a colour conversion function. Returns NULL if there is no registered colour converter between the two named formats.
srcColourFormat | Name of source colour format |
dstColourFormat | Name of destination colour format |
width | Width of frame (used for both src and dst) |
height | Height of frame (used for both src and dst) |
BOOL PColourConverter::GetDstFrameSize | ( | unsigned & | width, | |
unsigned & | height | |||
) | const |
Get the output frame size.
width | Width of destination frame |
height | Height of destination frame |
BOOL PColourConverter::GetSrcFrameSize | ( | unsigned & | width, | |
unsigned & | height | |||
) | const |
Get the input frame size.
width | Width of source frame |
height | Height of source frame |
friend class PColourConverterRegistration [friend] |
PString PColourConverter::srcColourFormat [protected] |
PString PColourConverter::dstColourFormat [protected] |
unsigned PColourConverter::srcFrameWidth [protected] |
unsigned PColourConverter::srcFrameHeight [protected] |
unsigned PColourConverter::srcFrameBytes [protected] |
unsigned PColourConverter::dstFrameBytes [protected] |
unsigned PColourConverter::dstFrameWidth [protected] |
unsigned PColourConverter::dstFrameHeight [protected] |
BOOL PColourConverter::scaleNotCrop [protected] |
BOOL PColourConverter::verticalFlip [protected] |
PBYTEArray PColourConverter::intermediateFrameStore [protected] |
struct jdec_private* PColourConverter::jdec [read, protected] |