C# Class CSJ2K.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.

Mostrar archivo Open project: cureos/csj2k Class Usage Examples

Public Methods

Method Description
PktEncoder ( CodedCBlkDataSrcEnc infoSrc, CSJ2K.j2k.encoder.EncoderSpecs encSpec, Coord numPrec, CSJ2K.j2k.util.ParameterList pl ) : System

Creates a new packet encoder object, using the information from the 'infoSrc' object.

encodePacket ( int ly, int c, int r, int t, CSJ2K.j2k.entropy.encoder.CBlkRateDistStats cbs, int tIndx, CSJ2K.j2k.codestream.writer.BitOutputBuffer hbuf, byte bbuf, int pIdx ) : CSJ2K.j2k.codestream.writer.BitOutputBuffer

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.

getPrecInfo ( int t, int c, int r, int p ) : CSJ2K.j2k.codestream.PrecInfo

Returns information about a given precinct

reset ( ) : void

Resets the state of the object to the initial state, as if the object was just created.

restore ( ) : void

Restores the last saved state of this object. An IllegalArgumentException is thrown if no state has been saved.

save ( ) : void

Saves the current state of this object. The last saved state can be restored with the restore() method.

Private Methods

Method Description
fillPrecInfo ( int t, int c, int r ) : void

Retrives precincts and code-blocks coordinates in the given resolution, component and tile. It terminates TagTreeEncoder initialization as well.

Method Details

PktEncoder() public method

Creates a new packet encoder object, using the information from the 'infoSrc' object.
public PktEncoder ( CodedCBlkDataSrcEnc infoSrc, CSJ2K.j2k.encoder.EncoderSpecs encSpec, Coord numPrec, CSJ2K.j2k.util.ParameterList pl ) : System
infoSrc CodedCBlkDataSrcEnc The source of information to construct the object. /// ///
encSpec CSJ2K.j2k.encoder.EncoderSpecs The encoding parameters. /// ///
numPrec Coord Maximum number of precincts in each tile, component /// and resolution level. /// ///
pl CSJ2K.j2k.util.ParameterList ParameterList instance that holds command line options /// ///
return System

encodePacket() public method

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.

public encodePacket ( int ly, int c, int r, int t, CSJ2K.j2k.entropy.encoder.CBlkRateDistStats cbs, int tIndx, CSJ2K.j2k.codestream.writer.BitOutputBuffer hbuf, byte bbuf, int pIdx ) : CSJ2K.j2k.codestream.writer.BitOutputBuffer
ly int The layer index (starts at 1). /// ///
c int The component index. /// ///
r int The resolution level /// ///
t int Index of the current tile /// ///
cbs CSJ2K.j2k.entropy.encoder.CBlkRateDistStats The 3D array of coded code-blocks. /// ///
tIndx int The truncation point indices for each code-block. /// ///
hbuf CSJ2K.j2k.codestream.writer.BitOutputBuffer The header buffer. If null a new BitOutputBuffer is created /// and returned. This buffer is reset before anything is written to it. /// ///
bbuf byte The body buffer. If null a new one is created. If not large /// enough a new one is created. /// ///
pIdx int The precinct index. /// ///
return CSJ2K.j2k.codestream.writer.BitOutputBuffer

getPrecInfo() public method

Returns information about a given precinct
public getPrecInfo ( int t, int c, int r, int p ) : CSJ2K.j2k.codestream.PrecInfo
t int Tile index. /// ///
c int Component index. /// ///
r int Resolution level index. /// ///
p int Precinct index /// ///
return CSJ2K.j2k.codestream.PrecInfo

reset() public method

Resets the state of the object to the initial state, as if the object was just created.
public reset ( ) : void
return void

restore() public method

Restores the last saved state of this object. An IllegalArgumentException is thrown if no state has been saved.
public restore ( ) : void
return void

save() public method

Saves the current state of this object. The last saved state can be restored with the restore() method.
public save ( ) : void
return void