#include <haar_classicFreq.h>
Inheritance diagram for haar_classicFreq::
Public Methods | |
void | forwardStepRev (T &vec, const int n) |
One forward step of the reverse Haar classic transform, where the results for the high and low pass filters are reversed. More... | |
void | inverseStepRev (T &vec, const int n) |
One inverse step of the reverse Haar classic transform, where the results for the high and low pass filters are reversed. More... | |
Protected Methods | |
void | predictRev (T &vec, int N, transDirection direction) |
In the standard wavelet transform, the high pass filter is applied to the upper half of the array (this is the predict phase, in lifting scheme terminology). More... | |
void | updateRev (T &vec, int N, transDirection direction) |
Reverse low pass filter. More... |
An extension of the "Haar classic" algorithm for frequency analysis.
The haar_classicFreq template extends the haar_classic templace. The haar_classic template implements what I call the "Haar classic" algorithm. Here the high pass filter (wavelet) is
b'i = (ai - bi)/2
where ai is an even element and bi is it odd element neighbor (of course using a lifting scheme style implementation, the even elements are moved to the first half of the array and the odd elements are moved to the second half.
In the Haar classic algorithm the high pass result is placed in the upper half of the array. In the haar_classicFreq version the result is placed in the lower half of the array and the equation becomes
a'i = (ai - bi)/2
The "Haar classic" low pass filter (smoothing function) is
a'i = (ai + bi)/2
In the Haar classic algorithm the low pass filter result is placed in the lower half of the array. In the haar_classicFreq version the result is placed in the upper half of the array and the equation becomes
b'i = (ai + bi)/2
The calculation of the high pass filter is done first and overwrites the even elements (e.g., a'i). To recover the ai values given a'i and bi:
a'i = (ai - bi)/2 2 * a'i = ai - bi ai = 2 * a'i + bi
Substituting this into the equation for calculating b'i we get:
These equations differ from the Haar classic forward transform equations.
Definition at line 79 of file haar_classicFreq.h.
One forward step of the reverse Haar classic transform, where the results for the high and low pass filters are reversed.
Reimplemented from liftbase.
Definition at line 154 of file haar_classicFreq.h.
One inverse step of the reverse Haar classic transform, where the results for the high and low pass filters are reversed.
Reimplemented from liftbase.
Definition at line 167 of file haar_classicFreq.h.
In the standard wavelet transform, the high pass filter is applied to the upper half of the array (this is the predict phase, in lifting scheme terminology).
In the reverse transform step, which is used for wavelet frequency analysis, the high pass filter is applied to the lower half of the array.
Reimplemented from liftbase.
Definition at line 92 of file haar_classicFreq.h.
Reverse low pass filter.
In the standard wavelet transform the low pass filter is applied to the data set (consisting of N elements) and the result is placed in the lower half of the array (the lower N/2 elements).
In the reverse transform step, which is used for wavelet frequency analysis, the result of the low pass filter is placed in the upper half of the array (the upper N/2 elements).
Reimplemented from liftbase.
Definition at line 127 of file haar_classicFreq.h.
b'i = ((2 * a'i + bi) + bi)/2
b'i = (2 * a'i + 2 * bi)/2
b'i = a'i + bi
Member Function Documentation
template<class T>
void haar_classicFreq<T>::forwardStepRev (
T & vec,
const int n )
[inline, virtual]
00155 {
00156 split( vec, n );
00157 predictRev( vec, n, forward );
00158 updateRev( vec, n, forward );
00159 }
template<class T>
void haar_classicFreq<T>::inverseStepRev (
T & vec,
const int n )
[inline, virtual]
00168 {
00169 updateRev( vec, n, inverse );
00170 predictRev( vec, n, inverse );
00171 merge( vec, n );
00172 }
template<class T>
void haar_classicFreq<T>::predictRev (
T & vec,
int N,
transDirection direction )
[inline, protected, virtual]
00093 {
00094 int half = N >> 1;
00095 int cnt = 0;
00096
00097 for (int i = 0; i < half; i++) {
00098 int j = i + half;
00099
00100 if (direction == forward) {
00101 vec[i] = (vec[i] - vec[j] )/2;
00102 }
00103 else if (direction == inverse) {
00104 vec[i] = (2 * vec[i]) + vec[j];
00105 }
00106 else {
00107 printf("predictRev: bad direction value\n");
00108 }
00109 }
00110 } // predictRev
template<class T>
void haar_classicFreq<T>::updateRev (
T & vec,
int N,
transDirection direction )
[inline, protected, virtual]
00128 {
00129 int half = N >> 1;
00130
00131 for (int i = 0; i < half; i++) {
00132 int j = i + half;
00133
00134 if (direction == forward) {
00135 vec[j] = vec[j] + vec[i];
00136 }
00137 else if (direction == inverse) {
00138 vec[j] = vec[j] - vec[i];
00139 }
00140 else {
00141 printf("updateRev: bad direction value\n");
00142 }
00143 }
00144 } // updateRev
The documentation for this class was generated from the following file:
Generated at Sat Aug 10 13:23:37 2002 for Wavelet Packet Transform and Lossless Compression by
1.2.8.1 written by Dimitri van Heesch,
© 1997-2001