Table of Contents

NAME

QccWAVwdr3DEncode, QccWAVwdr3DDecode - encode/decode an image cube using the 3D-WDR algorithm

SYNOPSIS

#include "libQccPack.h"

int QccWAVwdr3DEncode(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 QccWAVwdr3DDecodeHeader(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 QccWAVwdr3DDecode(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);

DESCRIPTION

Encoding

QccWAVwdr3DEncode() encodes an image cube, image_cube, using a 3D generalization of the WDR algorithm. The original WDR algorithm was developed for 2D images by Tian and Wells; it was latter extended to 3D by Rucker and Fowler. In essence, the 3D-WDR algorithm involves a 3D DWT followed by a progressive "bitplane" coding of the wavelet coefficients involving a form of runlength coding of significance information.

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

QccWAVwdr3DEncode() 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-WDR encoder is embedded, meaning that any prefix of the bitstream can be decoded to give a valid representation of the image. The 3D-WDR 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).

QccWAVwdr3DEncode() optionally supports the use of a shape-adaptive DWT (SA-DWT) rather than the usual DWT. That is, QccWAVwdr3DEncode() 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. The wavelet transform is essentially the only component of the 3D-WDR algorithm that is affected by the shape-adaptive nature of the processing. That is, transparent regions in the image are effectively skipped over when the 3D-WDR algorithm is initialized; i.e., transparent coefficients are not added to the lists of coefficients when the lists are created. Thus, the transparent coefficients are not counted in the calculation of runlengths.

Decoding

QccWAVwdr3DDecodeHeader() decodes the header information in a bitstream previously produced by QccWAVwdr3DEncode(). 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).

QccWAVwdr3DDecode() 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 QccWAVwdr3DDecodeHeader() (i.e., you call QccWAVwdr3DDecodeHeader() first and then QccWAVwdr3DDecode()). 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-WDR encoding, then the original transparency mask should be passed to QccWAVwdr3DDecode() as mask. That is, mask should be the same transparency mask (untransformed) that was passed to QccWAVwdr3DEncode(). Note that QccWAVwdr3DDecode() 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.

SEE ALSO

wdrencode3d(1) , wdrdecode3d(1) , QccBitBuffer(3) , QccWAVSubbandPyramid3D(3) , QccWAVSubbandPyramid3DDWT(3) , QccWAVSubbandPyramid3DShapeAdaptiveDWT(3) , QccWAVwdrEncode(3) , QccPackWAV(3) , QccPackIMG(3) , QccPack(3)

J. Tian and R. O. Wells, Jr., "Embedded Image Coding Using Wavelet Difference Reduction", in Wavelet Image and Video Compression, P. N. Topiwala, Ed., pp. 289-302, Kluwer Academic Publishers, Norwell, MA, 1998.

AUTHOR

Written by Justin Rucker based on the 2D-WDR implementation by Yufei Yuan.

Copyright (C) 1997-2021 James E. Fowler


Table of Contents



Get QccPack at SourceForge.net. Fast, secure and Free Open Source software downloads