jj2000.j2k.wavelet.analysis
Class CBlkWTData

java.lang.Object
  |
  +--jj2000.j2k.wavelet.analysis.CBlkWTData
Direct Known Subclasses:
CBlkWTDataFloat, CBlkWTDataInt

public abstract class CBlkWTData
extends java.lang.Object

This is a generic abstract class to store a code-block of wavelet data, quantized or not. This class does not have the notion of components. Therefore, it should be used for data from a single component. Subclasses should implement the different types of storage (int, float, etc.).

The data is always stored in one array, of the type matching the data type (i.e. for 'int' it's an 'int[]'). The data should be stored in the array in standard scan-line order. That is the samples go from the top-left corner of the code-block to the lower-right corner by line and then column.

The member variable 'offset' gives the index in the array of the first data element (i.e. the top-left coefficient). The member variable 'scanw' gives the width of the scan that is used to store the data, that can be different from the width of the block. Element '(x,y)' of the code-block (i.e. '(0,0)' is the top-left coefficient), will appear at position 'offset+y*scanw+x' in the array of data.

The classes CBlkWTDataInt and CBlkWTDataFloat provide implementations for int and float types respectively.

The types of data are the same as those defined by the 'DataBlk' class.

See Also:
CBlkWTDataSrc, CBlkQuantDataSrcEnc, DataBlk, CBlkWTDataInt, CBlkWTDataFloat

Field Summary
 double convertFactor
          The value by which the absolute value of the data has to be divided in order to get the real absolute value.
 int h
          The height of the code-block
 int m
          The vertical index of the code-block, within the subband
 int magbits
          The number of magnitude bits in the integer representation.
 int n
          The horizontal index of the code-block, within the subband
 int nROIbp
          Number of ROI magnitude bit-planes
 int nROIcoeff
          Number of ROI coefficients in the code-block
 int offset
          The offset in the array of the top-left coefficient
 SubbandAn sb
          The subband in which this code-block is found
 int scanw
          The width of the scanlines used to store the data in the array
 double stepSize
          The quantization step size of the code-block.
 int ulx
          The horizontal coordinate of the upper-left corner of the code-block
 int uly
          The vertical coordinate of the upper left corner of the code-block
 int w
          The width of the code-block
 float wmseScaling
          The WMSE scaling factor (multiplicative) to apply to the distortion measures of the data of this code-block.
 
Constructor Summary
CBlkWTData()
           
 
Method Summary
abstract  java.lang.Object getData()
          Returns the array containing the data, or null if there is no data.
abstract  int getDataType()
          Returns the data type of the CBlkWTData object, as defined in the DataBlk class.
abstract  void setData(java.lang.Object arr)
          Sets the data array to the specified one.
 java.lang.String toString()
          Returns a string of informations about the DataBlk
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ulx

public int ulx
The horizontal coordinate of the upper-left corner of the code-block


uly

public int uly
The vertical coordinate of the upper left corner of the code-block


n

public int n
The horizontal index of the code-block, within the subband


m

public int m
The vertical index of the code-block, within the subband


sb

public SubbandAn sb
The subband in which this code-block is found


w

public int w
The width of the code-block


h

public int h
The height of the code-block


offset

public int offset
The offset in the array of the top-left coefficient


scanw

public int scanw
The width of the scanlines used to store the data in the array


magbits

public int magbits
The number of magnitude bits in the integer representation. This is only used for quantized wavelet data.


wmseScaling

public float wmseScaling
The WMSE scaling factor (multiplicative) to apply to the distortion measures of the data of this code-block. By default it is 1.


convertFactor

public double convertFactor
The value by which the absolute value of the data has to be divided in order to get the real absolute value. This value is useful to obtain the complement of 2 representation of a coefficient that is currently using the sign-magnitude representation.


stepSize

public double stepSize
The quantization step size of the code-block. The value is updated by the quantizer module


nROIcoeff

public int nROIcoeff
Number of ROI coefficients in the code-block


nROIbp

public int nROIbp
Number of ROI magnitude bit-planes

Constructor Detail

CBlkWTData

public CBlkWTData()
Method Detail

getDataType

public abstract int getDataType()
Returns the data type of the CBlkWTData object, as defined in the DataBlk class.

Returns:
The data type of the object, as defined in the DataBlk class.
See Also:
DataBlk

getData

public abstract java.lang.Object getData()
Returns the array containing the data, or null if there is no data. The returned array is of the type returned by getDataType() (e.g., for TYPE_INT, it is a int[]).

Each implementing class should provide a type specific equivalent method (e.g., getDataInt() in DataBlkInt) which returns an array of the correct type explicitely and not through an Object.

Returns:
The array containing the data, or null if there is no data.
See Also:
getDataType()

setData

public abstract void setData(java.lang.Object arr)
Sets the data array to the specified one. The type of the specified data array must match the one returned by getDataType() (e.g., for TYPE_INT, it should be a int[]). If the wrong type of array is given a ClassCastException will be thrown.

The size of the array is not necessarily checked for consistency with w and h or any other fields.

Each implementing class should provide a type specific equivalent method (e.g., setDataInt() in DataBlkInt) which takes an array of the correct type explicetely and not through an Object.

Parameters:
arr - The new data array to use
See Also:
getDataType()

toString

public java.lang.String toString()
Returns a string of informations about the DataBlk

Overrides:
toString in class java.lang.Object
Returns:
Block dimensions and progressiveness in a string