| java.lang.Object jj2000.j2k.codestream.writer.PktEncoder
PktEncoder | public class PktEncoder (Code) | | 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.
|
Method Summary | |
public 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. | public byte[] | getLastBodyBuf() Returns the buffer of the body of the last encoded packet. | public int | getLastBodyLen() Returns the length of the body of the last encoded packet, in
bytes. | public static String[][] | getParameterInfo() Returns the parameters that are used in this class and implementing
classes. | public PrecInfo | getPrecInfo(int t, int c, int r, int p) | public int | getROILen() | public boolean | isPacketWritable() Returns true if the current packet is writable i.e. | public boolean | isROIinPkt() | public void | reset() Resets the state of the object to the initial state, as if the object
was just created. | public void | restore() Restores the last saved state of this object. | public void | save() Saves the current state of this object. |
OPT_PREFIX | final public static char OPT_PREFIX(Code) | | The prefix for packet encoding options: 'P'
|
PktEncoder | public PktEncoder(CodedCBlkDataSrcEnc infoSrc, J2KImageWriteParamJava wp, Point[][][] numPrec)(Code) | | Creates a new packet header encoder, using the information from the
'infoSrc' object. The information used is the number of components,
number of tiles, subband decomposition, etc.
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.
Parameters: infoSrc - The source of information to construct theobject. Parameters: encSpec - The parameters for the encoding Parameters: maxNumPrec - Maximum number of precinct in each tile, componentand resolution level. Parameters: pl - ParameterList instance that holds command line options |
encodePacket | public BitOutputBuffer encodePacket(int ly, int c, int r, int t, CBlkRateDistStats cbs, int tIndx, BitOutputBuffer hbuf, byte bbuf, int pIdx)(Code) | | Encodes a packet and returns the buffer containing the encoded packet
header. The code-blocks appear in a 3D array of CBlkRateDistStats,
'cbs'. The first index is the tile index in lexicographical order, the
second index is the subband index (as defined in the Subband class),
and the third index is the code-block index (whithin the subband tile)
in lexicographical order as well. The indexes of the new truncation
points for each code-block are specified by the 3D array of int
'tIndx'. The indices of this array are the same as for cbs. The
truncation point indices in 'tIndx' are the indices of the elements of
the 'truncIdxs' array, of the CBlkRateDistStats class, that give the
real truncation points. If a truncation point index is negative it
means that the code-block has not been included in any layer yet. If
the truncation point is less than or equal to the highest truncation
point used in previous layers then the code-block is not included in
the packet. Otherwise, if larger, the code-block is included in the
packet. The body of the packet can be obtained with the
getLastBodyBuf() and getLastBodyLen() methods.
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.
Parameters: ly - The layer index (starts at 1). Parameters: c - The component index. Parameters: r - The resolution level Parameters: t - Index of the current tile Parameters: cbs - The 3D array of coded code-blocks. Parameters: tIndx - The truncation point indices for each code-block. Parameters: hbuf - The header buffer. If null a new BitOutputBuffer is createdand returned. This buffer is reset before anything is written to it. Parameters: bbuf - The body buffer. If null a new one is created. If not largeenough a new one is created. Parameters: pIdx - The precinct index. The buffer containing the packet header. |
getLastBodyBuf | public byte[] getLastBodyBuf()(Code) | | Returns the buffer of the body of the last encoded packet. The length
of the body can be retrieved with the getLastBodyLen() method. The
length of the array returned by this method may be larger than the
actual body length.
The buffer of body of the last encoded packet. exception: IllegalArgumentException - If no packet has been coded sincelast reset(), last restore(), or object creation. See Also: PktEncoder.getLastBodyLen |
getLastBodyLen | public int getLastBodyLen()(Code) | | Returns the length of the body of the last encoded packet, in
bytes. The body itself can be retrieved with the getLastBodyBuf()
method.
The length of the body of last encoded packet, in bytes. See Also: PktEncoder.getLastBodyBuf |
getParameterInfo | public static String[][] getParameterInfo()(Code) | | Returns the parameters that are used in this class and implementing
classes. It returns a 2D String array. Each of the 1D arrays is for a
different option, and they have 3 elements. The first element is the
option name, the second one is the synopsis, the third one is a long
description of what the parameter is and the fourth is its default
value. The synopsis or description may be 'null', in which case it is
assumed that there is no synopsis or description of the option,
respectively. Null may be returned if no options are supported.
the options name, their synopsis and their explanation,or null if no options are supported. |
getPrecInfo | public PrecInfo getPrecInfo(int t, int c, int r, int p)(Code) | | Returns information about a given precinct
Parameters: t - Tile index. Parameters: c - Component index. Parameters: r - Resolution level index. Parameters: p - Precinct index |
getROILen | public int getROILen()(Code) | | Gives the length to read in current packet body to get all ROI
information
|
isPacketWritable | public boolean isPacketWritable()(Code) | | Returns true if the current packet is writable i.e. should be written.
Returns false otherwise.
|
isROIinPkt | public boolean isROIinPkt()(Code) | | Tells if there was ROI information in the last written packet
|
reset | public void reset()(Code) | | Resets the state of the object to the initial state, as if the object
was just created.
|
restore | public void restore()(Code) | | Restores the last saved state of this object. An
IllegalArgumentException is thrown if no state has been saved.
See Also: PktEncoder.save |
save | public void save()(Code) | | Saves the current state of this object. The last saved state
can be restored with the restore() method.
See Also: PktEncoder.restore |
|
|