C# Класс CSJ2K.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.

Наследование: CSJ2K.j2k.image.ImgDataAdapter, CBlkQuantDataSrcEnc
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
ROIScaler ( CSJ2K.j2k.quantization.quantizer.Quantizer src, CSJ2K.j2k.roi.encoder.ROIMaskGenerator mg, bool roi, int sLev, bool uba, CSJ2K.j2k.encoder.EncoderSpecs encSpec ) : System

Constructor of the ROI scaler, takes a Quantizer as source of data to scale.

createInstance ( CSJ2K.j2k.quantization.quantizer.Quantizer src, CSJ2K.j2k.util.ParameterList pl, CSJ2K.j2k.encoder.EncoderSpecs encSpec ) : ROIScaler

Creates a ROIScaler object. The Quantizer is the source of data to scale.

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.

getAnSubbandTree ( int t, int c ) : SubbandAn

Returns a reference to the subband tree structure representing the subband decomposition for the specified tile-component.

getNextCodeBlock ( int c, CSJ2K.j2k.wavelet.analysis.CBlkWTData cblk ) : CSJ2K.j2k.wavelet.analysis.CBlkWTData

This function gets a datablk from the entropy coder. The sample sin the block, which consists of the quantized coefficients from the quantizer, are scaled by the values given for any ROIs specified.

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.

getNextInternCodeBlock ( int c, CSJ2K.j2k.wavelet.analysis.CBlkWTData cblk ) : CSJ2K.j2k.wavelet.analysis.CBlkWTData

This function gets a datablk from the entropy coder. The sample sin the block, which consists of the quantized coefficients from the quantizer, are scaled by the values given for any ROIs specified.

The function calls on a ROIMaskGenerator to get the mask for scaling the coefficients in the current block.

isReversible ( int t, int c ) : bool

Since ROI scaling is always a reversible operation, it calls isReversible() method of it source (the quantizer module).

nextTile ( ) : void

Advances to the next tile, in standard scan-line order (by rows then columns). An NoNextElementException is thrown if the current tile is the last one (i.e. there is no next tile).

setTile ( int x, int y ) : void

Changes the current tile, given the new indexes. An IllegalArgumentException is thrown if the indexes do not correspond to a valid tile.

useRoi ( ) : bool

This function returns the flag indicating if any ROI functionality used

Защищенные методы

Метод Описание
parseROIs ( System roiopt, int nc, System roiVector ) : System.Collections.Generic.List

This function parses the values given for the ROIs with the argument -Rroi. Currently only circular and rectangular ROIs are supported.

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.

Приватные методы

Метод Описание
calcMaxMagBits ( CSJ2K.j2k.encoder.EncoderSpecs encSpec ) : void

Calculates the maximum amount of magnitude bits for each tile-component, and stores it in the 'maxMagBits' array. This is called by the constructor

Описание методов

ROIScaler() публичный Метод

Constructor of the ROI scaler, takes a Quantizer as source of data to scale.
public ROIScaler ( CSJ2K.j2k.quantization.quantizer.Quantizer src, CSJ2K.j2k.roi.encoder.ROIMaskGenerator mg, bool roi, int sLev, bool uba, CSJ2K.j2k.encoder.EncoderSpecs encSpec ) : System
src CSJ2K.j2k.quantization.quantizer.Quantizer The quantizer that is the source of data. /// ///
mg CSJ2K.j2k.roi.encoder.ROIMaskGenerator The mask generator that will be used for all components /// ///
roi bool Flag indicating whether there are rois specified. /// ///
sLev int The resolution levels that belong entirely to ROI /// ///
uba bool Flag indicating whether block aligning is used. /// ///
encSpec CSJ2K.j2k.encoder.EncoderSpecs The encoder specifications for addition of roi specs /// ///
Результат System

createInstance() публичный статический Метод

Creates a ROIScaler object. The Quantizer is the source of data to scale.

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.

If an error occurs while parsing /// the options in 'pl' /// ///
public static createInstance ( CSJ2K.j2k.quantization.quantizer.Quantizer src, CSJ2K.j2k.util.ParameterList pl, CSJ2K.j2k.encoder.EncoderSpecs encSpec ) : ROIScaler
src CSJ2K.j2k.quantization.quantizer.Quantizer The source of data to scale /// ///
pl CSJ2K.j2k.util.ParameterList The parameter list (or options). /// ///
encSpec CSJ2K.j2k.encoder.EncoderSpecs The encoder specifications for addition of roi specs /// ///
Результат ROIScaler

getAnSubbandTree() публичный Метод

Returns a reference to the subband tree structure representing the subband decomposition for the specified tile-component.
public getAnSubbandTree ( int t, int c ) : SubbandAn
t int The index of the tile. /// ///
c int The index of the component. /// ///
Результат CSJ2K.j2k.wavelet.analysis.SubbandAn

getNextCodeBlock() публичный Метод

This function gets a datablk from the entropy coder. The sample sin the block, which consists of the quantized coefficients from the quantizer, are scaled by the values given for any ROIs specified.

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.

public getNextCodeBlock ( int c, CSJ2K.j2k.wavelet.analysis.CBlkWTData cblk ) : CSJ2K.j2k.wavelet.analysis.CBlkWTData
c int The component for which to return the next code-block. /// ///
cblk CSJ2K.j2k.wavelet.analysis.CBlkWTData 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. /// ///
Результат CSJ2K.j2k.wavelet.analysis.CBlkWTData

getNextInternCodeBlock() публичный Метод

This function gets a datablk from the entropy coder. The sample sin the block, which consists of the quantized coefficients from the quantizer, are scaled by the values given for any ROIs specified.

The function calls on a ROIMaskGenerator to get the mask for scaling the coefficients in the current block.

public getNextInternCodeBlock ( int c, CSJ2K.j2k.wavelet.analysis.CBlkWTData cblk ) : CSJ2K.j2k.wavelet.analysis.CBlkWTData
c int The component for which to return the next code-block. /// ///
cblk CSJ2K.j2k.wavelet.analysis.CBlkWTData 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. /// ///
Результат CSJ2K.j2k.wavelet.analysis.CBlkWTData

isReversible() публичный Метод

Since ROI scaling is always a reversible operation, it calls isReversible() method of it source (the quantizer module).
public isReversible ( int t, int c ) : bool
t int The tile to test for reversibility /// ///
c int The component to test for reversibility /// ///
Результат bool

nextTile() публичный Метод

Advances to the next tile, in standard scan-line order (by rows then columns). An NoNextElementException is thrown if the current tile is the last one (i.e. there is no next tile).
public nextTile ( ) : void
Результат void

parseROIs() защищенный статический Метод

This function parses the values given for the ROIs with the argument -Rroi. Currently only circular and rectangular ROIs are supported.

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.

protected static parseROIs ( System roiopt, int nc, System roiVector ) : System.Collections.Generic.List
roiopt System The info on the ROIs /// ///
nc int number of components /// ///
roiVector System The vcector containing the ROI parsed from the cmd line /// ///
Результат System.Collections.Generic.List

setTile() публичный Метод

Changes the current tile, given the new indexes. An IllegalArgumentException is thrown if the indexes do not correspond to a valid tile.
public setTile ( int x, int y ) : void
x int The horizontal index of the tile. /// ///
y int The vertical index of the new tile. /// ///
Результат void

useRoi() публичный Метод

This function returns the flag indicating if any ROI functionality used
public useRoi ( ) : bool
Результат bool