Package jj2000.j2k.entropy.encoder
Class EntropyCoder
java.lang.Object
jj2000.j2k.image.ImgDataAdapter
jj2000.j2k.entropy.encoder.EntropyCoder
- All Implemented Interfaces:
CodedCBlkDataSrcEnc,StdEntropyCoderOptions,ImgData,ForwWTDataProps
- 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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charThe prefix for entropy coder options: 'C'protected CBlkQuantDataSrcEncThe source of quantized wavelet coefficientsFields inherited from class jj2000.j2k.image.ImgDataAdapter
imgdatasrc, tIdxFields 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
ConstructorsConstructorDescriptionInitializes the source of quantized wavelet coefficients. -
Method Summary
Modifier and TypeMethodDescriptionstatic EntropyCodercreateInstance(CBlkQuantDataSrcEnc src, J2KImageWriteParamJava wp, 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.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 intgetCBlkHeight(int t, int c) Returns the code-block height for the specified tile and component.abstract intgetCBlkWidth(int t, int c) Returns the code-block width for the specified tile and component.intgetCbULX()Returns the horizontal offset of the code-block partition.intgetCbULY()Returns the vertical offset of the code-block partition.static String[][]Returns the parameters that are used in this class and implementing classes.booleanisReversible(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, setTileMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jj2000.j2k.entropy.encoder.CodedCBlkDataSrcEnc
getNextCodeBlock, getPPX, getPPY, precinctPartitionUsedMethods 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 Details
-
OPT_PREFIX
public static final char OPT_PREFIXThe prefix for entropy coder options: 'C'- See Also:
-
src
The source of quantized wavelet coefficients
-
-
Constructor Details
-
EntropyCoder
Initializes the source of quantized wavelet coefficients.- Parameters:
src- The source of quantized wavelet coefficients.
-
-
Method Details
-
getCBlkWidth
public abstract int getCBlkWidth(int t, int c) Returns the code-block width for the specified tile and component.- Parameters:
t- The tile indexc- 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 indexc- 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:
isReversiblein interfaceForwWTDataProps- Parameters:
t- Tile indexc- Component index- Returns:
- true is the data is reversible, false if not.
- See Also:
-
getAnSubbandTree
Returns a reference to the root of subband tree structure representing the subband decomposition for the specified tile-component.- Specified by:
getAnSubbandTreein interfaceForwWTDataProps- 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:
-
getCbULX
public int getCbULX()Returns the horizontal offset of the code-block partition. Allowable values are 0 and 1, nothing else.- Specified by:
getCbULXin interfaceForwWTDataProps
-
getCbULY
public int getCbULY()Returns the vertical offset of the code-block partition. Allowable values are 0 and 1, nothing else.- Specified by:
getCbULYin interfaceForwWTDataProps
-
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, J2KImageWriteParamJava wp, 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 codedwp- The parameter list (or options).cblks- Code-block size specificationspss- Precinct partition specificationsbms- By-pass mode specificationsmqrs- MQ-reset specificationsrts- Regular termination specificationscss- Causal stripes specificationssss- Error resolution segment symbol use specificationslcs- Length computation specificationstts- Termination type specifications- Throws:
IllegalArgumentException- If an error occurs while parsing the options in 'pl'
-