Public Member Functions | |
void | forwardTrans (double[] vec) |
void | inverseTrans (double[] vec) |
Protected Member Functions | |
void | split (double[] vec, int N) |
void | merge (double[] vec, int N) |
abstract void | predict (double[] vec, int N, int direction) |
abstract void | update (double[] vec, int N, int direction) |
Protected Attributes | |
final int | forward = 1 |
final int | inverse = 2 |
Simple lifting scheme wavelets consist of three steps, a split/merge step, predict step and an update step:
The split step divides the elements in an array so that the even elements are in the first half and the odd elements are in the second half.
The merge step is the inverse of the split step. It takes two regions of an array, an odd region and an even region and merges them into a new region where an even element alternates with an odd element.
The predict step calculates the difference between an odd element and its predicted value based on the even elements. The difference between the predicted value and the actual value replaces the odd element.
The predict step operates on the odd elements. The update step operates on the even element, replacing them with a difference between the predict value and the actual odd element. The update step replaces each even element with an average. The result of the update step becomes the input to the next recursive step in the wavelet calculation.
The split and merge methods are shared by all Lifting Scheme wavelet algorithms. This base class provides the transform and inverse transform methods (forwardTrans and inverseTrans). The predict and update methods are abstract and are defined for a particular Lifting Scheme wavelet sub-class.
References:
You may use this source code without limitation and without fee as long as you include: <blockquote> This software was written and is copyrighted by Ian Kaplan, Bear Products International, www.bearcave.com, 2001. </blockquote>
This software is provided "as is", without any warrenty or claim as to its usefulness. Anyone who uses this source code uses it at their own risk. Nor is any support provided by Ian Kaplan and Bear Products International.
Please send any bug fixes or suggested source changes to:
iank@bearcave.com
|
Simple wavelet Lifting Scheme forward transform forwardTrans is passed an array of doubles. The array size must be a power of two. Lifting Scheme wavelet transforms are calculated in-place and the result is returned in the argument array. The result of forwardTrans is a set of wavelet coefficients ordered by increasing frequency and an approximate average of the input data set in vec[0]. The coefficient bands follow this element in powers of two (e.g., 1, 2, 4, 8...). Reimplemented in lift::haarpoly, and lift::poly. 00206 { 00207 final int N = vec.length; 00208 00209 for (int n = N; n > 1; n = n >> 1) { 00210 split( vec, n ); 00211 predict( vec, n, forward ); 00212 update( vec, n, forward ); 00213 } 00214 } // forwardTrans
|
|
Default two step Lifting Scheme inverse wavelet transform inverseTrans is passed the result of an ordered wavelet transform, consisting of an average and a set of wavelet coefficients. The inverse transform is calculated in-place and the result is returned in the argument array. Reimplemented in lift::haarpoly, and lift::poly. 00232 { 00233 final int N = vec.length; 00234 00235 for (int n = 2; n <= N; n = n << 1) { 00236 update( vec, n, inverse ); 00237 predict( vec, n, inverse ); 00238 merge( vec, n ); 00239 } 00240 } // inverseTrans
|
|
|
Predict step, to be defined by the subclass
Implemented in lift::haar, lift::line, and lift::poly. |
|
|
Update step, to be defined by the subclass
Implemented in lift::haar, lift::line, and lift::poly. |
|
"enumeration" for forward wavelet transform |
|
"enumeration" for inverse wavelet transform |