|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jj2000.j2k.codestream.writer.PktEncoder
This class builds packets and keeps the state information of packet interdependencies. It also supports saving the state and reverting (restoring) to the last saved state, with the save() and restore() methods.
Each time the encodePacket() method is called a new packet is encoded, the packet header is returned by the method, and the packet body can be obtained with the getLastBodyBuf() and getLastBodyLen() methods.
Field Summary | |
private int[][][][][] |
bak_lblock
The saved base number of bits for sending code-block length information. |
private int[][][][][] |
bak_prevtIdxs
The saved last encoded truncation point for each code-block. |
private CBlkCoordInfo[][][][][] |
cbArrayI
Array containing the coordinates, width, height, indexes, ... |
(package private) EncoderSpecs |
encSpec
The encoder specs |
private Coord[][][] |
incArray
Array containing the increment step 1st dim : tile index 2nd dim : component index 3rd dim : resolution level |
private Coord[][] |
incArrayMax
Array containing the maximum increment step 1st dim : tile index 2nd dim : component index |
private CodedCBlkDataSrcEnc |
infoSrc
The source object |
private static int |
INIT_LBLOCK
The initial value for the lblock |
private byte[] |
lbbuf
The body buffer of the last encoded packet |
private int |
lblen
The body length of the last encoded packet |
private int[][][][][] |
lblock
The base number of bits for sending code-block length information (referred as Lblock in the JPEG 2000 standard). |
private Coord[][][] |
maxNumPrec
Maximum number of precincts in each resolution level : 1st dim: tile index. 2nd dim: component index. 3nd dim: resolution level index. |
(package private) int[][] |
mrl
The maximum number of resolution level for each component and each tile |
static char |
OPT_PREFIX
The prefix for packet encoding options: 'P' |
private boolean |
packetWritable
Whether or not the current packet is writable |
private static java.lang.String[][] |
pinfo
The list of parameters that is accepted for packet encoding. |
private PrecCoordInfo[][][][][] |
precArrayI
Array containing the coordinates, width, height, indexes, ... |
private int[][][][][] |
prevtIdxs
The last encoded truncation point for each code-block. |
private boolean |
roiInPkt
Whether or not there is ROI information in the last encoded Packet |
private int |
roiLen
Length to read in current packet body to get all the ROI information |
private boolean |
saved
The saved state |
private SubbandAn[][] |
savedSbTree
Backup of the subband tree for each tile and component as they are used quite often. |
private Coord[][][][] |
sot_eotArray
Array used to store the start/end of tile horizontal and vertical coordinates at each resolution level 1st dim : tile index 2nd dim : component index 3rd dim : resolution level 4th dim : 0, start of tile, 1, end of tile |
private Coord[][][] |
sot_eotArrayMax
Array used to store the start/end of tile horizontal and vertical coordinates at the highest resolution level using the smallest increments 1st dim : tile index 2nd dim : component index 3rd dim : 0, start of tile, 1, end of tile |
private int[][][][] |
subRange
Keeps the first and the last subband index in the associated resolution level for each tile and each component |
private TagTreeEncoder[][][][][] |
ttIncl
The tag tree for inclusion information. |
private TagTreeEncoder[][][][][] |
ttMaxBP
The tag tree for the maximum significant bit-plane. |
Constructor Summary | |
PktEncoder(CodedCBlkDataSrcEnc infoSrc,
EncoderSpecs encSpec,
Coord[][][] maxNumPrec,
ParameterList pl)
Creates a new packet header encoder, using the information from the 'infoSrc' object. |
Method Summary | |
private void |
buildCblkPrec(int t,
int c,
int resLvl)
Builds the lists containing the ulx, uly, width, height and indexes of the code-blocks and of the precincts for each tile, component, resolution level and subband. |
private void |
buildIncArrays(int c,
int t)
Creates the arrays incArray and incArrayMax. |
private void |
buildSotEotArrays(int c,
int t)
Creates the arrays sot_eotArray and sot_eotArrayMax. |
BitOutputBuffer |
encodePacket(int ly,
int c,
int r,
int t,
CBlkRateDistStats[][] cbs,
int[][] tIndx,
BitOutputBuffer hbuf,
byte[] bbuf,
int pIdx)
Encodes a packet and returns the buffer containing the encoded packet header. |
private int[][] |
findSubInResLvl(int c,
int t)
Finds the number of subbands in each resolution level according to the decomposition tree for the specified tile and component. |
java.util.Vector |
getCBlkInPrec(int t,
int c,
int r,
int sbIdx,
int precIdx,
java.util.Vector cblks)
Returns the code-blocks contained in the precinct which index is precIdx for the tile 't', the component 'c', the resolution level 'r' and the subband index 'sbIdx'. |
Coord |
getIncArray(int t,
int c,
int r)
Returns the 'incArray' for the specified component, tile and resolution level. |
Coord |
getIncArrayMax(int t,
int c)
Returns the 'incArrayMax' for the specified component and tile. |
byte[] |
getLastBodyBuf()
Returns the buffer of the body of the last encoded packet. |
int |
getLastBodyLen()
Returns the length of the body of the last encoded packet, in bytes. |
int[][] |
getMRL()
Returns the maximum resolution level for all tile-components. |
static java.lang.String[][] |
getParameterInfo()
Returns the parameters that are used in this class and implementing classes. |
int |
getROILen()
Gives the length to read in current packet body to get all ROI information |
Coord[] |
getSotEotArray(int t,
int c,
int r)
Returns the 'sot_eotArray' for the specified component, tile and resolution level. |
Coord[] |
getSotEotArrayMax(int t,
int c)
Returns the 'sot_eotArrayMax' for the specified component and tile. |
boolean |
isPacketWritable()
Returns true if the current packet is writable i.e. |
boolean |
isROIinPkt()
Tells if there was ROI information in the last written packet |
void |
reset()
Resets the state of the object to the initial state, as if the object was just created. |
void |
restore()
Restores the last saved state of this object. |
void |
save()
Saves the current state of this object. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final char OPT_PREFIX
private static final java.lang.String[][] pinfo
private static final int INIT_LBLOCK
private CodedCBlkDataSrcEnc infoSrc
EncoderSpecs encSpec
private TagTreeEncoder[][][][][] ttIncl
private TagTreeEncoder[][][][][] ttMaxBP
private int[][][][][] lblock
private int[][][][][] prevtIdxs
What is actually stored is the index of the element in CBlkRateDistStats.truncIdxs that gives the real truncation point.
private int[][][][][] bak_lblock
private int[][][][][] bak_prevtIdxs
private byte[] lbbuf
private int lblen
private boolean saved
private boolean roiInPkt
private int roiLen
private PrecCoordInfo[][][][][] precArrayI
private CBlkCoordInfo[][][][][] cbArrayI
private Coord[][][] maxNumPrec
private Coord[][][] incArray
private Coord[][] incArrayMax
private Coord[][][][] sot_eotArray
private Coord[][][] sot_eotArrayMax
int[][] mrl
private int[][][][] subRange
private boolean packetWritable
private SubbandAn[][] savedSbTree
Constructor Detail |
public PktEncoder(CodedCBlkDataSrcEnc infoSrc, EncoderSpecs encSpec, Coord[][][] maxNumPrec, ParameterList pl)
Note that this constructor visits all the tiles in the 'infoSrc' object. The 'infoSrc' object is left at the original tile (i.e. the current tile before calling this constructor), but any side effects of visiting the tiles is not reverted.
infoSrc
- The source of information to construct the
object.encSpec
- The parameters for the encodingmaxNumPrec
- Maximum number of precinct in each tile, component
and resolution level.pl
- ParameterList instance that holds command line optionsMethod Detail |
public BitOutputBuffer encodePacket(int ly, int c, int r, int t, CBlkRateDistStats[][] cbs, int[][] tIndx, BitOutputBuffer hbuf, byte[] bbuf, int pIdx)
Layers must be coded in increasing order, in consecutive manner, for each tile, component and resolution level (e.g., layer 1, then layer 2, etc.). For different tile, component and/or resolution level no particular order must be followed.
ly
- The layer index (starts at 1).c
- The component index.r
- The resolution levelt
- Index of the current tilecbs
- The 3D array of coded code-blocks.tIndx
- The truncation point indices for each code-block.hbuf
- The header buffer. If null a new BitOutputBuffer is created
and returned. This buffer is reset before anything is written to it.bbuf
- The body buffer. If null a new one is created. If not large
enough a new one is created.pIdx
- The precinct indexpublic byte[] getLastBodyBuf()
getLastBodyLen()
public int getLastBodyLen()
getLastBodyBuf()
public void save()
restore()
public void restore()
save()
public void reset()
private void buildIncArrays(int c, int t)
t
- the tile indexc
- the component indexprivate void buildSotEotArrays(int c, int t)
t
- the tile indexc
- the component indexprivate void buildCblkPrec(int t, int c, int resLvl)
t
- the tile indexc
- the component indexppx
- the precinct partition widthppy
- the precinct partition heightresLvl
- The resolution levelpublic java.util.Vector getCBlkInPrec(int t, int c, int r, int sbIdx, int precIdx, java.util.Vector cblks)
t
- the tile indexc
- the component indexr
- the resolution levelsbIdx
- the subband indexprecIdx
- the precinct indexcblks
- the Vector object in which to return the code-blocks
indexesprivate int[][] findSubInResLvl(int c, int t)
c
- The componentt
- the tilepublic Coord[] getSotEotArray(int t, int c, int r)
c
- The componentt
- The tiler
- The resolution levelpublic Coord[] getSotEotArrayMax(int t, int c)
c
- The componentt
- The tilepublic Coord getIncArray(int t, int c, int r)
c
- The componentt
- The tiler
- The resolution levelpublic Coord getIncArrayMax(int t, int c)
c
- The componentt
- The tilepublic int[][] getMRL()
public boolean isPacketWritable()
public boolean isROIinPkt()
public int getROILen()
public static java.lang.String[][] getParameterInfo()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |