#include <CamPanel.h>
Inheritance diagram for CCamPanel::
The process from image to (compressed) datastream is a long one, involving a number of steps. A CamPanel is used to hold data for a step, and if possible draw a graphical representation on the screen (this is great for debugging, but also produces some pretty pictures :)).
A CamPanel can show something as simple as the RGB image retrieved from the video device, or the DCT-ized version of the differential motion-compensated YUV image. Whatever is shown, it needs to be represented in a uniform manner through a decent base class.
CamPanels are handled by CamWidget: a CamPanel registers itself with CamWidget; this class determines which panels should be shown (depending on flags and user settings), arranges them on the screen and gives the command to draw them.
CamPanels have a unique name; this name is used to register the panel and retrieve others. Note: the name is unique per class of CamPanel, not per instance.
For example, the differentiator works on a YUV image, so when the diff-panel needs to be drawn/calculated, it will request the image(s) from the YUV panel (which may or not be visible). The YUV panel may in turn require the RGB panel, etcetera. A panel may be needed by several other panels, or require more than one panel. Circular references are not allowed.
The signal/slot mechanism of Qt is used to keep things going; the 'lower' panels with basic images are updated by CamWidget; these panels emited Updated() signal which 'higher', more sophisticated Panels may connect to. They in turn will emit Updated() signals when they are done with their work.
Panels can, and will be, created by various classes. For example, a video compressor based on the DCT and H.3* protocols may register a set of panels, while another compressor based upon subband image coding will use another set of panels. Both sets however, may be dependant upon the same 'base' panels. CamWidget itself registers 3 panels, nl. the full colour image, the YUV image and differentional YUV image (which are pretty basic :))
Panels come in three basic forms: a single RGB image that forms the begin (or end)point YUV panels in 4:2:0 format, used for steps. The UV panels are a quarter in size and displayed below the large Y image Non-image panels, for example graphs
TODO: A full list of available panels
|
The following enumeration helps in determining how a panel should be handled, and how many images it houses. |
|
Constructor.
This class is derived from QWidget, with one notable difference: the WRepaintNoErase flag is set, so that we don't get annoying flicker when we update our panel (normally, a widget is erase before updated). |
|
Destructor.
Destroys all internal structures, images, etc. Is virtual to allow proper destruction of subclasses. |
|
Emitted when the principle image-size has been changed.
|
|
Only emitted when the panel is turned off.
|
|
Emitted when the usage counter drops to 0 (not used any more).
|
|
Emitted when the usage counter increases to 1 (first use).
|
|
Only emitted when the panel is turned on.
|
|
Emitted whenever the usage counter changes.
|
|
The visibility has changed.
|
|
Emitted when the visible size has been changed.
|
|
Make SIGNAL/SLOT connections to propagate updates.
This function is similar to CCamPanel::ConnectUsage but this will make the necessary connections to make sure changes in size are propagated through the panels. It is probably a bad idea to connect to more than one parent for updates. |
|
Make SIGNAL/SLOT connections for usage counting.
This function connect()s the SIGNALs of this class to the apropriate SLOTSs in the parent, so that the parent class knows if it is being used by any of its children. Classes that depend on multiple parents should call ConnectUsage for each of its parent classes. |
|
Create image buffers in ImgRGB, ImgY/U/V or Graph resp.
This function will call create() in the QImage objects ImgRGB or ImgY/U/V with the apropriate sizes; it will also fill the YUV buffers with a grayscale palet and set it to all-equal gray. In case of a Graph panel, it does the same for the QPixmap object. |
|
Decrement usage counter.
Wheneven a panel nog longer needs this panel it should call DecrementUse() so this panel can release resources or stop calculations that are no longer required. The usage counter may not drop below zero, and this is considered an error condition. Triggers UsageChanged(). |
|
Returns a short description of the panel.
|
|
Return image representing step.
This function can be overloaded for panels that have special needs. When there is nothing useful to return, this function will return a null image. |
|
Return size of principle image. May be (0, 0).
|
|
Returns unique name of panel.
|
|
Returns the panel type.
|
|
Return pixmap object.
Similar to GetImage, this function returns the Pixmap object for Graph panel. |
|
Default implementation returns a NULL pointer, i.e. this panel does not have such a dialog. |
|
Return size of drawable portion; may be (0, 0) when there's nothing to draw.
|
|
Increment usage counter.
Wheneven a panel has need of this panel it should call IncrementUse() to indicate its needed and should emit Updated() signals. Triggers UsageChanged(). |
|
|
|
Returns usage counter.
This function returns the number of panels that claimed this panel for use; it returns an integer of 0 or higher. A value of 0 means this panel can be removed without problems. |
|
|
|
Sets principle image size.
This function will emit ChangedImageSize() when the size is different. See also SetSize |
|
Slot to signal changes in image size.
Whenever the image size is changed, this function should be called with the new image size. It should determine the panel size (which may be smaller or larger than the image size). The default implemenation sets the visible and image size equal for RGB and Graph panels, while the height of YUV420 panels is 1.5 the image height to allow space for the UV boxes. Note that the Image and Visible size can always be overruled by calling SetImageSize and SetVisibleSize Reimplemented in CBasicPanel, CDCTPanel, and CDiffPanel. |
|
Sets visible image size.
See also SetSize |
|
Emitted after the panel's data has been updated.
|
|
Make deep copies of images, by overwriting buffers.
Blegh; the = operator is the ONLY operator that can't be inherited. Too bad. |
|
Operator overload that will add the values of the buffers of plus to this panel.
The CCamPanel equivalent of 'a += b', where the YUV values are regarded as signed quantities with a virtual null point at 128. This is the integration step. |
|
|
|
Paint visible representation of step.
|
|
Return our visible size as the sizeHint. |
|
|
|
Ready-to-use QImage object for RGB image.
|
|
Ready-to-use QImage object for U data.
|
|
Ready-to-use QImage object for V data.
|
|
Ready-to-use QImage object for Y data.
|
|
|
|
Ready-to-use QPixmap for graphs.
|
|
Half image height; set by SetImageSize();.
|
|
Half image width; set by SetImageSize();.
|
|
Image height; set by SetImageSize();.
|
|
Image width; set by SetImageSize();.
|
|
|