jj2000.j2k.entropy.encoder
Class StdEntropyCoder

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

public class StdEntropyCoder
extends EntropyCoder
implements StdEntropyCoderOptions

This class implements the JPEG 2000 entropy coder, which codes stripes in code-blocks. This entropy coding engine can function in a single-threaded mode where one code-block is encoded at a time, or in a multi-threaded mode where multiple code-blocks are entropy coded in parallel. The interface presented by this class is the same in both modes.

The number of threads used by this entropy coder is specified by the "jj2000.j2k.entropy.encoder.StdEntropyCoder.nthreads" Java system property. If set to "0" the single threaded implementation is used. If set to 'n' ('n' larger than 0) then 'n' extra threads are started by this class which are used to encode the code-blocks in parallel (i.e. ideally 'n' code-blocks will be encoded in parallel at a time). On multiprocessor machines under a "native threads" Java Virtual Machine implementation each one of these threads can run on a separate processor speeding up the encoding time. By default the single-threaded implementation is used. The multi-threaded implementation currently assumes that the vast majority of consecutive calls to 'getNextCodeBlock()' will be done on the same component. If this is not the case, the speed-up that can be expected on multiprocessor machines might be significantly decreased.

The code-blocks are rectangular, with dimensions which must be powers of 2. Each dimension has to be no smaller than 4 and no larger than 256. The product of the two dimensions (i.e. area of the code-block) may not exceed 4096.

Context 0 of the MQ-coder is used as the uniform one (uniform, non-adaptive probability distribution). Context 1 is used for RLC coding. Contexts 2-10 are used for zero-coding (ZC), contexts 11-15 are used for sign-coding (SC) and contexts 16-18 are used for magnitude-refinement (MR).

This implementation buffers the symbols and calls the MQ coder only once per stripe and per coding pass, to reduce the method call overhead.

This implementation also provides some timing features. They can be enabled by setting the 'DO_TIMING' constant of this class to true and recompiling. The timing uses the 'System.currentTimeMillis()' Java API call, which returns wall clock time, not the actual CPU time used. The timing results will be printed on the message output. Since the times reported are wall clock times and not CPU usage times they can not be added to find the total used time (i.e. some time might be counted in several places). When timing is disabled ('DO_TIMING' is false) there is no penalty if the compiler performs some basic optimizations. Even if not the penalty should be negligeable.

The source module must implement the CBlkQuantDataSrcEnc interface and code-block's data is received in a CBlkWTData instance. This modules sends code-block's information in a CBlkRateDistStats instance.

See Also:
CBlkQuantDataSrcEnc, CBlkWTData, CBlkRateDistStats

Nested Class Summary
private  class StdEntropyCoder.Compressor
          Class that takes care of running the 'compressCodeBlock()' method with thread local arguments.
 
Field Summary
 StringSpec bms
          By-pass mode specifications
private  BitToByteOutput[] boutT
          The raw bit output used, for each thread
private  CBlkSizeSpec cblks
          The code-block size specifications
private  java.util.Stack[] completedComps
          The queue of completed compressors, for each component.
 StringSpec css
          Causal stripes specifications
private  int[][] ctxtbufT
          Buffer for the contexts to use when sending buffered symbols to the MQ-coder, for each thread.
static java.lang.String DEF_THREADS_NUM
          The default value for the property in THREADS_PROP_NAME: 0
private  double[][] distbufT
          The buffer for distortion values (avoids reallocation for each code-block), for each thread.
private static boolean DO_TIMING
          Whether to collect timing information or not: false.
private  boolean[] finishedTileComponent
          A flag indicating for each component if all the code-blocks of the * current tile have been returned.
private static int[] FM_LOSSLESS
          Distortion estimation lookup table for bits coded using the magnitude-refinement (MR) primative, for lossless coding and last bit-plane.
private static int[] FM_LOSSY
          Distortion estimation lookup table for bits coded using the magnitude-refinement (MR) primative, for lossy coding (i.e.
private static int[] FS_LOSSLESS
          Distortion estimation lookup table for bits coded using the sign-code (SC) primative, for lossless coding and last bit-plane.
private static int[] FS_LOSSY
          Distortion estimation lookup table for bits coded using the sign-code (SC) primative, for lossy coding (i.e.
private  java.util.Stack idleComps
          The queue of idle compressors.
private static int INT_SIGN_BIT
          The sign bit for int data
private  boolean[][] istermbufT
          The buffer for indicating terminated passes (avoids reallocation for each code-block), for each thread.
 StringSpec lcs
          The length calculation specifications
private  int[][] lenCalc
          The length calculation type for each tile-component
private static int[] MQ_INIT
          The initial states for the MQ coder
 StringSpec mqrs
          MQ reset specifications
private  MQCoder[] mqT
          The MQ coder used, for each thread
private static int[] MR_LUT
          Magnitude Refinement context lookup table
private static int MR_LUT_BITS
          The number of bits used for the Magnitude Refinement lookup table
private static int MR_MASK
          The mask to obtain the MR index to 'MR_LUT' from the 'state' information.
private static int MSE_LKP_BITS
          The number of bits used to index in the 'fm' lookup table, 7.
private static int MSE_LKP_FRAC_BITS
          The number of fractional bits used to store data in the 'fm' and 'fs' lookup tables.
private  int[] nBusyComps
          The number of busy compressors, for each component.
private static int NUM_CTXTS
          The number of contexts used
private  int[][] opts
          The options that are turned on, as flag bits.
private  ByteOutputBuffer[] outT
          The output stream used, for each thread
private  boolean[][] precinctPartition
          boolean used to signal if the precinct partition is used for each component and each tile.
private  PrecinctSizeSpec pss
          The precinct partition specifications
private  int[][] ratebufT
          The buffer for rate values (avoids reallocation for each code-block), for each thread.
private static int RLC_CTXT
          The RLC context
private static int RLC_MASK_R1R2
          The mask to isolate the bits necessary to identify RLC coding state (significant, visited and non-zero context, for row 1 and 2).
 StringSpec rts
          Regular termination specifications
private static int[] SC_LUT
          Sign Coding context lookup table.
private static int SC_LUT_BITS
          Number of bits used for the Sign Coding lookup table
private static int SC_LUT_MASK
          The mask to obtain the context index from the 'SC_LUT'
private static int SC_MASK
          The bit mask to isolate the state bits relative to the sign coding lookup table ('SC_LUT').
private static int SC_SHIFT_R1
          The shift to obtain the SC index to 'SC_LUT' from the state information, for row 1.
private static int SC_SHIFT_R2
          The shift to obtain the SC index to 'SC_LUT' from the state information, for row 2.
private static int SC_SPRED_SHIFT
          The shift to obtain the sign predictor from the 'SC_LUT'.
private static int[] SEG_SYMB_CTXTS
          The 4 contexts for the error resilience segmentation symbol (always the UNIFORM context, UNIF_CTXT)
private static int[] SEG_SYMBOLS
          The 4 bits of the error resilience segmentation symbol (1010)
private static int SIG_MASK_R1R2
          The mask to isolate the significance bits for row 1 and 2 of the state array.
private  CBlkWTData[] srcblkT
          The source code-block to entropy code (avoids reallocation for each code-block), for each thread.
 StringSpec sss
          Error resilience segment symbol use specifications
private static int STATE_D_DL_R1
          The flag bit for the diagonal down-left significance in the state array, for row 1.
private static int STATE_D_DL_R2
          The flag bit for the diagonal down-left significance in the state array, for row 2.
private static int STATE_D_DR_R1
          The flag bit for the diagonal down-right significance in the state array , for row 1.
private static int STATE_D_DR_R2
          The flag bit for the diagonal down-right significance in the state array , for row 2.
private static int STATE_D_UL_R1
          The flag bit for the diagonal up-left significance in the state array, for row 1.
private static int STATE_D_UL_R2
          The flag bit for the diagonal up-left significance in the state array, for row 2.
private static int STATE_D_UR_R1
          The flag bit for the diagonal up-right significance in the state array, for row 1.
private static int STATE_D_UR_R2
          The flag bit for the diagonal up-right significance in the state array, for row 2.
private static int STATE_H_L_R1
          The flag bit for the horizontal-left significance in the state array, for row 1.
private static int STATE_H_L_R2
          The flag bit for the horizontal-left significance in the state array, for row 2.
private static int STATE_H_L_SIGN_R1
          The flag bit for the horizontal-left sign in the state array, for row 1.
private static int STATE_H_L_SIGN_R2
          The flag bit for the horizontal-left sign in the state array, for row 2.
private static int STATE_H_R_R1
          The flag bit for the horizontal-right significance in the state array, for row 1.
private static int STATE_H_R_R2
          The flag bit for the horizontal-right significance in the state array, for row 2.
private static int STATE_H_R_SIGN_R1
          The flag bit for the horizontal-right sign in the state array, for row 1.
private static int STATE_H_R_SIGN_R2
          The flag bit for the horizontal-right sign in the state array, for row 2.
private static int STATE_NZ_CTXT_R1
          The flag bit for the "not zero context" bit in the state array, for row 1.
private static int STATE_NZ_CTXT_R2
          The flag bit for the "not zero context" bit in the state array, for row 2.
private static int STATE_PREV_MR_R1
          The flag bit for the previous MR primitive applied in the state array, for row 1.
private static int STATE_PREV_MR_R2
          The flag bit for the previous MR primitive applied in the state array, for row 2.
private static int STATE_SEP
           
private static int STATE_SIG_R1
          The flag bit for the significance in the state array, for row 1.
private static int STATE_SIG_R2
          The flag bit for the significance in the state array, for row 2.
private static int STATE_V_D_R1
          The flag bit for the vertical-down significance in the state array, for row 1.
private static int STATE_V_D_R2
          The flag bit for the vertical-down significance in the state array, for row 2.
private static int STATE_V_D_SIGN_R1
          The flag bit for the vertical-down sign in the state array, for row 1.
private static int STATE_V_D_SIGN_R2
          The flag bit for the vertical-down sign in the state array, for row 2.
private static int STATE_V_U_R1
          The flag bit for the vertical-up significance in the state array, for row 1.
private static int STATE_V_U_R2
          The flag bit for the vertical-up significance in the state array, for row 2.
private static int STATE_V_U_SIGN_R1
          The flag bit for the vertical-up sign in the state array, for row 1.
private static int STATE_V_U_SIGN_R2
          The flag bit for the vertical-up sign in the state array, for row 2.
private static int STATE_VISITED_R1
          The flag bit for the "visited" bit in the state array, for row 1.
private static int STATE_VISITED_R2
          The flag bit for the "visited" bit in the state array, for row 2.
private  int[][] stateT
          The state array for each thread.
private  int[][] symbufT
          Buffer for symbols to send to the MQ-coder, for each thread.
static int THREADS_PRIORITY_INC
          The increase in priority for the compressor threads, currently 3.
static java.lang.String THREADS_PROP_NAME
          The Java system property name for the number of threads to use: jj2000.j2k.entropy.encoder.StdEntropyCoder.nthreads
private  long[] time
          The cumulative wall time for the entropy coding engine, for each component.
private  ThreadPool tPool
          The pool of threads, for the threaded implementation.
 StringSpec tts
          The termination type specifications
private  int[][] tType
          The termination type for each tile-component
private static int UNIF_CTXT
          The UNIFORM context (with a uniform probability distribution which does not adapt)
private static int VSTD_MASK_R1R2
          The mask to isolate the visited bits for row 1 and 2 of the state array.
private static int ZC_LUT_BITS
          Number of bits used for the Zero Coding lookup table
private static int[] ZC_LUT_HH
          Zero Coding context lookup tables for the HH global orientation
private static int[] ZC_LUT_HL
          Zero Coding context lookup tables for the HL global orientation
private static int[] ZC_LUT_LH
          Zero Coding context lookup tables for the LH global orientation
private static int ZC_MASK
          The mask to obtain the ZC_LUT index from the state information
 
Fields inherited from class jj2000.j2k.entropy.encoder.EntropyCoder
OPT_PREFIX, src
 
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
StdEntropyCoder(CBlkQuantDataSrcEnc src, CBlkSizeSpec cblks, PrecinctSizeSpec pss, StringSpec bms, StringSpec mqrs, StringSpec rts, StringSpec css, StringSpec sss, StringSpec lcs, StringSpec tts)
          Instantiates a new entropy coder engine, with the specified source of data, nominal block width and height.
 
Method Summary
private static int calcSkipMSBP(CBlkWTData cblk, int lmb)
          Calculates the number of magnitude bit-planes that are to be skipped, because they are non-significant.
private static void checkEndOfPassFF(byte[] data, int[] rates, boolean[] isterm, int n)
          Ensures that at the end of a non-terminated coding pass there is not a 0xFF byte, modifying the stored rates if necessary.
private static int cleanuppass(CBlkWTData srcblk, MQCoder mq, boolean doterm, int bp, int[] state, int[] fs, int[] zc_lut, int[] symbuf, int[] ctxtbuf, int[] ratebuf, int pidx, int ltpidx, int options)
          Performs the cleanup pass on the specified data and bit-plane.
private static void compressCodeBlock(int c, CBlkRateDistStats ccb, CBlkWTData srcblk, MQCoder mq, BitToByteOutput bout, ByteOutputBuffer out, int[] state, double[] distbuf, int[] ratebuf, boolean[] istermbuf, int[] symbuf, int[] ctxtbuf, int options, boolean rev, int lcType, int tType)
          Compresses the code-block in 'srcblk' and puts the results in 'ccb', using the specified options and temporary storage.
 void finalize()
          Prints the timing information, if collected, and calls 'finalize' on the super class.
 int getCBlkHeight(int t, int c)
          Returns the code-block height for the specified tile and component.
 int getCBlkWidth(int t, int c)
          Returns the code-block width for the specified tile and component.
 CBlkRateDistStats getNextCodeBlock(int c, CBlkRateDistStats ccb)
          Returns the next coded code-block in the current tile for the specified component, as a copy (see below).
 int getPPX(int t, int c, int rl)
          Returns the precinct partition width for the specified component, tile and resolution level.
 int getPPY(int t, int c, int rl)
          Returns the precinct partition height for the specified component, tile and resolution level.
 void initTileComp(int nt, int nc)
          Load options, length calculation type and termination type for each tile-component.
private static int magRefPass(CBlkWTData srcblk, MQCoder mq, boolean doterm, int bp, int[] state, int[] fm, int[] symbuf, int[] ctxtbuf, int[] ratebuf, int pidx, int ltpidx, int options)
          Performs the magnitude refinement pass on the specified data and bit-plane.
 void nextTile()
          Advances to the next tile, in standard scan-line order (by rows then columns).
 boolean precinctPartitionUsed(int c, int t)
          Returns true if precinct partition is used for the specified component and tile, returns false otherwise.
private static int rawMagRefPass(CBlkWTData srcblk, BitToByteOutput bout, boolean doterm, int bp, int[] state, int[] fm, int[] ratebuf, int pidx, int ltpidx, int options)
          Performs the magnitude refinement pass on the specified data and bit-plane, without using the arithmetic coder.
private static int rawSigProgPass(CBlkWTData srcblk, BitToByteOutput bout, boolean doterm, int bp, int[] state, int[] fs, int[] ratebuf, int pidx, int ltpidx, int options)
          Performs the significance propagation pass on the specified data and bit-plane, without using the arithmetic coder.
 void setTile(int x, int y)
          Changes the current tile, given the new indexes.
private static int sigProgPass(CBlkWTData srcblk, MQCoder mq, boolean doterm, int bp, int[] state, int[] fs, int[] zc_lut, int[] symbuf, int[] ctxtbuf, int[] ratebuf, int pidx, int ltpidx, int options)
          Performs the significance propagation pass on the specified data and bit-plane.
 
Methods inherited from class jj2000.j2k.entropy.encoder.EntropyCoder
createInstance, getAnSubbandTree, getCbULX, getCbULY, getParameterInfo, isReversible
 
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
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
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
 

Field Detail

DO_TIMING

private static final boolean DO_TIMING
Whether to collect timing information or not: false. Used as a compile time directive.

See Also:
Constant Field Values

time

private long[] time
The cumulative wall time for the entropy coding engine, for each component. In the single-threaded implementation it is the total time, in the multi-threaded implementation it is the time spent managing the compressor threads only.


THREADS_PROP_NAME

public static final java.lang.String THREADS_PROP_NAME
The Java system property name for the number of threads to use: jj2000.j2k.entropy.encoder.StdEntropyCoder.nthreads

See Also:
Constant Field Values

DEF_THREADS_NUM

public static final java.lang.String DEF_THREADS_NUM
The default value for the property in THREADS_PROP_NAME: 0

See Also:
Constant Field Values

THREADS_PRIORITY_INC

public static final int THREADS_PRIORITY_INC
The increase in priority for the compressor threads, currently 3. The compressor threads will have a priority of THREADS_PRIORITY_INC more than the priority of the thread calling this class constructor. Used only in the multi-threaded implementation.

See Also:
Constant Field Values

tPool

private ThreadPool tPool
The pool of threads, for the threaded implementation. It is null, if non threaded implementation is used


idleComps

private java.util.Stack idleComps
The queue of idle compressors. Used in multithreaded implementation only


completedComps

private java.util.Stack[] completedComps
The queue of completed compressors, for each component. Used in multithreaded implementation only.


nBusyComps

private int[] nBusyComps
The number of busy compressors, for each component. Used in multithreaded implementation only.


finishedTileComponent

private boolean[] finishedTileComponent
A flag indicating for each component if all the code-blocks of the * current tile have been returned. Used in multithreaded implementation only.


mqT

private MQCoder[] mqT
The MQ coder used, for each thread


boutT

private BitToByteOutput[] boutT
The raw bit output used, for each thread


outT

private ByteOutputBuffer[] outT
The output stream used, for each thread


cblks

private CBlkSizeSpec cblks
The code-block size specifications


pss

private PrecinctSizeSpec pss
The precinct partition specifications


bms

public StringSpec bms
By-pass mode specifications


mqrs

public StringSpec mqrs
MQ reset specifications


rts

public StringSpec rts
Regular termination specifications


css

public StringSpec css
Causal stripes specifications


sss

public StringSpec sss
Error resilience segment symbol use specifications


lcs

public StringSpec lcs
The length calculation specifications


tts

public StringSpec tts
The termination type specifications


opts

private int[][] opts
The options that are turned on, as flag bits. One element for each tile-component. The options are 'OPT_TERM_PASS', 'OPT_RESET_MQ', 'OPT_VERT_STR_CAUSAL', 'OPT_BYPASS' and 'OPT_SEG_SYMBOLS' as defined in the StdEntropyCoderOptions interface

See Also:
StdEntropyCoderOptions

lenCalc

private int[][] lenCalc
The length calculation type for each tile-component


tType

private int[][] tType
The termination type for each tile-component


ZC_LUT_BITS

private static final int ZC_LUT_BITS
Number of bits used for the Zero Coding lookup table

See Also:
Constant Field Values

ZC_LUT_LH

private static final int[] ZC_LUT_LH
Zero Coding context lookup tables for the LH global orientation


ZC_LUT_HL

private static final int[] ZC_LUT_HL
Zero Coding context lookup tables for the HL global orientation


ZC_LUT_HH

private static final int[] ZC_LUT_HH
Zero Coding context lookup tables for the HH global orientation


SC_LUT_BITS

private static final int SC_LUT_BITS
Number of bits used for the Sign Coding lookup table

See Also:
Constant Field Values

SC_LUT

private static final int[] SC_LUT
Sign Coding context lookup table. The index into the table is a 9 bit index, which correspond the the value in the 'state' array shifted by 'SC_SHIFT'. Bits 8-5 are the signs of the horizontal-left, horizontal-right, vertical-up and vertical-down neighbors, respectively. Bit 4 is not used (0 or 1 makes no difference). Bits 3-0 are the significance of the horizontal-left, horizontal-right, vertical-up and vertical-down neighbors, respectively. The least 4 bits of the value in the lookup table define the context number and the sign bit defines the "sign predictor".


SC_LUT_MASK

private static final int SC_LUT_MASK
The mask to obtain the context index from the 'SC_LUT'

See Also:
Constant Field Values

SC_SPRED_SHIFT

private static final int SC_SPRED_SHIFT
The shift to obtain the sign predictor from the 'SC_LUT'. It must be an unsigned shift.

See Also:
Constant Field Values

INT_SIGN_BIT

private static final int INT_SIGN_BIT
The sign bit for int data

See Also:
Constant Field Values

MR_LUT_BITS

private static final int MR_LUT_BITS
The number of bits used for the Magnitude Refinement lookup table

See Also:
Constant Field Values

MR_LUT

private static final int[] MR_LUT
Magnitude Refinement context lookup table


NUM_CTXTS

private static final int NUM_CTXTS
The number of contexts used

See Also:
Constant Field Values

RLC_CTXT

private static final int RLC_CTXT
The RLC context

See Also:
Constant Field Values

UNIF_CTXT

private static final int UNIF_CTXT
The UNIFORM context (with a uniform probability distribution which does not adapt)

See Also:
Constant Field Values

MQ_INIT

private static final int[] MQ_INIT
The initial states for the MQ coder


SEG_SYMBOLS

private static final int[] SEG_SYMBOLS
The 4 bits of the error resilience segmentation symbol (1010)


SEG_SYMB_CTXTS

private static final int[] SEG_SYMB_CTXTS
The 4 contexts for the error resilience segmentation symbol (always the UNIFORM context, UNIF_CTXT)


stateT

private int[][] stateT
The state array for each thread. Each element of the state array stores the state of two coefficients. The lower 16 bits store the state of a coefficient in row 'i' and column 'j', while the upper 16 bits store the state of a coefficient in row 'i+1' and column 'j'. The 'i' row is either the first or the third row of a stripe. This packing of the states into 32 bit words allows a faster scan of all coefficients on each coding pass and diminished the amount of data transferred. The size of the state array is increased by 1 on each side (top, bottom, left, right) to handle boundary conditions without any special logic.

The state of a coefficient is stored in the following way in the lower 16 bits, where bit 0 is the least significant bit. Bit 15 is the significance of a coefficient (0 if non-significant, 1 otherwise). Bit 14 is the visited state (i.e. if a coefficient has been coded in the significance propagation pass of the current bit-plane). Bit 13 is the "non zero-context" state (i.e. if one of the eight immediate neighbors is significant it is 1, otherwise is 0). Bits 12 to 9 store the sign of the already significant left, right, up and down neighbors (1 for negative, 0 for positive or not yet significant). Bit 8 indicates if the magnitude refinement has already been applied to the coefficient. Bits 7 to 4 store the significance of the left, right, up and down neighbors (1 for significant, 0 for non significant). Bits 3 to 0 store the significance of the diagonal coefficients (up-left, up-right, down-left and down-right; 1 for significant, 0 for non significant).

The upper 16 bits the state is stored as in the lower 16 bits, but with the bits shifted up by 16.

The lower 16 bits are referred to as "row 1" ("R1") while the upper 16 bits are referred to as "row 2" ("R2").


STATE_SEP

private static final int STATE_SEP
See Also:
Constant Field Values

STATE_SIG_R1

private static final int STATE_SIG_R1
The flag bit for the significance in the state array, for row 1.

See Also:
Constant Field Values

STATE_VISITED_R1

private static final int STATE_VISITED_R1
The flag bit for the "visited" bit in the state array, for row 1.

See Also:
Constant Field Values

STATE_NZ_CTXT_R1

private static final int STATE_NZ_CTXT_R1
The flag bit for the "not zero context" bit in the state array, for row 1. This bit is always the OR of bits STATE_H_L_R1, STATE_H_R_R1, STATE_V_U_R1, STATE_V_D_R1, STATE_D_UL_R1, STATE_D_UR_R1, STATE_D_DL_R1 and STATE_D_DR_R1.

See Also:
Constant Field Values

STATE_H_L_SIGN_R1

private static final int STATE_H_L_SIGN_R1
The flag bit for the horizontal-left sign in the state array, for row 1. This bit can only be set if the STATE_H_L_R1 is also set.

See Also:
Constant Field Values

STATE_H_R_SIGN_R1

private static final int STATE_H_R_SIGN_R1
The flag bit for the horizontal-right sign in the state array, for row 1. This bit can only be set if the STATE_H_R_R1 is also set.

See Also:
Constant Field Values

STATE_V_U_SIGN_R1

private static final int STATE_V_U_SIGN_R1
The flag bit for the vertical-up sign in the state array, for row 1. This bit can only be set if the STATE_V_U_R1 is also set.

See Also:
Constant Field Values

STATE_V_D_SIGN_R1

private static final int STATE_V_D_SIGN_R1
The flag bit for the vertical-down sign in the state array, for row 1. This bit can only be set if the STATE_V_D_R1 is also set.

See Also:
Constant Field Values

STATE_PREV_MR_R1

private static final int STATE_PREV_MR_R1
The flag bit for the previous MR primitive applied in the state array, for row 1.

See Also:
Constant Field Values

STATE_H_L_R1

private static final int STATE_H_L_R1
The flag bit for the horizontal-left significance in the state array, for row 1.

See Also:
Constant Field Values

STATE_H_R_R1

private static final int STATE_H_R_R1
The flag bit for the horizontal-right significance in the state array, for row 1.

See Also:
Constant Field Values

STATE_V_U_R1

private static final int STATE_V_U_R1
The flag bit for the vertical-up significance in the state array, for row 1.

See Also:
Constant Field Values

STATE_V_D_R1

private static final int STATE_V_D_R1
The flag bit for the vertical-down significance in the state array, for row 1.

See Also:
Constant Field Values

STATE_D_UL_R1

private static final int STATE_D_UL_R1
The flag bit for the diagonal up-left significance in the state array, for row 1.

See Also:
Constant Field Values

STATE_D_UR_R1

private static final int STATE_D_UR_R1
The flag bit for the diagonal up-right significance in the state array, for row 1.

See Also:
Constant Field Values

STATE_D_DL_R1

private static final int STATE_D_DL_R1
The flag bit for the diagonal down-left significance in the state array, for row 1.

See Also:
Constant Field Values

STATE_D_DR_R1

private static final int STATE_D_DR_R1
The flag bit for the diagonal down-right significance in the state array , for row 1.

See Also:
Constant Field Values

STATE_SIG_R2

private static final int STATE_SIG_R2
The flag bit for the significance in the state array, for row 2.

See Also:
Constant Field Values

STATE_VISITED_R2

private static final int STATE_VISITED_R2
The flag bit for the "visited" bit in the state array, for row 2.

See Also:
Constant Field Values

STATE_NZ_CTXT_R2

private static final int STATE_NZ_CTXT_R2
The flag bit for the "not zero context" bit in the state array, for row 2. This bit is always the OR of bits STATE_H_L_R2, STATE_H_R_R2, STATE_V_U_R2, STATE_V_D_R2, STATE_D_UL_R2, STATE_D_UR_R2, STATE_D_DL_R2 and STATE_D_DR_R2.

See Also:
Constant Field Values

STATE_H_L_SIGN_R2

private static final int STATE_H_L_SIGN_R2
The flag bit for the horizontal-left sign in the state array, for row 2. This bit can only be set if the STATE_H_L_R2 is also set.

See Also:
Constant Field Values

STATE_H_R_SIGN_R2

private static final int STATE_H_R_SIGN_R2
The flag bit for the horizontal-right sign in the state array, for row 2. This bit can only be set if the STATE_H_R_R2 is also set.

See Also:
Constant Field Values

STATE_V_U_SIGN_R2

private static final int STATE_V_U_SIGN_R2
The flag bit for the vertical-up sign in the state array, for row 2. This bit can only be set if the STATE_V_U_R2 is also set.

See Also:
Constant Field Values

STATE_V_D_SIGN_R2

private static final int STATE_V_D_SIGN_R2
The flag bit for the vertical-down sign in the state array, for row 2. This bit can only be set if the STATE_V_D_R2 is also set.

See Also:
Constant Field Values

STATE_PREV_MR_R2

private static final int STATE_PREV_MR_R2
The flag bit for the previous MR primitive applied in the state array, for row 2.

See Also:
Constant Field Values

STATE_H_L_R2

private static final int STATE_H_L_R2
The flag bit for the horizontal-left significance in the state array, for row 2.

See Also:
Constant Field Values

STATE_H_R_R2

private static final int STATE_H_R_R2
The flag bit for the horizontal-right significance in the state array, for row 2.

See Also:
Constant Field Values

STATE_V_U_R2

private static final int STATE_V_U_R2
The flag bit for the vertical-up significance in the state array, for row 2.

See Also:
Constant Field Values

STATE_V_D_R2

private static final int STATE_V_D_R2
The flag bit for the vertical-down significance in the state array, for row 2.

See Also:
Constant Field Values

STATE_D_UL_R2

private static final int STATE_D_UL_R2
The flag bit for the diagonal up-left significance in the state array, for row 2.

See Also:
Constant Field Values

STATE_D_UR_R2

private static final int STATE_D_UR_R2
The flag bit for the diagonal up-right significance in the state array, for row 2.

See Also:
Constant Field Values

STATE_D_DL_R2

private static final int STATE_D_DL_R2
The flag bit for the diagonal down-left significance in the state array, for row 2.

See Also:
Constant Field Values

STATE_D_DR_R2

private static final int STATE_D_DR_R2
The flag bit for the diagonal down-right significance in the state array , for row 2.

See Also:
Constant Field Values

SIG_MASK_R1R2

private static final int SIG_MASK_R1R2
The mask to isolate the significance bits for row 1 and 2 of the state array.

See Also:
Constant Field Values

VSTD_MASK_R1R2

private static final int VSTD_MASK_R1R2
The mask to isolate the visited bits for row 1 and 2 of the state array.

See Also:
Constant Field Values

RLC_MASK_R1R2

private static final int RLC_MASK_R1R2
The mask to isolate the bits necessary to identify RLC coding state (significant, visited and non-zero context, for row 1 and 2).

See Also:
Constant Field Values

ZC_MASK

private static final int ZC_MASK
The mask to obtain the ZC_LUT index from the state information

See Also:
Constant Field Values

SC_SHIFT_R1

private static final int SC_SHIFT_R1
The shift to obtain the SC index to 'SC_LUT' from the state information, for row 1.

See Also:
Constant Field Values

SC_SHIFT_R2

private static final int SC_SHIFT_R2
The shift to obtain the SC index to 'SC_LUT' from the state information, for row 2.

See Also:
Constant Field Values

SC_MASK

private static final int SC_MASK
The bit mask to isolate the state bits relative to the sign coding lookup table ('SC_LUT').

See Also:
Constant Field Values

MR_MASK

private static final int MR_MASK
The mask to obtain the MR index to 'MR_LUT' from the 'state' information. It is to be applied after the 'MR_SHIFT'.

See Also:
Constant Field Values

MSE_LKP_BITS

private static final int MSE_LKP_BITS
The number of bits used to index in the 'fm' lookup table, 7. The 'fs' table is indexed with one less bit.

See Also:
Constant Field Values

MSE_LKP_FRAC_BITS

private static final int MSE_LKP_FRAC_BITS
The number of fractional bits used to store data in the 'fm' and 'fs' lookup tables.

See Also:
Constant Field Values

FS_LOSSY

private static final int[] FS_LOSSY
Distortion estimation lookup table for bits coded using the sign-code (SC) primative, for lossy coding (i.e. normal).


FM_LOSSY

private static final int[] FM_LOSSY
Distortion estimation lookup table for bits coded using the magnitude-refinement (MR) primative, for lossy coding (i.e. normal)


FS_LOSSLESS

private static final int[] FS_LOSSLESS
Distortion estimation lookup table for bits coded using the sign-code (SC) primative, for lossless coding and last bit-plane. This table is different from 'fs_lossy' since when doing lossless coding the residual distortion after the last bit-plane is coded is strictly 0.


FM_LOSSLESS

private static final int[] FM_LOSSLESS
Distortion estimation lookup table for bits coded using the magnitude-refinement (MR) primative, for lossless coding and last bit-plane. This table is different from 'fs_lossless' since when doing lossless coding the residual distortion after the last bit-plane is coded is strictly 0.


distbufT

private double[][] distbufT
The buffer for distortion values (avoids reallocation for each code-block), for each thread.


ratebufT

private int[][] ratebufT
The buffer for rate values (avoids reallocation for each code-block), for each thread.


istermbufT

private boolean[][] istermbufT
The buffer for indicating terminated passes (avoids reallocation for each code-block), for each thread.


srcblkT

private CBlkWTData[] srcblkT
The source code-block to entropy code (avoids reallocation for each code-block), for each thread.


symbufT

private int[][] symbufT
Buffer for symbols to send to the MQ-coder, for each thread. Used to reduce the number of calls to the MQ coder.


ctxtbufT

private int[][] ctxtbufT
Buffer for the contexts to use when sending buffered symbols to the MQ-coder, for each thread. Used to reduce the number of calls to the MQ coder.


precinctPartition

private boolean[][] precinctPartition
boolean used to signal if the precinct partition is used for each component and each tile.

Constructor Detail

StdEntropyCoder

public StdEntropyCoder(CBlkQuantDataSrcEnc src,
                       CBlkSizeSpec cblks,
                       PrecinctSizeSpec pss,
                       StringSpec bms,
                       StringSpec mqrs,
                       StringSpec rts,
                       StringSpec css,
                       StringSpec sss,
                       StringSpec lcs,
                       StringSpec tts)
Instantiates a new entropy coder engine, with the specified source of data, nominal block width and height.

If the 'OPT_PRED_TERM' option is given then the MQ termination must be 'TERM_PRED_ER' or an exception is thrown.

Parameters:
src - The source of data
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
See Also:
MQCoder
Method Detail

finalize

public void finalize()
              throws java.lang.Throwable
Prints the timing information, if collected, and calls 'finalize' on the super class.

Overrides:
finalize in class java.lang.Object
java.lang.Throwable

getCBlkWidth

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

Specified by:
getCBlkWidth in class EntropyCoder
Parameters:
t - The tile index
c - the component index
Returns:
The code-block width for the specified tile and component

getCBlkHeight

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

Specified by:
getCBlkHeight in class EntropyCoder
Parameters:
t - The tile index
c - The component index
Returns:
The code-block height for the specified tile and component.

getNextCodeBlock

public CBlkRateDistStats getNextCodeBlock(int c,
                                          CBlkRateDistStats ccb)
Returns the next coded code-block in the current tile for the specified component, as a copy (see below). The order in which code-blocks are returned is not specified. However each code-block is returned only once and all code-blocks will be returned if the method is called 'N' times, where 'N' is the number of code-blocks in the tile. After all the code-blocks have been returned for the current tile calls to this method will return 'null'.

When changing the current tile (through 'setTile()' or 'nextTile()') this method will always return the first code-block, as if this method was never called before for the new current tile.

The data returned by this method is always a copy of the internal data of this object, if any, and it can be modified "in place" without any problems after being returned.

Specified by:
getNextCodeBlock in interface CodedCBlkDataSrcEnc
Parameters:
c - The component for which to return the next code-block.
ccb - If non-null this object might be used in returning the coded code-block in this or any subsequent call to this method. If null a new one is created and returned. If the 'data' array of 'cbb' is not null it may be reused to return the compressed data.
Returns:
The next coded code-block in the current tile for component 'n', or null if all code-blocks for the current tile have been returned.
See Also:
CBlkRateDistStats

setTile

public void setTile(int x,
                    int y)
Changes the current tile, given the new indexes. An IllegalArgumentException is thrown if the indexes do not correspond to a valid tile.

This default implementation just changes the tile in the source.

Specified by:
setTile in interface ImgData
Overrides:
setTile in class ImgDataAdapter
Parameters:
x - The horizontal index of the tile.
y - The vertical index of the new tile.

nextTile

public void 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).

This default implementation just advances to the next tile in the source.

Specified by:
nextTile in interface ImgData
Overrides:
nextTile in class ImgDataAdapter

compressCodeBlock

private static void compressCodeBlock(int c,
                                      CBlkRateDistStats ccb,
                                      CBlkWTData srcblk,
                                      MQCoder mq,
                                      BitToByteOutput bout,
                                      ByteOutputBuffer out,
                                      int[] state,
                                      double[] distbuf,
                                      int[] ratebuf,
                                      boolean[] istermbuf,
                                      int[] symbuf,
                                      int[] ctxtbuf,
                                      int options,
                                      boolean rev,
                                      int lcType,
                                      int tType)
Compresses the code-block in 'srcblk' and puts the results in 'ccb', using the specified options and temporary storage.

Parameters:
c - The component for which to return the next code-block.
ccb - The object where the compressed data will be stored. If the 'data' array of 'cbb' is not null it may be reused to return the compressed data.
srcblk - The code-block data to code
mq - The MQ-coder to use
bout - The bit level output to use. Used only if 'OPT_BYPASS' is turned on in the 'options' argument.
out - The byte buffer trough which the compressed data is stored.
state - The state information for the code-block
distbuf - The buffer where to store the distortion at the end of each coding pass.
ratebuf - The buffer where to store the rate (i.e. coded lenth) at the end of each coding pass.
istermbuf - The buffer where to store the terminated flag for each coding pass.
symbuf - The buffer to hold symbols to send to the MQ coder
ctxtbuf - A buffer to hold the contexts to use in sending the buffered symbols to the MQ coder.
options - The options to use when coding this code-block
rev - The reversible flag. Should be true if the source of this code-block's data is reversible.
lcType - The type of length calculation to use with the MQ coder.
tType - The type of termination to use with the MQ coder.
See Also:
getNextCodeBlock(int, jj2000.j2k.entropy.encoder.CBlkRateDistStats)

calcSkipMSBP

private static int calcSkipMSBP(CBlkWTData cblk,
                                int lmb)
Calculates the number of magnitude bit-planes that are to be skipped, because they are non-significant. The algorithm looks for the largest magnitude and calculates the most significant bit-plane of it.

Parameters:
cblk - The code-block of data to scan
lmb - The least significant magnitude bit in the data
Returns:
The number of magnitude bit-planes to skip (i.e. all zero most significant bit-planes).

sigProgPass

private static int sigProgPass(CBlkWTData srcblk,
                               MQCoder mq,
                               boolean doterm,
                               int bp,
                               int[] state,
                               int[] fs,
                               int[] zc_lut,
                               int[] symbuf,
                               int[] ctxtbuf,
                               int[] ratebuf,
                               int pidx,
                               int ltpidx,
                               int options)
Performs the significance propagation pass on the specified data and bit-plane. It codes all insignificant samples which have, at least, one of its immediate eight neighbors already significant, using the ZC and SC primitives as needed. It toggles the "visited" state bit to 1 for all those samples.

Parameters:
srcblk - The code-block data to code
mq - The MQ-coder to use
doterm - If true it performs an MQ-coder termination after the end of the pass
bp - The bit-plane to code
state - The state information for the code-block
fs - The distortion estimation lookup table for SC
zc_lut - The ZC lookup table to use in ZC.
symbuf - The buffer to hold symbols to send to the MQ coder
ctxtbuf - A buffer to hold the contexts to use in sending the buffered symbols to the MQ coder.
ratebuf - The buffer where to store the rate (i.e. coded lenth) at the end of this coding pass.
pidx - The coding pass index. Is the index in the 'ratebuf' array where to store the coded length after this coding pass.
ltpidx - The index of the last pass that was terminated, or negative if none.
options - The bitmask of entropy coding options to apply to the code-block
Returns:
The decrease in distortion for this pass, in the fixed-point normalized representation of the 'FS_LOSSY' and 'FS_LOSSLESS' tables.

rawSigProgPass

private static int rawSigProgPass(CBlkWTData srcblk,
                                  BitToByteOutput bout,
                                  boolean doterm,
                                  int bp,
                                  int[] state,
                                  int[] fs,
                                  int[] ratebuf,
                                  int pidx,
                                  int ltpidx,
                                  int options)
Performs the significance propagation pass on the specified data and bit-plane, without using the arithmetic coder. It codes all insignificant samples which have, at least, one of its immediate eight neighbors already significant, using the ZC and SC primitives as needed. It toggles the "visited" state bit to 1 for all those samples.

In this method, the arithmetic coder is bypassed, and raw bits are directly written in the bit stream (useful when distribution are close to uniform, for intance, at high bit-rates and at lossless compression).

Parameters:
srcblk - The code-block data to code
bout - The bit based output
doterm - If true the bit based output is byte aligned after the end of the pass.
bp - The bit-plane to code
state - The state information for the code-block
fs - The distortion estimation lookup table for SC
ratebuf - The buffer where to store the rate (i.e. coded lenth) at the end of this coding pass.
pidx - The coding pass index. Is the index in the 'ratebuf' array where to store the coded length after this coding pass.
ltpidx - The index of the last pass that was terminated, or negative if none.
options - The bitmask of entropy coding options to apply to the code-block
Returns:
The decrease in distortion for this pass, in the fixed-point normalized representation of the 'FS_LOSSY' and 'FS_LOSSLESS' tables.

magRefPass

private static int magRefPass(CBlkWTData srcblk,
                              MQCoder mq,
                              boolean doterm,
                              int bp,
                              int[] state,
                              int[] fm,
                              int[] symbuf,
                              int[] ctxtbuf,
                              int[] ratebuf,
                              int pidx,
                              int ltpidx,
                              int options)
Performs the magnitude refinement pass on the specified data and bit-plane. It codes the samples which are significant and which do not have the "visited" state bit turned on, using the MR primitive. The "visited" state bit is not mofified for any samples.

Parameters:
srcblk - The code-block data to code
mq - The MQ-coder to use
doterm - If true it performs an MQ-coder termination after the end of the pass
bp - The bit-plane to code
state - The state information for the code-block
fm - The distortion estimation lookup table for MR
symbuf - The buffer to hold symbols to send to the MQ coder
ctxtbuf - A buffer to hold the contexts to use in sending the buffered symbols to the MQ coder.
ratebuf - The buffer where to store the rate (i.e. coded lenth) at the end of this coding pass.
pidx - The coding pass index. Is the index in the 'ratebuf' array where to store the coded length after this coding pass.
ltpidx - The index of the last pass that was terminated, or negative if none.
options - The bitmask of entropy coding options to apply to the code-block
Returns:
The decrease in distortion for this pass, in the fixed-point normalized representation of the 'FS_LOSSY' and 'FS_LOSSLESS' tables.

rawMagRefPass

private static int rawMagRefPass(CBlkWTData srcblk,
                                 BitToByteOutput bout,
                                 boolean doterm,
                                 int bp,
                                 int[] state,
                                 int[] fm,
                                 int[] ratebuf,
                                 int pidx,
                                 int ltpidx,
                                 int options)
Performs the magnitude refinement pass on the specified data and bit-plane, without using the arithmetic coder. It codes the samples which are significant and which do not have the "visited" state bit turned on, using the MR primitive. The "visited" state bit is not mofified for any samples.

In this method, the arithmetic coder is bypassed, and raw bits are directly written in the bit stream (useful when distribution are close to uniform, for intance, at high bit-rates and at lossless compression). The 'STATE_PREV_MR_R1' and 'STATE_PREV_MR_R2' bits are not set because they are used only when the arithmetic coder is not bypassed.

Parameters:
srcblk - The code-block data to code
bout - The bit based output
doterm - If true the bit based output is byte aligned after the end of the pass.
bp - The bit-plane to code
state - The state information for the code-block
fm - The distortion estimation lookup table for MR
ratebuf - The buffer where to store the rate (i.e. coded lenth) at the end of this coding pass.
pidx - The coding pass index. Is the index in the 'ratebuf' array where to store the coded length after this coding pass.
ltpidx - The index of the last pass that was terminated, or negative if none.
options - The bitmask of entropy coding options to apply to the code-block
Returns:
The decrease in distortion for this pass, in the fixed-point normalized representation of the 'FS_LOSSY' and 'FS_LOSSLESS' tables.

cleanuppass

private static int cleanuppass(CBlkWTData srcblk,
                               MQCoder mq,
                               boolean doterm,
                               int bp,
                               int[] state,
                               int[] fs,
                               int[] zc_lut,
                               int[] symbuf,
                               int[] ctxtbuf,
                               int[] ratebuf,
                               int pidx,
                               int ltpidx,
                               int options)
Performs the cleanup pass on the specified data and bit-plane. It codes all insignificant samples which have its "visited" state bit off, using the ZC, SC, and RLC primitives. It toggles the "visited" state bit to 0 (off) for all samples in the code-block.

Parameters:
srcblk - The code-block data to code
mq - The MQ-coder to use
doterm - If true it performs an MQ-coder termination after the end of the pass
bp - The bit-plane to code
state - The state information for the code-block
fs - The distortion estimation lookup table for SC
zc_lut - The ZC lookup table to use in ZC.
symbuf - The buffer to hold symbols to send to the MQ coder
ctxtbuf - A buffer to hold the contexts to use in sending the buffered symbols to the MQ coder.
ratebuf - The buffer where to store the rate (i.e. coded lenth) at the end of this coding pass.
pidx - The coding pass index. Is the index in the 'ratebuf' array where to store the coded length after this coding pass.
ltpidx - The index of the last pass that was terminated, or negative if none.
options - The bitmask of entropy coding options to apply to the code-block
Returns:
The decrease in distortion for this pass, in the fixed-point normalized representation of the 'FS_LOSSY' and 'FS_LOSSLESS' tables.

checkEndOfPassFF

private static void checkEndOfPassFF(byte[] data,
                                     int[] rates,
                                     boolean[] isterm,
                                     int n)
Ensures that at the end of a non-terminated coding pass there is not a 0xFF byte, modifying the stored rates if necessary.

Due to error resiliance reasons, a coding pass should never have its last byte be a 0xFF, since that can lead to the emulation of a resync marker. This method checks if that is the case, and reduces the rate for a given pass if necessary. The ommitted 0xFF will be synthetized by the decoder if necessary, as required by JPEG 2000. This method should only be called once that the entire code-block is coded.

Passes that are terminated are not checked for the 0xFF byte, since it is assumed that the termination procedure does not output any trailing 0xFF. Checking the terminated segments would involve much more than just modifying the stored rates.

NOTE: It is assumed by this method that the coded data does not contain consecutive 0xFF bytes, as is the case with the MQ and 'arithemetic coding bypass' bit stuffing policy. However, the termination policies used should also respect this requirement.

Parameters:
data - The coded data for the code-block
rates - The rate (i.e. accumulated number of bytes) for each coding pass
isterm - An array of flags indicating, for each pass, if it is terminated or not. If null it is assumed that no pass is terminated, except the last one.
n - The number of coding passes

initTileComp

public void initTileComp(int nt,
                         int nc)
Load options, length calculation type and termination type for each tile-component.

Parameters:
nt - The number of tiles
nc - The number of components

getPPX

public int getPPX(int t,
                  int c,
                  int rl)
Returns the precinct partition width for the specified component, tile and resolution level.

Specified by:
getPPX in interface CodedCBlkDataSrcEnc
Parameters:
t - the tile index
c - the component
rl - the resolution level
Returns:
The precinct partition width for the specified component, tile and resolution level

getPPY

public int getPPY(int t,
                  int c,
                  int rl)
Returns the precinct partition height for the specified component, tile and resolution level.

Specified by:
getPPY in interface CodedCBlkDataSrcEnc
Parameters:
t - the tile index
c - the component
rl - the resolution level
Returns:
The precinct partition height for the specified component, tile and resolution level

precinctPartitionUsed

public boolean precinctPartitionUsed(int c,
                                     int t)
Returns true if precinct partition is used for the specified component and tile, returns false otherwise.

Specified by:
precinctPartitionUsed in interface CodedCBlkDataSrcEnc
Parameters:
c - The component
t - The tile
Returns:
True if precinct partition is used for the specified component and tile, returns false otherwise.