jj2000.j2k.roi.encoder
Class RectROIMaskGenerator

java.lang.Object
  |
  +--jj2000.j2k.roi.encoder.ROIMaskGenerator
        |
        +--jj2000.j2k.roi.encoder.RectROIMaskGenerator

public class RectROIMaskGenerator
extends ROIMaskGenerator

This class generates the ROI masks when there are only rectangular ROIs in the image. The ROI mask generation can then be simplified by only calculating the boundaries of the ROI mask in the particular subbands

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.

To generate and to store the boundaries of the ROIs, the class SubbandRectROIMask is used. There is one tree of SubbandMasks for each component.

See Also:
SubbandRectROIMask, ROIMaskGenerator, ArbROIMaskGenerator

Field Summary
private  int[] lrxs
          The lower right xs of the ROIs
private  int[] lrys
          The lower right ys of the ROIs
private  int[] nrROIs
          Number of ROIs
private  SubbandRectROIMask[] sMasks
          The tree of subbandmask.
private  int[] ulxs
          The upper left xs of the ROIs
private  int[] ulys
          The upper left ys of the ROIs
 
Fields inherited from class jj2000.j2k.roi.encoder.ROIMaskGenerator
nrc, roiInTile, rois, tileMaskMade
 
Constructor Summary
RectROIMaskGenerator(ROI[] ROIs, int nrc)
          The constructor of the mask generator.
 
Method Summary
 boolean getROIMask(DataBlkInt db, Subband sb, int magbits, int c)
          This functions gets a DataBlk the size of the current code-block and fills this block with the ROI mask.
 void makeMask(Subband sb, int magbits, int n)
          This function generates the ROI mask for the entire tile.
 java.lang.String toString()
          This function returns the relevant data of the mask generator
 
Methods inherited from class jj2000.j2k.roi.encoder.ROIMaskGenerator
getROIs, tileChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ulxs

private int[] ulxs
The upper left xs of the ROIs


ulys

private int[] ulys
The upper left ys of the ROIs


lrxs

private int[] lrxs
The lower right xs of the ROIs


lrys

private int[] lrys
The lower right ys of the ROIs


nrROIs

private int[] nrROIs
Number of ROIs


sMasks

private SubbandRectROIMask[] sMasks
The tree of subbandmask. One for each component

Constructor Detail

RectROIMaskGenerator

public RectROIMaskGenerator(ROI[] ROIs,
                            int nrc)
The constructor of the mask generator. The constructor is called with the ROI data. This data is stored in arrays that are used to generate the SubbandRectROIMask trees for each component.

Parameters:
ROIs - The ROI info.
nrc - number of components.
Method Detail

getROIMask

public boolean getROIMask(DataBlkInt db,
                          Subband sb,
                          int magbits,
                          int c)
This functions gets a DataBlk the size of the current code-block and fills this block with the ROI mask.

In order to get the mask for a particular Subband, the subband tree is traversed and at each decomposition, the ROI masks are computed. The roi bondaries for each subband are stored in the SubbandRectROIMask tree.

Specified by:
getROIMask in class ROIMaskGenerator
Parameters:
db - The data block that is to be filled with the mask
sb - The root of the subband tree to which db belongs
magbits - The max number of magnitude bits in any code-block
c - The component for which to get the mask
Returns:
Whether or not a mask was needed for this tile

toString

public java.lang.String toString()
This function returns the relevant data of the mask generator

Overrides:
toString in class java.lang.Object

makeMask

public 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.

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