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.
///
///
///