jj2000.j2k.roi.encoder
Class ROIMaskGenerator

java.lang.Object
  |
  +--jj2000.j2k.roi.encoder.ROIMaskGenerator
Direct Known Subclasses:
ArbROIMaskGenerator, RectROIMaskGenerator

public abstract class ROIMaskGenerator
extends java.lang.Object

This class generates the ROI masks for the ROIScaler.It gives the scaler the ROI mask for the current code-block.

The values are calculated from the scaling factors of the ROIs. The values with which to scale are equal to u-umin where umin is the lowest scaling factor within the block. The umin value is sent to the entropy coder to be used for scaling the distortion values.

See Also:
RectROIMaskGenerator, ArbROIMaskGenerator

Field Summary
protected  int nrc
          Number of components
protected  boolean roiInTile
           
protected  ROI[] rois
          Array containing the ROIs
protected  boolean[] tileMaskMade
          Flag indicating whether a mask has been made for the current tile
 
Constructor Summary
ROIMaskGenerator(ROI[] rois, int nrc)
          The constructor of the mask generator
 
Method Summary
abstract  boolean getROIMask(DataBlkInt db, Subband sb, int magbits, int c)
          This functions gets a DataBlk with the size of the current code-block and fills it with the ROI mask.
 ROI[] getROIs()
          This function returns the ROIs in the image
abstract  void makeMask(Subband sb, int magbits, int n)
          This function generates the ROI mask for the entire tile.
 void tileChanged()
          This function is called every time the tile is changed to indicate that there is need to make a new mask
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rois

protected ROI[] rois
Array containing the ROIs


nrc

protected int nrc
Number of components


tileMaskMade

protected boolean[] tileMaskMade
Flag indicating whether a mask has been made for the current tile


roiInTile

protected boolean roiInTile
Constructor Detail

ROIMaskGenerator

public ROIMaskGenerator(ROI[] rois,
                        int nrc)
The constructor of the mask generator

Parameters:
rois - The ROIs in the image
nrc - The number of components
Method Detail

getROIs

public ROI[] getROIs()
This function returns the ROIs in the image

Returns:
The ROIs in the image

getROIMask

public abstract boolean getROIMask(DataBlkInt db,
                                   Subband sb,
                                   int magbits,
                                   int c)
This functions gets a DataBlk with the size of the current code-block and fills it with the ROI mask. The lowest scaling value in the mask for this code-block is returned by the function to be used for modifying the rate distortion estimations.

Parameters:
db - The data block that is to be filled with the mask
sb - The root of the current subband tree
magbits - The number of magnitude bits in this code-block
c - Component number
Returns:
Whether or not a mask was needed for this tile

makeMask

public abstract void makeMask(Subband sb,
                              int magbits,
                              int n)
This function generates the ROI mask for the entire tile. The mask is generated for one component. This method is called once for each tile and component.

Parameters:
sb - The root of the subband tree used in the decomposition
magbits - The max number of magnitude bits in any code-block
n - component number

tileChanged

public void tileChanged()
This function is called every time the tile is changed to indicate that there is need to make a new mask