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 }
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
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 }
00171
00172 };
00173
00174
00175 #endif