public class PktEncoder extends Object
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.
Modifier and Type | Field and Description |
---|---|
static char |
OPT_PREFIX
The prefix for packet encoding options: 'P'
|
Constructor and Description |
---|
PktEncoder(CodedCBlkDataSrcEnc infoSrc,
J2KImageWriteParamJava wp,
Point[][][] numPrec)
Creates a new packet header encoder, using the information from the
'infoSrc' object.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
static String[][] |
getParameterInfo()
Returns the parameters that are used in this class and implementing
classes.
|
PrecInfo |
getPrecInfo(int t,
int c,
int r,
int p)
Returns information about a given precinct
|
int |
getROILen()
Gives the length to read in current packet body to get all ROI
information
|
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.
|
public static final char OPT_PREFIX
public PktEncoder(CodedCBlkDataSrcEnc infoSrc, J2KImageWriteParamJava wp, Point[][][] numPrec)
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 optionspublic 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 index.public byte[] getLastBodyBuf()
IllegalArgumentException
- If no packet has been coded since
last reset(), last restore(), or object creation.getLastBodyLen()
public int getLastBodyLen()
getLastBodyBuf()
public void save()
restore()
public void restore()
save()
public void reset()
public boolean isPacketWritable()
public boolean isROIinPkt()
public int getROILen()
public static String[][] getParameterInfo()
public PrecInfo getPrecInfo(int t, int c, int r, int p)
t
- Tile index.c
- Component index.r
- Resolution level index.p
- Precinct indexCopyright © 2014. All rights reserved.