int QccWAVspeck3DEncode(const QccIMGImageCube *image_cube, const QccIMGImageCube *mask, int transform_type, int temporal_num_levels, int spatial_num_levels, const QccWAVWavelet *wavelet, QccBitBuffer *output_buffer, int target_bit_cnt);
int QccWAVspeck3DDecodeHeader(QccBitBuffer *input_buffer, int *transform_type, int *temporal_num_levels, int *spatial_num_levels, int *num_frames, int *num_rows, int *num_cols, double *image_mean, int *max_coefficient_bits);
int QccWAVspeck3DDecode(QccBitBuffer *input_buffer, QccIMGImageCube *image_cube, const QccIMGImageCube *mask, int transform_type, int temporal_num_levels, int spatial_num_levels, const QccWAVWavelet *wavelet, double image_mean, int max_coefficient_bits, int target_bit_bit);
QccWAVspeck3DEncode() encodes an image cube, image_cube, using a 3D generalization of the SPECK algorithm. The original SPECK algorithm was developed for 2D images by Pearlman et al.; it was latter extended to 3D by Tang et al. In essence, the 3D-SPECK algorithm involves a 3D DWT followed by a progressive "bitplane" coding of the wavelet coefficients using a cube-splitting quantization structure based on octtrees. See "ALGORITHM" below for more detail.
image_cube is the image cube to be coded and output_buffer is the output bitstream. output_buffer must be of QCCBITBUFFER_OUTPUT type and opened via a prior call to QccBitBufferStart(3) .
QccWAVspeck3DEncode() supports the use of both wavelet-packet and dyadic wavelet-transform decompositions. If transform_type is QCCWAVSUBBANDPYRAMID3D_DYADIC, a dyadic DWT is used; if transform_type is QCCWAVSUBBANDPYRAMID3D_PACKET, a wavelet-packet DWT is used. temporal_num_levels and spatial_num_levels give the number of levels of wavelet decomposition to perform for both transform types; for a dyadic transform, temporal_num_levels should equal spatial_num_levels. wavelet is the wavelet to use for decomposition.
The bitstream output from the 3D-SPECK encoder is embedded, meaning that any prefix of the bitstream can be decoded to give a valid representation of the image. The 3D-SPECK encoder essentially produces output bits until the number of bits output reaches target_bit_cnt, the desired (target) total length of the output bitstream in bits, and then it stops. Note that this is the bitstream length in bits, not the rate of the bitstream (which would be expressed in bits per voxel).
QccWAVspeck3DEncode() optionally supports the use of a shape-adaptive DWT (SA-DWT) rather than the usual DWT. That is, QccWAVspeck3DEncode() can call QccWAVSubbandPyramid3DShapeAdaptiveDWT(3) as the wavelet transform rather than the usual QccWAVSubbandPyramid3DDWT(3) . The use of a SA-DWT is indicated by a non-NULL mask; if mask is NULL, then the usual DWT is used. In the case of a SA-DWT, mask gives the transparency mask which indicates which voxels of the image are non-transparent and thus have data that is to be transformed. Refer to QccWAVSubbandPyramid3DShapeAdaptiveDWT(3) for more details on the calculation of this SA-DWT. See "ALGORITHM" below for details on how the 3D-SPECK algorithm handles shape-adaptive coding.
QccWAVspeck3DDecodeHeader() decodes the header information in a bitstream previously produced by QccWAVspeck3DEncode(). The input bitstream is input_buffer which must be of QCCBITBUFFER_INPUT type and opened via a prior call to QccBitBufferStart(3) .
The header information is returned in transform_type (either QCCWAVSUBBANDPYRAMID3D_DYADIC or QCCWAVSUBBANDPYRAMID3D_PACKET to indicate a dyadic or wavelet-packet transform decomposition, respectively), temporal_num_levels (number of levels of wavelet decomposition in the temporal direction), spatial_num_levels (number of levels of wavelet decomposition in the spatial directions), num_frames (size of the image cube in the temporal direction), num_rows (vertical size of image cube), num_cols (horizontal size of image cube), image_mean (the mean value of the original image cube), and max_coefficient_bits (indicates the precision, in number of bits, of the wavelet coefficient with the largest magnitude).
QccWAVspeck3DDecode() decodes the bitstream input_buffer, producing the reconstructed image cube, image_cube. The bitstream must already have had its header read by a prior call to QccWAVspeck3DDecodeHeader() (i.e., you call QccWAVspeck3DDecodeHeader() first and then QccWAVspeck3DDecode()). If target_bit_cnt is QCCENT_ANYNUMBITS, then decoding stops when the end of the input bitstream is reached; otherwise, decoding stops when target_num_bits from the input bitstream have been decoded.
If a SA-DWT was used in 3D-SPECK encoding, then the original transparency mask should be passed to QccWAVspeck3DDecode() as mask. That is, mask should be the same transparency mask (untransformed) that was passed to QccWAVspeck3DEncode(). Note that QccWAVspeck3DDecode() will transform this mask via a Lazy wavelet transform, and then pass the transformed mask to QccWAVSubbandPyramid3DInverseShapeAdaptiveDWT(3) . If the usual, full-volume DWT was used in encoding, then mask should be a NULL pointer.
The QccPack implementation of 3D-SPECK supports shape-adaptive coding by generalizing the 2D OB-SPECK approach described by Lu and Pearlman to 3D (see QccWAVspeckEncode(3) ).
X. Tang, W. A. Pearlman, and J. W. Modestino, "Hyperspectral Image Compression Using Three-Dimensional Wavelet Coding," in Image and Video Communications and Processing, Santa Clara, CA, January 2003, Proc. SPIE 5022, pp. 1037-1047.
W. A. Pearlman, A. Islam, N. Nagaraj, and A. Said, "Efficient, Low-Complexity Image Coding with a Set-Partitioning Embedded Block Coder," IEEE Transactions on Circuits and Systems for Video Technology, to appear, 2003.
A. Islam and W. A. Pearlman, "An Embedded and Efficient Low-Complexity Hierarchical Image Coder," in Visual Communications and Image Processing, K. Aizawa, R. L. Stevenson, and Y.-Q. Zhang, Eds., San Jose, CA, January 1999, Proc. SPIE 3653, pp. 294-305.
Z. Lu and W. A. Pearlman, "Wavelet Video Coding of Video Object by Object-Based SPECK Algorithm," in Proceedings of the Picture Coding Symposium, Seoul, Korea, April 2001, pp. 413-416.