lift::liftbase Class Reference

Inheritance diagram for lift::liftbase:

Inheritance graph
[legend]
List of all members.

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

Detailed Description

class liftbase: base class for simple Lifting Scheme wavelets using split, predict, update or update, predict, merge steps.

Simple lifting scheme wavelets consist of three steps, a split/merge step, predict step and an update step:

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:

Copyright and Use

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

Author:
Ian Kaplan


Member Function Documentation

void lift::liftbase::forwardTrans double[]  vec  )  [inline]
 

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

void lift::liftbase::inverseTrans double[]  vec  )  [inline]
 

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

void lift::liftbase::merge double[]  vec,
int  N
[inline, protected]
 

Merge the odd elements from the second half of the N element region in the array with the even elements in the first half of the N element region. The result will be the combination of the odd and even elements in a region of length N.

00149   {
00150     int half = N >> 1;
00151     int start = half-1;
00152     int end = half;
00153     
00154     while (start > 0) {
00155       for (int i = start; i < end; i = i + 2) {
00156         double tmp = vec[i];
00157         vec[i] = vec[i+1];
00158         vec[i+1] = tmp;
00159       }
00160       start = start - 1;
00161       end = end + 1;
00162     }
00163   }

abstract void lift::liftbase::predict double[]  vec,
int  N,
int  direction
[protected, pure virtual]
 

Predict step, to be defined by the subclass

Parameters:
vec input array
N size of region to act on (from 0..N-1)
direction forward or inverse transform

Implemented in lift::haar, lift::line, and lift::poly.

void lift::liftbase::split double[]  vec,
int  N
[inline, protected]
 

Split the vec into even and odd elements, where the even elements are in the first half of the vector and the odd elements are in the second half.

00124   {
00125     
00126     int start = 1;
00127     int end = N - 1;
00128 
00129     while (start < end) {
00130       for (int i = start; i < end; i = i + 2) {
00131         double tmp = vec[i];
00132         vec[i] = vec[i+1];
00133         vec[i+1] = tmp;
00134       }
00135       start = start + 1;
00136       end = end - 1;
00137     }
00138   }

abstract void lift::liftbase::update double[]  vec,
int  N,
int  direction
[protected, pure virtual]
 

Update step, to be defined by the subclass

Parameters:
vec input array
N size of region to act on (from 0..N-1)
direction forward or inverse transform

Implemented in lift::haar, lift::line, and lift::poly.


Member Data Documentation

final int lift::liftbase::forward = 1 [protected]
 

"enumeration" for forward wavelet transform

final int lift::liftbase::inverse = 2 [protected]
 

"enumeration" for inverse wavelet transform


The documentation for this class was generated from the following file:
Generated on Sun Dec 11 20:01:10 2005 for LiftingScheme by  doxygen 1.4.5