jj2000.j2k.entropy.encoder
Class EntropyCoder

java.lang.Object
  |
  +--jj2000.j2k.image.ImgDataAdapter
        |
        +--jj2000.j2k.entropy.encoder.EntropyCoder
All Implemented Interfaces:
CodedCBlkDataSrcEnc, ForwWTDataProps, ImgData, StdEntropyCoderOptions
Direct Known Subclasses:
StdEntropyCoder

public abstract class EntropyCoder
extends ImgDataAdapter
implements CodedCBlkDataSrcEnc, StdEntropyCoderOptions

This abstract class provides the general interface for block-based entropy encoders. The input to the entropy coder is the quantized wavelet coefficients, or codewords, represented in sign magnitude. The output is a compressed code-block with rate-distortion information.

The source of data for objects of this class are 'CBlkQuantDataSrcEnc' objects.

For more details on the sign magnitude representation used see the Quantizer class.

This class provides default implemenations for most of the methods (wherever it makes sense), under the assumption that the image and component dimensions, and the tiles, are not modifed by the entropy coder. If that is not the case for a particular implementation then the methods should be overriden.

See Also:
Quantizer, CBlkQuantDataSrcEnc

Field Summary
static char OPT_PREFIX
          The prefix for entropy coder options: 'C'
private static java.lang.String[][] pinfo
          The list of parameters that is accepted for entropy coding.
protected  CBlkQuantDataSrcEnc src
          The source of quantized wavelet coefficients
 
Fields inherited from class jj2000.j2k.image.ImgDataAdapter
imgdatasrc, tIdx
 
Fields inherited from interface jj2000.j2k.entropy.StdEntropyCoderOptions
FIRST_BYPASS_PASS_IDX, MAX_CB_AREA, MAX_CB_DIM, MIN_CB_DIM, NUM_EMPTY_PASSES_IN_MS_BP, NUM_NON_BYPASS_MS_BP, NUM_PASSES, OPT_BYPASS, OPT_PRED_TERM, OPT_RESET_MQ, OPT_SEG_SYMBOLS, OPT_TERM_PASS, OPT_VERT_STR_CAUSAL, STRIPE_HEIGHT
 
Constructor Summary
EntropyCoder(CBlkQuantDataSrcEnc src)
          Initializes the source of quantized wavelet coefficients.
 
Method Summary
static EntropyCoder createInstance(CBlkQuantDataSrcEnc src, ParameterList pl, CBlkSizeSpec cblks, PrecinctSizeSpec pss, StringSpec bms, StringSpec mqrs, StringSpec rts, StringSpec css, StringSpec sss, StringSpec lcs, StringSpec tts)
          Creates a EntropyCoder object for the appropriate entropy coding parameters in the parameter list 'pl', and having 'src' as the source of quantized data.
 SubbandAn getAnSubbandTree(int t, int c)
          Returns a reference to the root of subband tree structure representing the subband decomposition for the specified tile-component.
abstract  int getCBlkHeight(int t, int c)
          Returns the code-block height for the specified tile and component.
abstract  int getCBlkWidth(int t, int c)
          Returns the code-block width for the specified tile and component.
 int getCbULX()
          Returns the horizontal offset of the code-block partition.
 int getCbULY()
          Returns the vertical offset of the code-block partition.
static java.lang.String[][] getParameterInfo()
          Returns the parameters that are used in this class and implementing classes.
 boolean isReversible(int t, int c)
          Returns the reversibility of the tile-component data that is provided by the object.
 
Methods inherited from class jj2000.j2k.image.ImgDataAdapter
getCompImgHeight, getCompImgWidth, getCompSubsX, getCompSubsY, getCompULX, getCompULY, getImgHeight, getImgULX, getImgULY, getImgWidth, getNomRangeBits, getNomTileHeight, getNomTileWidth, getNumComps, getNumTiles, getNumTiles, getTile, getTileCompHeight, getTileCompWidth, getTileHeight, getTileIdx, getTilePartULX, getTilePartULY, getTileWidth, nextTile, setTile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jj2000.j2k.entropy.encoder.CodedCBlkDataSrcEnc
getNextCodeBlock, getPPX, getPPY, precinctPartitionUsed
 
Methods inherited from interface jj2000.j2k.image.ImgData
getCompImgHeight, getCompImgWidth, getCompSubsX, getCompSubsY, getCompULX, getCompULY, getImgHeight, getImgULX, getImgULY, getImgWidth, getNomRangeBits, getNomTileHeight, getNomTileWidth, getNumComps, getNumTiles, getNumTiles, getTile, getTileCompHeight, getTileCompWidth, getTileHeight, getTileIdx, getTilePartULX, getTilePartULY, getTileWidth, nextTile, setTile
 

Field Detail

OPT_PREFIX

public static final char OPT_PREFIX
The prefix for entropy coder options: 'C'

See Also:
Constant Field Values

pinfo

private static final java.lang.String[][] pinfo
The list of parameters that is accepted for entropy coding. Options for entropy coding start with 'C'.


src

protected CBlkQuantDataSrcEnc src
The source of quantized wavelet coefficients

Constructor Detail

EntropyCoder

public EntropyCoder(CBlkQuantDataSrcEnc src)
Initializes the source of quantized wavelet coefficients.

Parameters:
src - The source of quantized wavelet coefficients.
Method Detail

getCBlkWidth

public abstract int getCBlkWidth(int t,
                                 int c)
Returns the code-block width for the specified tile and component.

Parameters:
t - The tile index
c - the component index
Returns:
The code-block width for the specified tile and component

getCBlkHeight

public abstract int getCBlkHeight(int t,
                                  int c)
Returns the code-block height for the specified tile and component.

Parameters:
t - The tile index
c - the component index
Returns:
The code-block height for the specified tile and component

isReversible

public boolean isReversible(int t,
                            int c)
Returns the reversibility of the tile-component data that is provided by the object. Data is reversible when it is suitable for lossless and lossy-to-lossless compression.

Since entropy coders themselves are always reversible, it returns the reversibility of the data that comes from the 'CBlkQuantDataSrcEnc' source object (i.e. ROIScaler).

Specified by:
isReversible in interface ForwWTDataProps
Parameters:
t - Tile index
c - Component index
Returns:
true is the data is reversible, false if not.
See Also:
ROIScaler

getAnSubbandTree

public SubbandAn getAnSubbandTree(int t,
                                  int c)
Returns a reference to the root of subband tree structure representing the subband decomposition for the specified tile-component.

Specified by:
getAnSubbandTree in interface ForwWTDataProps
Parameters:
t - The index of the tile.
c - The index of the component.
Returns:
The root of the subband tree structure, see Subband.
See Also:
SubbandAn, Subband

getCbULX

public int getCbULX()
Returns the horizontal offset of the code-block partition. Allowable values are 0 and 1, nothing else.

Specified by:
getCbULX in interface ForwWTDataProps

getCbULY

public int getCbULY()
Returns the vertical offset of the code-block partition. Allowable values are 0 and 1, nothing else.

Specified by:
getCbULY in interface ForwWTDataProps

getParameterInfo

public static java.lang.String[][] getParameterInfo()
Returns the parameters that are used in this class and implementing classes. It returns a 2D String array. Each of the 1D arrays is for a different option, and they have 3 elements. The first element is the option name, the second one is the synopsis, the third one is a long description of what the parameter is and the fourth is its default value. The synopsis or description may be 'null', in which case it is assumed that there is no synopsis or description of the option, respectively. Null may be returned if no options are supported.

Returns:
the options name, their synopsis and their explanation, or null if no options are supported.

createInstance

public static EntropyCoder createInstance(CBlkQuantDataSrcEnc src,
                                          ParameterList pl,
                                          CBlkSizeSpec cblks,
                                          PrecinctSizeSpec pss,
                                          StringSpec bms,
                                          StringSpec mqrs,
                                          StringSpec rts,
                                          StringSpec css,
                                          StringSpec sss,
                                          StringSpec lcs,
                                          StringSpec tts)
Creates a EntropyCoder object for the appropriate entropy coding parameters in the parameter list 'pl', and having 'src' as the source of quantized data.

Parameters:
src - The source of data to be entropy coded
pl - The parameter list (or options).
pss - Precinct partition specifications
bms - By-pass mode specifications
mqrs - MQ-reset specifications
rts - Regular termination specifications
css - Causal stripes specifications
sss - Error resolution segment symbol use specifications
lcs - Length computation specifications
tts - Termination type specifications
Throws:
java.lang.IllegalArgumentException - If an error occurs while parsing the options in 'pl'