#include <haar_int.h>
Inheritance diagram for haar_int::
Public Methods | |
haar_int () | |
the constructor does nothing. More... | |
~haar_int () | |
the destructor does nothing. More... | |
haar_int (const haar_int &rhs) | |
declare but do not define the copy constructor. More... | |
Protected Methods | |
void | predict (int *&vec, int N, transDirection direction) |
Haar wavelet lifting scheme predict step. More... | |
void | update (int *&vec, int N, transDirection direction) |
Update step of the integer to integer wavelet transform. More... |
The standard wavelet transform creates real wavelet coefficients, even if the input data consists of integers. This is a problem in lossless compression (e.g., lossless image compression) and in other compression related algorithm.
This verson of the Haar wavelet transform takes an data set and creates an integer result. In the case of the Lifting Scheme version of the Haar transform, the code is the same as the real version, except that integers are used.
This algorithm is sometimes called the S-transform in the image compression world.
References
Wavelet Transforms that Map Integers to Integers by A.R. Calderbank, ingrid daubechies, wim weldens and Boon-Lock Yeo, August 1996
This is the central reference that was used to develop this code. Parts 1 and 2 of this paper are for the mathematicially sophisticated (which is to say, they are not light reading). However, for the implementer, part 3 and part 4 of this paper provide excellent coverage of perfectly invertable wavelet transforms that map integers to integers. In fact, part 3 of this paper is worth reading in general for its discussion of the wavelet Lifting Scheme.
Ripples in Mathematics: the Discrete Wavelet Transform by Arne Jense and Anders la Cour-Harbo, Springer, 2001
This book is a good reference for the Lifting Scheme and the wavelet transform in general.
Definition at line 94 of file haar_int.h.
|
the constructor does nothing.
Definition at line 98 of file haar_int.h. 00098 {} |
|
the destructor does nothing.
Definition at line 100 of file haar_int.h. 00100 {} |
|
declare but do not define the copy constructor.
|
|
Haar wavelet lifting scheme predict step. The predict step "predicts" that an odd value will be equal to the even value. The difference between the actual value of the odd element and the even element are stored in the upper half of the array. The predict step is sometime referred to as the high pass filter or the wavelet function. The integer wavelet transform predict step is the same as the standard (real) version of the lifting scheme Haar transform. Definition at line 122 of file haar_int.h. Referenced by ts_trans_int::forwardStep(), and ts_trans_int::inverseStep().
00123 { 00124 int half = N >> 1; 00125 00126 for (int i = 0; i < half; i++) { 00127 int predictVal = vec[i]; 00128 int j = i + half; 00129 00130 if (direction == forward) { 00131 vec[j] = vec[j] - predictVal; 00132 } 00133 else if (direction == inverse) { 00134 vec[j] = vec[j] + predictVal; 00135 } 00136 else { 00137 printf("haar_int::predict: bad direction value\n"); 00138 } 00139 } 00140 } // predict |
|
Update step of the integer to integer wavelet transform. In the Haar transform the update step calculates the low pass filter (or average). For a detailed discussion of this algorithm, see Basic Lifting Scheme Wavelets. Definition at line 151 of file haar_int.h. Referenced by ts_trans_int::forwardStep(), and ts_trans_int::inverseStep().
00152 { 00153 int half = N >> 1; 00154 00155 for (int i = 0; i < half; i++) { 00156 int j = i + half; 00157 // updateVal = floor( vec[j] / 2.0 ) 00158 int updateVal = vec[j] >> 1; 00159 00160 if (direction == forward) { 00161 vec[i] = vec[i] + updateVal; 00162 } 00163 else if (direction == inverse) { 00164 vec[i] = vec[i] - updateVal; 00165 } 00166 else { 00167 printf("update_int: bad direction value\n"); 00168 } 00169 } 00170 } // update |