int QccWAVZerotreeInitialize(QccWAVZerotree
*zerotree);
int QccWAVZerotreeCalcSizes(QccWAVZerotree *zerotree);
int
QccWAVZerotreeAlloc(QccWAVZerotree *zerotree);
void QccWAVZerotreeFree(QccWAVZerotree
*zerotree);
int QccWAVZerotreePrint(const QccWAVZerotree *zerotree);
The main component of a QccWAVZerotree structure is an array of symbols, where each symbol in the array corresponds to a wavelet coefficient in a subband pyramid. The value of the symbol indicates whether the coefficient in the subband pyramid is a significant coefficient, an insignificant coefficient, or a zerotree root. The zerotree structure is a popular method for the coding of two-dimensional images.
typedef struct
{
QccString filename;
QccString magic_num;
int major_version;
int minor_version;
int image_num_cols;
int image_num_rows;
double image_mean;
int num_levels;
int num_subbands;
int alphabet_size;
int *num_cols;
int *num_rows;
char ***zerotree;
} QccWAVZerotree;
The fields of QccWAVZerotree are as follows:
The zerotree array contains a symbol for each coefficient in the corresponding subband pyramid. The value of this symbol can be one of the following:
Additionally, QccPack provides the symbol QCCWAVZEROTREE_SYMBOLTEMP for a temporary labeling of a zerotree symbol. Symbols can be marked as "null" symbols use the function QccWAVZerotreeMakeNullSymbol(3) to do this, QccWAVZerotreeMakeSymbolNonnull(3) to reverse the "null" marking, and QccWAVZerotreeNullSymbol(3) to determine if a zerotree-array symbol is null or not.
The ZT file format consists of the following information:
where ZT is the magic number, X.X is the version number, <white space> is white space and/or comment lines, and image_num_cols, image_num_rows, image_mean, num_levels, and alphabet_size are ASCII representations of the corresponding fields of the QccWAVZerotree structure. Following the ASCII header information, the zerotree array is stored in binary with each zerotree symbol is stored as a 8-bit binary character.ZTX.X
<white space>
image_num_cols
image_num_rows
image_mean
num_levels
alphabet_size
<zerotree array>
.
.
.
filename: NULL string
magic_num: QCCZEROTREE_MAGICNUM
major_version, minor_version: initialized to output of QccGetQccPackVersion(3)
image_num_cols: 0
image_num_rows: 0
image_mean: 0
num_levels: 0
alphabet_size: QCCWAVZEROTREE_NUMSYMBOLS
num_cols: NULL
num_rows: NULL
zerotree: NULL
QccWAVZerotreeCalcSizes() calculates the size of each subband in the corresponding subband pyramid and fills in values for the zerotree->num_cols and zerotree->num_rows arrays. Both these arrays must be allocated with enough space for zerotree->num_subbands entries prior to calling QccWAVZerotreeCalcSizes(). In addition, the original image size must be assigned to zerotree->image_num_cols and zerotree->image_num_rows, and the number of levels of subband decomposition to zerotree->num_levels.
QccWAVZerotreeAlloc() allocates space for zerotree->num_cols, zerotree->num_rows, and zerotree->zerotree. Prior to calling QccWAVZerotreeAlloc(), zerotree->num_subbands, zerotree->num_levels, zerotree->image_num_rows, and zerotree->image_num_cols must contain valid values. Allocation of each of the arrays is performed only if the pointer for the array is NULL.
QccWAVZerotreeFree() frees the arrays allocated by QccWAVZerotreeAlloc()
QccWAVZerotreePrint() prints the contents of zerotree to stdout.
J. M. Shapiro, "Embedded Image Coding Using Zerotrees of Wavelet Coefficients," IEEE Transactions on Signal Processing, vol. 41, no. 12, pp. 3445-3462, December 1993.