ezw Wavelet transform compression via EZW algorithm
ezw [-p] [-r NLevel] [-w WeightFac] [-t Threshold] [-m Max_Count_AC] [-d] [-R TargetRate] [-P TargetPSNR] [-s SelectArea] [-o Compress] WavTrans QWavTrans
-p : Print full set of information
-r NLevel : Quantize wavelet transform up to level NLevel (Default : number of level in WavTrans)
-w WeightFac : Scaling factor for wavelet coefficients
-t Threshold : Fix initial threshold
-m Max_Count_AC : Number of counts for histogram in arithm. coding
-d : Computes distorsion-rate function
-R TargetRate : Target bit rate
-P TargetPSNR : Target PSNR
-s SelectArea : Polygonal regions to be encoded with a different rate or PSNR (polygons)
-o Compress : Output compressed representation of WavTrans (cimage)
WavTrans : Input wavelet transform (wtrans2d)
QWavTrans : Output quantized wavelet transform (wtrans2d)
void ezw (PrintFull , NumRec , WeightFac , Thres , Max_Count_AC , DistRate , Rate , PSNR , SelectedArea , Compress , Wtrans , Output , PtrDRC )
int *PrintFull ;
int *NumRec ;
float *WeightFac ;
float *Thres ;
int *Max_Count_AC ;
int *DistRate ;
float *Rate ;
float *PSNR ;
Polygons SelectedArea ;
Cimage Compress ;
Wtrans2d Wtrans ;
Wtrans2d Output ;
char *PtrDRC ;
This module compresses the wavelet transform of an image using
Shapiro's EZW algorithm [Sha93].
It can produce both the compressed file and the quantized wavelet transform
(which can be reconstructed from the compressed file).
Description of the algorithm
This is a brief description of EZW algorithm. We refer the reader to [Sha93] for a full explanation.
The EZW algorithm is a two steps iterative algorithm. The first step is called the dominant pass, and it alternates with the second step, which is called the subordinate pass. Another important feature of the EZW algorithm is that it strongly relies on the tree structure of the wavelet transform.
During the dominant pass, one constructs a significance map by associating to each coefficient in the wavelet tree a symbol, according to its significance. More precisely, among significant coefficients, one distinguishes between coefficients which have already be found significant at a preceding dominant pass, coefficients which are newly significant and positive, and coefficients which are newly significant and negative. Among coefficients which are non-significant, one distinguishes between those which are isolated zero (which means that one of their descendents is significant), those which are zero tree root (which means that all their descendents are non-significant, and their parent is significant or isolated zero), and those which are part of a zero tree (which means that they are a descendent of a zero tree root).
To encode the changes in the significance map, one scans the wavelet tree, beginning with the root and following an order such that a parent is scanned before its children. For each coefficient, one encodes 0 if it is a zero tree root, 1 if it is an isolated zero, 2 if it is newly significant positive, 3 if it is newly significant negative, and nothing otherwise. This list of symbols (with a four-letters alphabet) is arithmetically encoded [WNC87] using a customized version of the algorithm presented in [Sha93]).
The threshold T is divided by two for the next dominant pass.
For the first dominant pass, one has to choose an initial threshold. This should be preferably smaller than the amplitude S of the biggest wavelet coefficient in the transform, and larger than S/2.
An important feature of the algorithm is that one can compute at any moment
the number of bit transmitted or encoded, as well as the error between
the original and the quantized wavelet transform. Thus one can stop
the algorithm whenever a target bit rate or SNR (error) is reached.
This is the progressive transmission capability of the EZW algorithm.
- p :
- r NLevel :
- w WeightFac :
- t Threshold :
- d :
- R TargetRate :
- P TargetPSNR :
- s SelectArea :
- o Compress :
WavTrans is a wavelet transform of an image in the Wtrans2d format.
It is the wavelet transform to be compressed.
QWavTrans is a wavelet transform of an image in the Wtrans2d format. It is the result of the quantization of WavTrans. It can be reconstructed from Compress.
Last Modification date : Thu Nov 29 20:23:57 2001