Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
wavelib.h
00001 #ifndef WAVELIB_H_ 00002 #define WAVELIB_H_ 00003 00004 #ifdef __cplusplus 00005 extern "C" { 00006 #endif 00007 00008 #if defined(_MSC_VER) 00009 #pragma warning(disable : 4200) 00010 #pragma warning(disable : 4996) 00011 #endif 00012 00013 #ifndef fft_type 00014 #define fft_type double 00015 #endif 00016 00017 #ifndef cplx_type 00018 #define cplx_type double 00019 #endif 00020 00021 00022 typedef struct cplx_t { 00023 cplx_type re; 00024 cplx_type im; 00025 } cplx_data; 00026 00027 typedef struct wave_set* wave_object; 00028 00029 wave_object wave_init(char* wname); 00030 00031 struct wave_set{ 00032 char wname[50]; 00033 int filtlength;// When all filters are of the same length. [Matlab uses zero-padding to make all filters of the same length] 00034 int lpd_len;// Default filtlength = lpd_len = lpr_len = hpd_len = hpr_len 00035 int hpd_len; 00036 int lpr_len; 00037 int hpr_len; 00038 double *lpd; 00039 double *hpd; 00040 double *lpr; 00041 double *hpr; 00042 double params[0]; 00043 }; 00044 00045 typedef struct fft_t { 00046 fft_type re; 00047 fft_type im; 00048 } fft_data; 00049 00050 typedef struct fft_set* fft_object; 00051 00052 fft_object fft_init(int N, int sgn); 00053 00054 struct fft_set{ 00055 int N; 00056 int sgn; 00057 int factors[64]; 00058 int lf; 00059 int lt; 00060 fft_data twiddle[1]; 00061 }; 00062 00063 typedef struct fft_real_set* fft_real_object; 00064 00065 fft_real_object fft_real_init(int N, int sgn); 00066 00067 struct fft_real_set{ 00068 fft_object cobj; 00069 fft_data twiddle2[1]; 00070 }; 00071 00072 typedef struct conv_set* conv_object; 00073 00074 conv_object conv_init(int N, int L); 00075 00076 struct conv_set{ 00077 fft_real_object fobj; 00078 fft_real_object iobj; 00079 int ilen1; 00080 int ilen2; 00081 int clen; 00082 }; 00083 00084 typedef struct wt_set* wt_object; 00085 00086 wt_object wt_init(wave_object wave,char* method, int siglength, int J); 00087 00088 struct wt_set{ 00089 wave_object wave; 00090 conv_object cobj; 00091 char method[10]; 00092 int siglength;// Length of the original signal. 00093 int outlength;// Length of the output DWT vector 00094 int lenlength;// Length of the Output Dimension Vector "length" 00095 int J; // Number of decomposition Levels 00096 int MaxIter;// Maximum Iterations J <= MaxIter 00097 int even;// even = 1 if signal is of even length. even = 0 otherwise 00098 char ext[10];// Type of Extension used - "per" or "sym" 00099 char cmethod[10]; // Convolution Method - "direct" or "FFT" 00100 00101 int N; // 00102 int cfftset; 00103 int zpad; 00104 int length[102]; 00105 double *output; 00106 double params[0]; 00107 }; 00108 00109 typedef struct wtree_set* wtree_object; 00110 00111 wtree_object wtree_init(wave_object wave, int siglength, int J); 00112 00113 struct wtree_set{ 00114 wave_object wave; 00115 conv_object cobj; 00116 char method[10]; 00117 int siglength;// Length of the original signal. 00118 int outlength;// Length of the output DWT vector 00119 int lenlength;// Length of the Output Dimension Vector "length" 00120 int J; // Number of decomposition Levels 00121 int MaxIter;// Maximum Iterations J <= MaxIter 00122 int even;// even = 1 if signal is of even length. even = 0 otherwise 00123 char ext[10];// Type of Extension used - "per" or "sym" 00124 00125 int N; // 00126 int nodes; 00127 int cfftset; 00128 int zpad; 00129 int length[102]; 00130 double *output; 00131 int *nodelength; 00132 int *coeflength; 00133 double params[0]; 00134 }; 00135 00136 typedef struct wpt_set* wpt_object; 00137 00138 wpt_object wpt_init(wave_object wave, int siglength, int J); 00139 00140 struct wpt_set{ 00141 wave_object wave; 00142 conv_object cobj; 00143 int siglength;// Length of the original signal. 00144 int outlength;// Length of the output DWT vector 00145 int lenlength;// Length of the Output Dimension Vector "length" 00146 int J; // Number of decomposition Levels 00147 int MaxIter;// Maximum Iterations J <= MaxIter 00148 int even;// even = 1 if signal is of even length. even = 0 otherwise 00149 char ext[10];// Type of Extension used - "per" or "sym" 00150 char entropy[20]; 00151 double eparam; 00152 00153 int N; // 00154 int nodes; 00155 int length[102]; 00156 double *output; 00157 double *costvalues; 00158 double *basisvector; 00159 int *nodeindex; 00160 int *numnodeslevel; 00161 int *coeflength; 00162 double params[0]; 00163 }; 00164 00165 00166 typedef struct cwt_set* cwt_object; 00167 00168 cwt_object cwt_init(char* wave, double param, int siglength,double dt, int J); 00169 00170 struct cwt_set{ 00171 char wave[10];// Wavelet - morl/morlet,paul,dog/dgauss 00172 int siglength;// Length of Input Data 00173 int J;// Total Number of Scales 00174 double s0;// Smallest scale. It depends on the sampling rate. s0 <= 2 * dt for most wavelets 00175 double dt;// Sampling Rate 00176 double dj;// Separation between scales. eg., scale = s0 * 2 ^ ( [0:N-1] *dj ) or scale = s0 *[0:N-1] * dj 00177 char type[10];// Scale Type - Power or Linear 00178 int pow;// Base of Power in case type = pow. Typical value is pow = 2 00179 int sflag; 00180 int pflag; 00181 int npad; 00182 int mother; 00183 double m;// Wavelet parameter param 00184 double smean;// Input Signal mean 00185 00186 cplx_data *output; 00187 double *scale; 00188 double *period; 00189 double *coi; 00190 double params[0]; 00191 }; 00192 00193 00194 void dwt(wt_object wt, double *inp); 00195 00196 void idwt(wt_object wt, double *dwtop); 00197 00198 void wtree(wtree_object wt, double *inp); 00199 00200 void dwpt(wpt_object wt, double *inp); 00201 00202 void idwpt(wpt_object wt, double *dwtop); 00203 00204 void swt(wt_object wt, double *inp); 00205 00206 void iswt(wt_object wt, double *swtop); 00207 00208 void modwt(wt_object wt, double *inp); 00209 00210 void imodwt(wt_object wt, double *dwtop); 00211 00212 void setDWTExtension(wt_object wt, char *extension); 00213 00214 void setWTREEExtension(wtree_object wt, char *extension); 00215 00216 void setDWPTExtension(wpt_object wt, char *extension); 00217 00218 void setDWPTEntropy(wpt_object wt, char *entropy, double eparam); 00219 00220 void setWTConv(wt_object wt, char *cmethod); 00221 00222 int getWTREENodelength(wtree_object wt, int X); 00223 00224 void getWTREECoeffs(wtree_object wt, int X, int Y, double *coeffs, int N); 00225 00226 int getDWPTNodelength(wpt_object wt, int X); 00227 00228 void getDWPTCoeffs(wpt_object wt, int X, int Y, double *coeffs, int N); 00229 00230 void setCWTScales(cwt_object wt, double s0, double dj, char *type, int power); 00231 00232 void setCWTScaleVector(cwt_object wt, double *scale, int J, double s0, double dj); 00233 00234 void setCWTPadding(cwt_object wt, int pad); 00235 00236 void cwt(cwt_object wt, double *inp); 00237 00238 void icwt(cwt_object wt, double *cwtop); 00239 00240 int getCWTScaleLength(int N); 00241 00242 void wave_summary(wave_object obj); 00243 00244 void wt_summary(wt_object wt); 00245 00246 void wtree_summary(wtree_object wt); 00247 00248 void wpt_summary(wpt_object wt); 00249 00250 void cwt_summary(cwt_object wt);; 00251 00252 void wave_free(wave_object object); 00253 00254 void wt_free(wt_object object); 00255 00256 void wtree_free(wtree_object object); 00257 00258 void wpt_free(wpt_object object); 00259 00260 void cwt_free(cwt_object object); 00261 00262 00263 #ifdef __cplusplus 00264 } 00265 #endif 00266 00267 00268 #endif /* WAVELIB_H_ */
Generated on Tue Jul 12 2022 13:02:50 by
1.7.2