dmuIC
Inherits from: dmuObj
#include "dmuIC.h"
Overview
This object is the base class for creating objects that use the
special compression capabilites of the ICE chip. This object
wraps up much of the digital media image converter(dmic) library.
ICE: There is a chip on the O2 that does image conversion very
efficiently. It has a queue of requests that it pulls from
as fast as it can. With each request, you pass it a conversion
context. This conversion context tells ICE what type of compression
or decompression to use. Currently, ICE knows how to encode and
decode jpegs, decode mpeg. This object
does everything you need to pass images to the ICE input queue and
get images from the output queue. But this object doesn't know how
to create the conversion context to pass to ICE with the image.
The subclasses of this object implement the setup method which
creates the conversion context.
IMPORTANT: this object does not do anything to make sure
that the ICE queue has room in it for another request.
This is the header file for the dmuIC object. This object can not
be instaniated by itself, it must be subclassed from. To use this
you must inherit from this object and provide an implementation of
the setup method. The setup method needs to create an image conversion
context.
Here is the current hierarch of current objects derived from this
class.
dmuObj -> dmuIC ---> dmuICjencoder
|
--> dmuICjdecoder
This is the base class for doing image conversion operations with ICE.
This object wraps up the similarities between the code for a decoder object
and the code for an encoder object. Most things are the same in fact.
The only differences are in the setup method.
See the source code for more info and implementation details.
Public Methods
- dmuIC()
Constructor: This will initialize some member variables. The
defaults are as follows:
- Conversion Speed: DM_IC_SPEED_REALTIME
If you need to change these parameters, you must change them
before you call setup. Setup uses the parameters to create an
image conversion context that can not be changed.
For this object to be functional, the setup method must
have an implementation provided. This means that this constructor
should never be called except implicitly by the subclass
- virtual ~dmuIC()
Destructor: destroys the image conversion context if one has been
allocated
- virtual int setup()
This is the method that creates the image conversion context. When
creating the conversion context, the object has to know a couple
of different things. They are shown below with defaults.
Image Width | 0 *can set with constructor |
Image Height | 0 *can set with constructor |
Image Packing | DM_IMAGE_PACKING_CbYCrY |
Conversion Speed | DM_IC_SPEED_REALTIME |
Conversion Direction |
DM_IC_CODE_DIRECTION_UNDEFINED |
If these parameters are not right, you must change them before you
call this method. The conversion context is passed to ICE with
every request, so that ICE knows what it is supposed to do.
- int init(dmuParams *params)
Creates a dmBuffer pool for the results of the image conversion
to be dumped into. The pool created is constrained by the
output of this object. The pool is also constrained by what
the children object want as their source
- int addSrcConstraints(DMparams *params)
If this class is acting as a destination for another object in a
chain, this method is used to notify the parent object (i.e. the
source object) of any constraints which the image converter may have
on its source. These constraints are added to the params
parameter structure. This method is used to ensure that the
DMbuffers that the parent object sends to this object are in a
format that can be received and used propperly.
addSrcConstraints() is ususally called internally in the library
during the init() method, and is rarely, if ever, used by user
programs.
- int addDstConstraints(DMparams *params)
This method adds to the params structure, any constraints
that may be associated with the output of this object. Normally,
this method is called internal to the object to set up the
parameters of a DMbuffer pool which the object will use as a
drain. This can be useful for child objects (or dmu programs) to
obtain information about the constraints used in the creation of
the DMbuffer pool associated with an object that drains into
DMbuffers
- int getFD()
returns the file descriptor to select on. This file descriptor
will trigger when there is output available in the output queue
- int handleEvents(fd_set fdSet)
If this object's fd is set in the fdSet, the dmIC library is done
with the conversion of a buffer. There is a waiting buffer to
propagate down to the children. This method is normally called within
the event loop. It will propagate the finished buffer down to
the children objects
- int receive(DMbuffer inBuffer)
This object's parent passes a buffer to this object by calling this
method with the new buffer as the argument. This method passes the
buffer on to VICE to start converting it.
Important: Right now this object does not check to make
sure that the ICE queue has room.
- void setSpeed(DMicspeed _speed)
Set the speed that is required for the conversion. Possible values
are: DM_IC_SPEED_UNDEFINED, DM_IC_SPEED_REALTIME, and
DM_IC_SPEED_NONREALTIME. This must be set before you call
setup or the conversion context will be created with the default
DM_IC_SPEED_REALTIME.
- DMicspeed getSpeed()
return the speed that the conversion is currently set to run at.
- void setSrcPacking(DMimagepacking _packing)
Set the way the pixels are packed coming into this object
The default for this is: DM_IMAGE_PACKING_CbYCrY.
For the fastest jpeg conversion, use the default. Other packing
modes are much slower for jpeg conversion.
This must be set before you call setup or the packing will be the
default packing
- void setDstPacking(DMimagepacking _packing)
- DMimagepacking getSrcPacking() { return(srcPacking)
return the current packing mode
- DMimagepacking getDstPacking() { return(dstPacking)
- void setImageSizeX(int _imageSizeX)
Set the image size that the converter will use
if you do not use the constructor of the subclass which sets the
initail size, you can use this function to setup the width
of the image we are dealing with. If you didn't use the constructor
to set the initail size, you must call this method before the
setup method is called or the setup method will fail
- void setImageSizeY(int _imageSizeY)
- void setImageDimensions(int _imageSizeX, int _imageSizeY)
int setPrintReturnErr(int _printReturnErr)
debugging
print out when you try to return an error with the DMUIC_ERR macro
Overview Object List Object Hierarchy
Sample Apps