|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jj2000.j2k.codestream.reader.PktDecoder
This class is used to read packet's head and body. All the members must be re-initialized at the beginning of each tile thanks to the restart() method.
Field Summary | |
private PktHeaderBitReader |
bin
The wrapper to read bits for the packet heads |
private CBlkCoordInfo[][][][][] |
cbCoord
Array containing the coordinates, width, height, indexes, ... |
private java.util.Vector[] |
cblks
List of code-blocks found in last read packet head (one list per subband) |
private DecoderSpecs |
decSpec
Reference to decoder specifications |
private RandomAccessIO |
ehs
Reference to the stream where to read from |
private boolean |
ephUsed
Whether or not EPH marker are used |
private HeaderDecoder |
hd
Reference to the HeaderDecoder |
private Coord[][] |
incArray
Array containing the increment step 1st dim : component index 2nd dim : resolution level |
private Coord[] |
incArrayMax
Array containing the maximum increment step 1st dim : component index |
private int |
INIT_LBLOCK
Initial value of the state variable associated with code-block length. |
private boolean |
isTruncMode
True if truncation mode is used. |
private int[][][][][] |
lblock
Lblock value used to read code size information in each packet head: 1st dim: component index. 2nd dim: resolution level index. 3rd dim: subband index. 4th/5th dim: code-block index (vert. |
private Coord[][] |
maxNumPrecincts
Maximum number of precincts : 1st dim: component index. 2nd dim: resolution level index. |
private int[] |
mdl
The maximum number of decomposition levels for each component |
private int |
nc
The number of components |
private int |
nl
Number of layers in t he current tile |
private int |
pktIdx
Index of the current packet in the tile. |
private boolean |
pph
Flag indicating whether packed packet header was used for this tile |
private java.io.ByteArrayInputStream |
pphbais
The packed packet header if it was used |
private PrecCoordInfo[][][][] |
precCoord
Array containing the coordinates, width, height, indexes, ... |
private boolean |
sopUsed
Whether or not SOP marker segment are used |
private Coord[][][] |
sotEotArray
Array used to store the start/end of tile horizontal and vertical coordinates at each resolution level 1st dim : component index 2nd dim : resolution level 3rd dim : 0, start of tile, 1, end of tile |
private Coord[][] |
sotEotArrayMax
Array used to store the start/end of tile horizontal and vertical coordinates at the highest resolution level using the smallest increments 1st dim : component index 2nd dim : 0, start of tile, 1, end of tile |
private FileBitstreamReaderAgent |
src
Reference to the codestream reader agent |
private int[][][] |
subRange
Keeps the first and the last subband index in the associated component and resolution level: 1st dim: component index 2nd dim: resolution level index 3rd dim: max and min value |
private TagTreeDecoder[][][][] |
tdBDA
Tag tree used to read bit-depth information in packet's head: 1st dim: component index. 2nd dim: resolution level index. 3rd dim: subband index. 4th dim: precinct index. |
private TagTreeDecoder[][][][] |
tdInclA
Tag tree used to read inclusion informations in packet's head: 1st dim: component index. 2nd dim: resolution level index. 3rd dim: subband index. 4th dim: precinct index. |
private int |
tIdx
Index of the current tile |
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_ER_TERM,
OPT_REG_TERM,
OPT_RESET_MQ,
OPT_SEG_MARKERS,
OPT_VERT_STR_CAUSAL,
STRIPE_HEIGHT |
Constructor Summary | |
PktDecoder(DecoderSpecs decSpec,
HeaderDecoder hd,
RandomAccessIO ehs,
FileBitstreamReaderAgent src,
boolean isTruncMode)
Create an empty PktDecoder object associated with given decoder specifications and HeaderDecoder. |
Method Summary | |
private void |
buildCBlkPrecCoord(int c,
int r)
Builds the lists containing the ulx, uly, width, height and indexes of the code-blocks and of the precincts for each component, resolution level and subband. |
private void |
buildIncArrays(int c)
Creates the arrays incArray and incArrayMax. |
private void |
buildSotEotArrays(int c)
Creates the arrays sotEotArray and sotEotArrayMax. |
private int[][][] |
findSubInResLvl()
Finds the number of subbands in each resolution level according to the decomposition tree of each component. |
private java.util.Vector |
getCBlkInPrecinct(int c,
int r,
int s,
int p)
Returns the code-blocks contained in the precinct which index is p for component c, the resolution level r and the subband index s.The returned object is a Vector object whose first element is a Coord object containing the number of code-blocks in each direction and then, cblks contains all the code-blocks indexes. |
Coord |
getIncArray(int c,
int r)
Returns the 'incArray' for the specified component and resolution level. |
Coord |
getIncArrayMax(int c)
Returns the 'incArrayMax' for the specified component. |
int |
getNumPrecinct(int c,
int r)
Get the number of precinct in given component and resolution. |
int |
getPPX(int t,
int c,
int r)
Returns the precinct partition width for the specified component, resolution level and tile. |
int |
getPPY(int t,
int c,
int rl)
Returns the precinct partition height for the specified component, resolution level and tile. |
Coord[] |
getSotEotArray(int c,
int r)
Returns the 'sotEotArray' for the specified component and resolution level. |
Coord[] |
getSotEotArrayMax(int c)
Returns the 'sotEotArrayMax' for the specified component. |
void |
readEPHMarker(PktHeaderBitReader bin)
Try to read an EPH marker. |
boolean |
readPktBody(int l,
int r,
int c,
int p,
CBlkInfo[][][] cbI,
int[] nb)
Reads specificied packet body in order to find offset of each code-block's piece of codeword. |
boolean |
readPktHead(int l,
int r,
int c,
int p,
CBlkInfo[][][] cbI,
int[] nb)
Read specified packet head and found length of each code-block's piece of codewords as well as number of skipped most significant bit-planes. |
boolean |
readSOPMarker(int[] nBytes,
int p,
int c,
int r)
Try to read a SOP marker and check that its sequence number if not out of sequence. |
(package private) CBlkInfo[][][][][] |
restart(int nc,
int[] mdl,
int nl,
CBlkInfo[][][][][] cbI,
boolean pph,
java.io.ByteArrayInputStream pphbais)
Re-initialize the PacketDecoder at the beginning of a new tile. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private FileBitstreamReaderAgent src
private boolean pph
private java.io.ByteArrayInputStream pphbais
private DecoderSpecs decSpec
private HeaderDecoder hd
private final int INIT_LBLOCK
private PktHeaderBitReader bin
private RandomAccessIO ehs
private Coord[][] maxNumPrecincts
private int tIdx
private CBlkCoordInfo[][][][][] cbCoord
private PrecCoordInfo[][][][] precCoord
private int[][][][][] lblock
private TagTreeDecoder[][][][] tdInclA
private TagTreeDecoder[][][][] tdBDA
private int nl
private int[][][] subRange
private int[] mdl
private int nc
private Coord[][] incArray
private Coord[] incArrayMax
private Coord[][][] sotEotArray
private Coord[][] sotEotArrayMax
private boolean sopUsed
private boolean ephUsed
private int pktIdx
private java.util.Vector[] cblks
private boolean isTruncMode
Constructor Detail |
public PktDecoder(DecoderSpecs decSpec, HeaderDecoder hd, RandomAccessIO ehs, FileBitstreamReaderAgent src, boolean isTruncMode)
decSpec
- The decoder specificationshd
- The HeaderDecoder instanceehs
- The stream where to read data fromsrc
- The bit stream reader agentisTruncMode
- Whether or not truncation mode is usedMethod Detail |
CBlkInfo[][][][][] restart(int nc, int[] mdl, int nl, CBlkInfo[][][][][] cbI, boolean pph, java.io.ByteArrayInputStream pphbais)
nc
- The number of components in this tilemdl
- The maximum number of decomposition level in each component
of this tilenl
- The number of layers in this tilecbI
- The code-blocks arraypph
- Flag inicating whether packed packet headers was usedpphbais
- Stream containing the packed packet headerspublic int getNumPrecinct(int c, int r)
c
- Component indexr
- Resolution indexpublic boolean readPktHead(int l, int r, int c, int p, CBlkInfo[][][] cbI, int[] nb) throws java.io.IOException
l
- layer indexr
- Resolution level indexc
- Component indexp
- Precinct indexcbI
- CBlkInfo array of relevant component and resolution
level.nb
- The number of bytes to read in each tile before reaching
output rate (used by truncation mode)public boolean readPktBody(int l, int r, int c, int p, CBlkInfo[][][] cbI, int[] nb) throws java.io.IOException
l
- layer indexr
- Resolution level indexc
- Component indexp
- Precinct indexcbI
- CBlkInfo array of relevant component and resolution
level.nb
- The remainding number of bytes to read from the bit stream in
each tile before reaching the decoding rate (in truncation mode)private void buildSotEotArrays(int c)
c
- the component indexprivate void buildIncArrays(int c)
c
- the component indexprivate void buildCBlkPrecCoord(int c, int r)
c
- the component indexr
- The resolution levelpublic final int getPPX(int t, int c, int r)
t
- the tile indexc
- The index of the component (between 0 and C-1)r
- The resolution level, from 0 to L.public final int getPPY(int t, int c, int rl)
t
- the tile indexc
- The index of the component (between 0 and C-1)rl
- The resolution level, from 0 to L.private java.util.Vector getCBlkInPrecinct(int c, int r, int s, int p)
c
- the component indexr
- the resolution levels
- the subband indexp
- the precinct indexprivate int[][][] findSubInResLvl()
public boolean readSOPMarker(int[] nBytes, int p, int c, int r) throws java.io.IOException
nBytes
- The number of bytes left to read from each tilep
- Precinct indexr
- Resolution level indexc
- Component indexpublic void readEPHMarker(PktHeaderBitReader bin) throws java.io.IOException
bin
- The packet header reader to read the EPH marker frompublic Coord[] getSotEotArray(int c, int r)
c
- The componentr
- The resolution levelpublic Coord[] getSotEotArrayMax(int c)
c
- The componentpublic Coord getIncArray(int c, int r)
c
- The componentr
- The resolution levelpublic Coord getIncArrayMax(int c)
c
- The component
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |