Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

haar_int.h

Go to the documentation of this file.
00001 #ifndef _HAAR_INT_H_
00002 #define _HAAR_INT_H_
00003 
00004 
00037 
00038 #include "stdio.h"
00039 #include "liftbase.h"
00040 
00041 
00093 
00094 class haar_int : public liftbase<int *, int>
00095 {
00096 public:
00098   haar_int() {}
00100   ~haar_int() {} 
00102   haar_int( const haar_int &rhs );
00103 
00104 protected:
00105 
00122   void predict( int *& vec, int N, transDirection direction )
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
00141 
00151   void update( int *& vec, int N, transDirection direction )
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
00171 
00172 }; // haar_int
00173 
00174 
00175 #endif

Generated at Tue May 27 21:56:16 2003 for Wavelet compression, determinism and time series forecasting by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001