|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectucar.jpeg.jj2000.j2k.codestream.writer.PktEncoder
public class 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 | |
---|---|
static char |
OPT_PREFIX
The prefix for packet encoding options: 'P' |
Constructor Summary | |
---|---|
PktEncoder(CodedCBlkDataSrcEnc infoSrc,
EncoderSpecs encSpec,
Coord[][][] numPrec,
ParameterList pl)
Creates a new packet encoder object, using the information from the 'infoSrc' object. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char OPT_PREFIX
Constructor Detail |
---|
public PktEncoder(CodedCBlkDataSrcEnc infoSrc, EncoderSpecs encSpec, Coord[][][] numPrec, ParameterList pl)
infoSrc
- The source of information to construct the object.encSpec
- The encoding parameters.numPrec
- Maximum number of precincts 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 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 index
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |