Table of Contents

NAME

QccWAVZerotree - data structure QccWAVZerotree and corresponding ZT file format for zerotree

SYNOPSIS

#include "libQccPack.h"

int QccWAVZerotreeInitialize(QccWAVZerotree *zerotree);
int QccWAVZerotreeCalcSizes(QccWAVZerotree *zerotree);
int QccWAVZerotreeAlloc(QccWAVZerotree *zerotree);
void QccWAVZerotreeFree(QccWAVZerotree *zerotree);
int QccWAVZerotreePrint(const QccWAVZerotree *zerotree);

DESCRIPTION

QccPack provides data structure QccWAVZerotree for representing a zerotree map for a dyadic subband decomposition. This zerotree would identify tree-like regions of zeros in a corresponding subband pyramid (a separate QccWAVSubbandPyramid structure). The zerotree structure can be read from and written to ZT-format files, or a QccWAVZerotree structure can be used without file input or output.

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.

DATA STRUCTURE

The QccWAVZerotree data structure is defined as:

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:

filename
The name of the file.
magic_num, major_version, minor_version
The magic number and version of the file.
image_num_cols, image_num_rows
The size of the zerotree array (which is also the size of the original two-dimensional image).
image_mean
The mean of the original image.
num_levels
Number of levels (scales) of dyadic subband decomposition in the subband pyramid for which the zerotree is constructed.
num_subbands
The number of subbands in the dyadic subband decomposition (equal to 3*num_levels + 1).
alphabet_size
Number of distinct, non-null symbols that can occur in the zerotree array (will be QCCWAVZEROTREE_NUMSYMBOLS).
num_cols, num_rows
The number of columns and rows, respectively, of each subband of the dyadic subband pyramid. Both of these two arrays have num_subbands entries.
zerotree
The array of symbols giving the zerotree map.

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:

QCCWAVZEROTREE_SYMBOLSIGNIFICANT
The corresponding coefficient is significant.
QCCWAVZEROTREE_SYMBOLINSIGNIFICANT
The corresponding coefficient is insignificant.
QCCWAVZEROTREE_SYMBOLZTROOT
The corresponding coefficient is a zerotree root.

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.

FILE FORMAT

For reading and writing structures of type QccWAVZerotree, QccPack provides the ZT file format. This file format starts with an ASCII header followed by binary data. The ASCII header consists of magic-number/revision information followed by any amount of white space (space, `\t' (tab), `\n' (newline), `\r' (carriage return)) and/or comments lines (lines starting with `#'). Following this white space, additional ASCII header information is given, separated by blanks and newlines. binary data follows this ASCII header information. Note: one (and only one) newline must immediately follow the last component of ASCII header information before the start of the binary data.

The ZT file format consists of the following information:

ZTX.X
<white space>
image_num_cols
image_num_rows
image_mean
num_levels
alphabet_size
<zerotree array>
.
.
.

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.

ROUTINES

QccWAVZerotreeInitialize() should be called before any use of a QccWAVZerotree structure. QccWAVZerotreeInitialize() initializes the fields of zerotree to the following values:

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.

RETURN VALUE

These routines return 0 on success, and 1 on failure.

SEE ALSO

QccWAVZerotreeNullSymbol(3) , QccWAVSubbandPyramid(3) , QccPackWAV(3) , QccPack(3)

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.

AUTHOR

Copyright (C) 1997-2021 James E. Fowler


Table of Contents



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