[]
        
(Showing Draft Content)

CSJ2K.j2k.codestream.writer.PktEncoder.encodePacket

encodePacket Method

encodePacket(int, int, int, int, CBlkRateDistStats[][], int[][], BitOutputBuffer, byte[], int)

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.

       <p>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.</p>
Declaration
public virtual BitOutputBuffer encodePacket(int ly, int c, int r, int t, CBlkRateDistStats[][] cbs, int[][] tIndx, BitOutputBuffer hbuf, byte[] bbuf, int pIdx)
Parameters
Type Name Description
int ly

The layer index (starts at 1).

int c

The component index.

int r

The resolution level

int t

Index of the current tile

CBlkRateDistStats[][] cbs

The 3D array of coded code-blocks.

int[][] tIndx

The truncation point indices for each code-block.

BitOutputBuffer hbuf

The header buffer. If null a new BitOutputBuffer is created and returned. This buffer is reset before anything is written to it.

byte[] bbuf

The body buffer. If null a new one is created. If not large enough a new one is created.

int pIdx

The precinct index.

Returns
Type Description
BitOutputBuffer

The buffer containing the packet header.