|
Wavelet and Image class library
1.3.2
|
00001 /*---------------------------------------------------------------------------*/ 00002 // Baseline Wavelet Transform Coder Construction Kit 00003 // 00004 // Geoff Davis 00005 // gdavis@cs.dartmouth.edu 00006 // http://www.cs.dartmouth.edu/~gdavis 00007 // 00008 // Copyright 1996 Geoff Davis 9/11/96 00009 // 00010 // Permission is granted to use this software for research purposes as 00011 // long as this notice stays attached to this software. 00012 // 00013 /*---------------------------------------------------------------------------*/ 00025 #ifndef FILTER_HH__ 00026 #define FILTER_HH__ 00027 00032 #include "WImage/miscdefs.h" 00033 00034 #ifndef NULL 00035 #define NULL 0 00036 #endif 00037 00038 /*---------------------------------------------------------------------------*/ 00039 00040 class FilterSet; 00041 00042 class Filter 00043 { 00044 friend class FilterSet; 00045 00046 public: 00047 Filter (void) { m_coeffs = NULL; m_size = 0; m_firstIndex = 0; } 00048 Filter (int m_size, int firstIndex = 0, coeff *coeffs = NULL) 00049 { init (m_size, firstIndex, coeffs); } 00050 Filter (const Filter &filter) { m_coeffs = NULL; copy (filter); } 00051 ~Filter (void); 00052 00053 void init (int m_size, int filterFirst, coeff *coeffs); 00054 void dump (void); 00055 inline coeff at (int index) { return m_coeffs[index]; } 00056 inline int fsize (void) { return m_size; } 00057 inline int first (void) { return m_firstIndex; } 00058 00059 protected: 00060 int m_size; 00061 int m_firstIndex; 00062 void copy (const Filter &filter); 00063 coeff *m_coeffs; 00064 inline void tof (int index, coeff value) 00065 { m_coeffs[index-m_firstIndex] = value; } 00066 inline coeff atf (int index) { return m_coeffs[index-m_firstIndex]; } 00067 00068 }; 00069 00070 /*---------------------------------------------------------------------------*/ 00071 00079 class FilterSet 00080 { 00081 public: 00082 FilterSet (void) { m_symmetric = 0; m_analysisLow = m_analysisHigh = 00083 m_synthesisLow = m_synthesisHigh = NULL; } 00084 FilterSet (bool symmetric, 00085 coeff *anLow, int anLowSize, int anLowFirst, 00086 coeff *synLow = NULL, int synLowSize = 0, int 00087 synLowFirst = 0); 00088 FilterSet (const FilterSet &filterset); 00089 ~FilterSet (void); 00090 00091 inline Filter &alow (void) { return *m_analysisLow; } 00092 inline Filter &ahigh (void) { return *m_analysisHigh; } 00093 inline Filter &slow (void) { return *m_synthesisLow; } 00094 inline Filter &shigh (void) { return *m_synthesisHigh; } 00095 inline bool issym (void) { return m_symmetric; } 00096 00097 void dump (void); 00098 void init (bool symmetric, 00099 coeff *anLow, int anLowSize, int anLowFirst, 00100 coeff *synLow, int synLowSize, int synLowFirst); 00101 00108 static FilterSet &filterFromString (char *str); 00109 static const char *filterToString (FilterSet &filter); 00110 00111 protected: 00112 bool m_symmetric; 00113 Filter *m_analysisLow; 00114 Filter *m_analysisHigh; 00115 Filter *m_synthesisLow; 00116 Filter *m_synthesisHigh; 00117 void copy (const FilterSet& filterset); 00118 }; 00119 00120 /*---------------------------------------------------------------------------*/ 00121 00122 extern FilterSet Haar, Daub4, Daub6, Daub8, Antonini, 00123 Brislawn, Villa1, Villa2, Villa3, Villa4, Villa5, Villa6, 00124 Odegard; 00125 /* Adelson, Brislawn2, don't produce sufficient precision */ 00126 /*---------------------------------------------------------------------------*/ 00128 #endif 00129 /*---------------------------------------------------------------------------*/ 00130 00131
1.7.6.1