Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

InterleavedYUVGenerator Class Reference

Generates FilterBankEvents containing raw camera images with interleaved pixels (YUVYUVYUV... instead of YYY...UUU...VVV...). More...

#include <InterleavedYUVGenerator.h>

Inheritance diagram for InterleavedYUVGenerator:

Detailed Description

Generates FilterBankEvents containing raw camera images with interleaved pixels (YUVYUVYUV... instead of YYY...UUU...VVV...).

There's only one channel, which holds the interleaved data. The increment is set to 3, but if you want to access each component in order, just use 1 instead (as you would expect hopefully, since the very specific memory layout is the whole point of this class)

The row skip is always 0, and the row stride is always width*3. But it would be better to use the proper accessor functions to be more general.

should receive FilterBankEvents from any standard format FilterBankGenerator (like RawCameraGenerator)

See also:
FilterBankGenerator for information on serialization format

Definition at line 23 of file InterleavedYUVGenerator.h.

List of all members.

Public Member Functions

 InterleavedYUVGenerator (unsigned int mysid, FilterBankGenerator *fbg, EventBase::EventTypeID_t tid)
 constructor
 InterleavedYUVGenerator (unsigned int mysid, unsigned int syc, unsigned int suc, unsigned int svc, FilterBankGenerator *fbg, EventBase::EventTypeID_t tid)
 constructor, you can pass which channels to interleave
virtual ~InterleavedYUVGenerator ()
 destructor
virtual void doEvent ()
 should receive FilterBankEvents from any standard format FilterBankGenerator (like RawCameraGenerator)
virtual unsigned int getBinSize () const
virtual unsigned int loadBuffer (const char buf[], unsigned int len, const char *filename=NULL)
virtual unsigned int saveBuffer (char buf[], unsigned int len) const
virtual void freeCaches ()
 deletes storage of cached images and marks it invalid
virtual void invalidateCaches ()
 marks all of the cached images as invalid (but doesn't free their memory)

Static Public Member Functions

static std::string getClassDescription ()
 Gives a short description of what this class of behaviors does... you should override this (but don't have to).

Static Public Attributes

static const unsigned int CHAN_YUV = 0
 so you can refer to the YUV channel symbolically. (as opposed to others that might be added?)

Protected Member Functions

virtual void setNumImages (unsigned int nLayers, unsigned int nChannels)
 resizes the filter bank information storage area, you should override this to do your setup and call it from your constructor
virtual void setDimensions ()
 resets stride parameter (to correspond to width*3 from FilterBankGenerator::setDimensions())
virtual void destruct ()
 deletes the arrays
virtual unsigned char * createImageCache (unsigned int layer, unsigned int chan) const
 create new image data storage area for the cache - this called by getImage() only when the corresponding entry in images is NULL
virtual void calcImage (unsigned int layer, unsigned int chan)
 should calculate new image data, called by getImage() only when imageValids indicates the image being requested is dirty (and only after getImage() has already called createImageCache())

Protected Attributes

unsigned int srcYChan
 the channel of the source's Y channel
unsigned int srcUChan
 the channel of the source's U channel
unsigned int srcVChan
 the channel of the source's V channel
bool ** isAllocated
 flag for each image, set to true if the corresponding value in images will need to be freed, or false if it's a passthrough from the previous stage

Private Member Functions

 InterleavedYUVGenerator (const InterleavedYUVGenerator &fbk)
 don't call
const InterleavedYUVGeneratoroperator= (const InterleavedYUVGenerator &fbk)
 don't call

Constructor & Destructor Documentation

InterleavedYUVGenerator::InterleavedYUVGenerator ( unsigned int  mysid,
FilterBankGenerator fbg,
EventBase::EventTypeID_t  tid 
)

constructor

Definition at line 9 of file InterleavedYUVGenerator.cc.

InterleavedYUVGenerator::InterleavedYUVGenerator ( unsigned int  mysid,
unsigned int  syc,
unsigned int  suc,
unsigned int  svc,
FilterBankGenerator fbg,
EventBase::EventTypeID_t  tid 
)

constructor, you can pass which channels to interleave

Definition at line 19 of file InterleavedYUVGenerator.cc.

virtual InterleavedYUVGenerator::~InterleavedYUVGenerator (  )  [virtual]

destructor

Definition at line 31 of file InterleavedYUVGenerator.h.

InterleavedYUVGenerator::InterleavedYUVGenerator ( const InterleavedYUVGenerator fbk  )  [private]

don't call


Member Function Documentation

void InterleavedYUVGenerator::calcImage ( unsigned int  layer,
unsigned int  channel 
) [protected, virtual]

should calculate new image data, called by getImage() only when imageValids indicates the image being requested is dirty (and only after getImage() has already called createImageCache())

This is where you'll want to put your user-specific code for calculating the image data

Implements FilterBankGenerator.

Definition at line 161 of file InterleavedYUVGenerator.cc.

unsigned char * InterleavedYUVGenerator::createImageCache ( unsigned int  layer,
unsigned int  channel 
) const [protected, virtual]

create new image data storage area for the cache - this called by getImage() only when the corresponding entry in images is NULL

You should return the pointer you want stored in images to be returned by any calls to getFirstRow. Interpretation of the data it points to is dependant on the the generator which creates it

Implements FilterBankGenerator.

Definition at line 148 of file InterleavedYUVGenerator.cc.

Referenced by loadBuffer().

void InterleavedYUVGenerator::destruct (  )  [protected, virtual]

deletes the arrays

Reimplemented from FilterBankGenerator.

Definition at line 107 of file InterleavedYUVGenerator.cc.

Referenced by ~InterleavedYUVGenerator().

void InterleavedYUVGenerator::doEvent (  )  [virtual]

should receive FilterBankEvents from any standard format FilterBankGenerator (like RawCameraGenerator)

Reimplemented from FilterBankGenerator.

Definition at line 30 of file InterleavedYUVGenerator.cc.

void InterleavedYUVGenerator::freeCaches (  )  [virtual]

deletes storage of cached images and marks it invalid

you should override this if the images cache pointer isn't actually an array of bytes... Don't forget to call it in your subclass's destructor or your version won't get called...

Reimplemented from FilterBankGenerator.

Definition at line 130 of file InterleavedYUVGenerator.cc.

Referenced by ~InterleavedYUVGenerator().

unsigned int InterleavedYUVGenerator::getBinSize (  )  const [virtual]

The loadBuffer() functions of the included subclasses aren't tested, so don't assume they'll work without a little debugging...

Reimplemented from FilterBankGenerator.

Definition at line 42 of file InterleavedYUVGenerator.cc.

static std::string InterleavedYUVGenerator::getClassDescription (  )  [static]

Gives a short description of what this class of behaviors does... you should override this (but don't have to).

If you do override this, also consider overriding getDescription() to return it

Reimplemented from BehaviorBase.

Definition at line 38 of file InterleavedYUVGenerator.h.

void InterleavedYUVGenerator::invalidateCaches (  )  [virtual]

marks all of the cached images as invalid (but doesn't free their memory)

You probably want to call this right before you send the FilterBankEvent

Reimplemented from FilterBankGenerator.

Definition at line 138 of file InterleavedYUVGenerator.cc.

unsigned int InterleavedYUVGenerator::loadBuffer ( const char  buf[],
unsigned int  len,
const char *  filename = NULL 
) [virtual]

The loadBuffer() functions of the included subclasses aren't tested, so don't assume they'll work without a little debugging...

Reimplemented from FilterBankGenerator.

Definition at line 50 of file InterleavedYUVGenerator.cc.

const InterleavedYUVGenerator& InterleavedYUVGenerator::operator= ( const InterleavedYUVGenerator fbk  )  [private]

don't call

unsigned int InterleavedYUVGenerator::saveBuffer ( char  buf[],
unsigned int  len 
) const [virtual]

The loadBuffer() functions of the included subclasses aren't tested, so don't assume they'll work without a little debugging...

Reimplemented from FilterBankGenerator.

Definition at line 75 of file InterleavedYUVGenerator.cc.

void InterleavedYUVGenerator::setDimensions (  )  [protected, virtual]

resets stride parameter (to correspond to width*3 from FilterBankGenerator::setDimensions())

Reimplemented from FilterBankGenerator.

Definition at line 100 of file InterleavedYUVGenerator.cc.

void InterleavedYUVGenerator::setNumImages ( unsigned int  nLayers,
unsigned int  nChannels 
) [protected, virtual]

resizes the filter bank information storage area, you should override this to do your setup and call it from your constructor

In general, it isn't expected that FilterBankGenerator's should necessarily be dynamically resizeable (although it would be nice), which is why this isn't public. If yours is, just add some pubic accessor functions which call this. In general, the included subclasses should be able to handle being resized, but there's no reason to do so since the system won't be changing its available resolutions at run time.

The default implementation is a no-op if(numLayers==nLayers && numChannels==nChannels)

Reimplemented from FilterBankGenerator.

Definition at line 116 of file InterleavedYUVGenerator.cc.

Referenced by InterleavedYUVGenerator().


Member Data Documentation

const unsigned int InterleavedYUVGenerator::CHAN_YUV = 0 [static]

so you can refer to the YUV channel symbolically. (as opposed to others that might be added?)

Definition at line 36 of file InterleavedYUVGenerator.h.

Referenced by CameraBehavior::doEvent().

flag for each image, set to true if the corresponding value in images will need to be freed, or false if it's a passthrough from the previous stage

Definition at line 63 of file InterleavedYUVGenerator.h.

Referenced by createImageCache(), destruct(), freeCaches(), invalidateCaches(), and setNumImages().

unsigned int InterleavedYUVGenerator::srcUChan [protected]

the channel of the source's U channel

Definition at line 60 of file InterleavedYUVGenerator.h.

Referenced by calcImage().

unsigned int InterleavedYUVGenerator::srcVChan [protected]

the channel of the source's V channel

Definition at line 61 of file InterleavedYUVGenerator.h.

Referenced by calcImage().

unsigned int InterleavedYUVGenerator::srcYChan [protected]

the channel of the source's Y channel

Definition at line 59 of file InterleavedYUVGenerator.h.

Referenced by calcImage(), and createImageCache().


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

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:09 2016 by Doxygen 1.6.3