Class 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:
    Quantizer, CBlkQuantDataSrcEnc
    • Field Detail

      • OPT_PREFIX

        public static final char OPT_PREFIX
        The prefix for entropy coder options: 'C'
        See Also:
        Constant Field Values
    • 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 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,
                                                  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 coded
        wp - The parameter list (or options).
        cblks - Code-block size specifications
        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:
        IllegalArgumentException - If an error occurs while parsing the options in 'pl'