|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jj2000.j2k.image.ImgDataAdapter | +--jj2000.j2k.roi.encoder.ROIScaler
This class deals with the ROI functionality.
The ROI method is the Maxshift method. The ROIScaler works by scaling the quantized wavelet coefficients that do not affect the ROI (i.e background coefficients) so that these samples get a lower significance than the ROI ones. By scaling the coefficients sufficiently, the ROI coefficients can be recognized by their amplitude alone and no ROI mask needs to be generated at the decoder side.
The source module must be a quantizer and code-block's data is exchange with thanks to CBlkWTData instances.
Quantizer
,
CBlkWTData
Field Summary | |
private boolean |
blockAligned
Flag indicating if block aligned ROIs are used |
private int[][] |
maxMagBits
The maximum number of magnitude bit-planes in any subband. |
private ROIMaskGenerator |
mg
The class generating the ROI mask |
static char |
OPT_PREFIX
The prefix for ROI Scaler options: 'R' |
private static java.lang.String[][] |
pinfo
The list of parameters that are accepted for ROI coding. |
private boolean |
roi
Flag indicating the presence of ROIs |
private DataBlkInt |
roiMask
The ROI mask |
private Quantizer |
src
The source of quantized wavelet transform coefficients |
private int |
useStartLevel
Number of resolution levels to include in ROI mask |
Fields inherited from class jj2000.j2k.image.ImgDataAdapter |
imgdatasrc,
tIdx |
Constructor Summary | |
ROIScaler(Quantizer src,
ROIMaskGenerator mg,
boolean roi,
int sLev,
boolean uba,
EncoderSpecs encSpec)
Constructor of the ROI scaler, takes a Quantizer as source of data to scale. |
Method Summary | |
private void |
calcMaxMagBits(EncoderSpecs encSpec)
Calculates the maximum amount of magnitude bits for each tile-component, and stores it in the 'maxMagBits' array. |
static ROIScaler |
createInstance(Quantizer src,
ParameterList pl,
EncoderSpecs encSpec)
Creates a ROIScaler object. |
boolean |
getBlockAligned()
This function returns the blockAligned flag |
CBlkWTData |
getNextCodeBlock(int n,
CBlkWTData cblk)
This function gets a datablk from the entropy coder. |
CBlkWTData |
getNextInternCodeBlock(int c,
CBlkWTData cblk)
This function gets a datablk from the entropy coder. |
Coord |
getNumCodeBlocks(SubbandAn sb,
Coord co)
Returns the number of code-blocks in a subband, along the horizontal and vertical dimensions. |
static java.lang.String[][] |
getParameterInfo()
Returns the parameters that are used in this class and implementing classes. |
int |
getPartitionULX()
Returns the horizontal coordinate of the origin of the cell and code-block partition, with respect to the canvas origin, on the reference grid. |
int |
getPartitionULY()
Returns the vertical coordinate of the origin of the cell and code-block partition, with respect to the canvas origin, on the reference grid. |
ROIMaskGenerator |
getROIMaskGenerator()
This function returns the ROI mask generator. |
SubbandAn |
getSubbandTree(int t,
int c)
Returns a reference to the subband tree structure representing the subband decomposition for the specified tile-component. |
boolean |
isReversible(int t,
int c)
Since ROI scaling is always a reversible operation, it calls isReversible() method of it source (the quantizer module). |
void |
nextTile()
Advances to the next tile, in standard scan-line order (by rows then columns). |
protected static java.util.Vector |
parseROIs(java.lang.String roiopt,
int nc,
java.util.Vector roiVector)
This function parses the values given for the ROIs with the argument -Rroi. |
void |
setTile(int x,
int y)
Changes the current tile, given the new indexes. |
boolean |
useRoi()
This function returns the flag indicating if any ROI functionality used |
Methods inherited from class jj2000.j2k.image.ImgDataAdapter |
getCompHeight,
getCompImgHeight,
getCompImgWidth,
getCompSubsX,
getCompSubsY,
getCompWidth,
getHeight,
getImgHeight,
getImgULX,
getImgULY,
getImgWidth,
getNomRangeBits,
getNumComps,
getNumTiles,
getNumTiles,
getTile,
getTileIdx,
getTileOff,
getULX,
getULY,
getWidth |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final char OPT_PREFIX
private static final java.lang.String[][] pinfo
private int[][] maxMagBits
private boolean roi
private boolean blockAligned
private int useStartLevel
private ROIMaskGenerator mg
private DataBlkInt roiMask
private Quantizer src
Constructor Detail |
public ROIScaler(Quantizer src, ROIMaskGenerator mg, boolean roi, int sLev, boolean uba, EncoderSpecs encSpec)
src
- The quantizer that is the source of data.mg
- The mask generator that will be used for all componentsroi
- Flag indicating whether there are rois specified.sLev
- The resolution levels that belong entirely to ROIuba
- Flag indicating whether block aligning is used.encSpec
- The encoder specifications for addition of roi specsMethod Detail |
public Coord getNumCodeBlocks(SubbandAn sb, Coord co)
sb
- The subband for which to return the number of blocks.co
- If not null the values are returned in this object. If null a
new object is allocated and returned.public boolean isReversible(int t, int c)
t
- The tile to test for reversibilityc
- The component to test for reversibilitypublic SubbandAn getSubbandTree(int t, int c)
t
- The index of the tile.c
- The index of the component.SubbandAn
,
Subband
public int getPartitionULX()
public int getPartitionULY()
public static ROIScaler createInstance(Quantizer src, ParameterList pl, EncoderSpecs encSpec)
The ROI Scaler creates a ROIMaskGenerator depending on what ROI information is in the ParameterList. If only rectangular ROI are used, the fast mask generator for rectangular ROI can be used.
src
- The source of data to scalepl
- The parameter list (or options).encSpec
- The encoder specifications for addition of roi specsprotected static java.util.Vector parseROIs(java.lang.String roiopt, int nc, java.util.Vector roiVector)
A rectangular ROI is indicated by a 'R' followed the coordinates for the upper left corner of the ROI and then its width and height.
A circular ROI is indicated by a 'C' followed by the coordinates of the circle center and then the radius.
Before the R and C values, the component that are affected by the ROI are indicated.
roiopt
- The info on the ROIsnc
- number of componentsroiVector
- The vcector containing the ROI parsed from the cmd linepublic CBlkWTData getNextCodeBlock(int n, CBlkWTData cblk)
The function calls on a ROIMaskGenerator to get the mask for scaling the coefficients in the current block.
The data returned by this method is a copy of the orignal data. Therfore it can be modified "in place" without any problems after being returned. The 'offset' of the returned data is 0, and the 'scanw' is the same as the code-block width. See the 'CBlkWTData' class.
n
- The component for which to return the next code-block.cblk
- If non-null this object will be used to return the new
code-block. If null a new one will be allocated and returned. If the
"data" array of the object is non-null it will be reused, if possible,
to return the data.CBlkWTData
public CBlkWTData getNextInternCodeBlock(int c, CBlkWTData cblk)
The function calls on a ROIMaskGenerator to get the mask for scaling the coefficients in the current block.
c
- The component for which to return the next code-block.cblk
- If non-null this object will be used to return the new
code-block. If null a new one will be allocated and returned. If the
"data" array of the object is non-null it will be reused, if possible,
to return the data.CBlkWTData
public ROIMaskGenerator getROIMaskGenerator()
public boolean getBlockAligned()
public boolean useRoi()
public static java.lang.String[][] getParameterInfo()
public void setTile(int x, int y)
x
- The horizontal index of the tile.y
- The vertical index of the new tile.public void nextTile()
private void calcMaxMagBits(EncoderSpecs encSpec)
encSpec
- The encoder specifications for addition of roi specs
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |