1 // Copyright (C) 2012 - 2014 - Michael Baudin 2 // Copyright (C) 2011 - DIGITEO - Michael Baudin 3 // Copyright (C) 2008 - INRIA 4 // Copyright (C) 2012 - Prateek Papriwal 5 // 6 // This file must be used under the terms of the GNU Lesser General Public License license : 7 // http://www.gnu.org/copyleft/lesser.html 8 9 #ifndef _SWTLIB_H_ 10 #define _SWTLIB_H_ 11 12 #ifdef _MSC_VER 13 #if LIBSWTLIB_EXPORTS 14 #define SWTLIB_IMPORTEXPORT __declspec (dllexport) 15 #else 16 #define SWTLIB_IMPORTEXPORT __declspec (dllimport) 17 #endif 18 #else 19 #define SWTLIB_IMPORTEXPORT 20 #endif 21 22 #undef __BEGIN_DECLS 23 #undef __END_DECLS 24 #ifdef __cplusplus 25 # define __BEGIN_DECLS "C" { 26 # define __END_DECLS } 27 #else 28 # define __BEGIN_DECLS /* empty */ 29 # define __END_DECLS /* empty */ 30 #endif 31 32 __BEGIN_DECLS 33 34 #include <stdio.h> 35 #include <stdlib.h> 36 #include <stdarg.h> 37 #include <math.h> 38 /********************************************* 39 * Macro 40 ********************************************/ 41 42 #define SUCCESS 0 43 #define DIM_ERR_ONE 1 44 #define DIM_ERR_VEC 2 45 #define DIM_ERR_MAT 3 46 47 48 #define POSITIVE_INTEGER_ONLY 1 49 #define LENGTH_DATA_NOT_VALID_FOR_VECTOR_DIMENSION 2 50 #define SIZE_DATA_NOT_VALID_FOR_MATRIX_DIMENSION 3 51 #define OPT_CHAR_NOT_VALID 4 52 #define EXTENSION_OPT_NOT_VALID 5 53 #define WAVELET_NAME_NOT_VALID 6 54 #define DECOMPOSITION_LEVEL_NOT_VALID 7 55 #define MULTI_DECOM_LEVEL_LESS_THAN_TWO 8 56 #define WRONG_LHS 9 57 #define UNKNOWN_INPUT_ERR 20 58 59 #define PI 3.1415926535897931159980 60 61 /********************************************* 62 * Macros CWT 63 ********************************************/ 64 65 #define REAL 0 66 #define COMPLEX 1 67 68 #define PHI_ONLY 0 69 #define PSI_ONLY 1 70 #define PHI_PSI_BOTH 2 71 72 #define SINUS 0 73 #define POISSON 1 74 #define MEXICAN_HAT 2 75 #define MORLET 3 76 #define DOGAUSS 4 77 #define CMORLET 5 78 #define SHANNON 6 79 #define FBSP 7 80 #define CAUCHY 8 81 #define GAUSS 9 82 #define CGAUSS 10 83 84 85 /********************************************* 86 * Extension Type 87 ********************************************/ 88 89 typedef enum { 90 ZPD, SYMH, SYMW, ASYMH, ASYMW, 91 SP0, SP1, PPD, PER} extend_method; 92 93 /********************************************* 94 * Structure Declarations 95 ********************************************/ 96 // #ifndef __USE_DEPRECATED_STACK_FUNCTIONS__ 97 // typedef struct sciintmat { 98 // int m,n; 99 // int it ; 100 // int l; 101 // void *D; 102 // } SciIntMat ; 103 // #endif 104 105 typedef struct { 106 int sigInLength; 107 int sigOutLength; 108 double *sigIn; 109 double *sigOut; 110 void (*func)(int sigInLength, int sigOutLenght, 111 double *sigIn, double *sigOut); 112 struct sio *link; 113 } swt_sio; 114 115 typedef struct { 116 char extMethodName[6]; 117 extend_method extMethod; 118 } extension_identity; 119 120 121 typedef struct { 122 int errorNumber; 123 char message[150]; 124 } str_error_notification; 125 126 127 128 129 /********************************************* 130 * Structures CWT 131 ********************************************/ 132 133 typedef void(*WScaleFunc)(double *x, int sigInLength, double *psi, int sigOutLength, double ys); 134 135 136 typedef struct { 137 char wname[20]; 138 int realOrComplex; 139 int family; 140 int phipsi; 141 double lb; 142 double ub; 143 double cpsi; 144 WScaleFunc scalef; 145 } cwt_identity; 146 147 typedef struct { 148 char wname[20]; 149 char realOrComplex[20]; 150 char family[20]; 151 } cwt_family; 152 153 154 /********************************************* 155 * Macros DWT 156 ********************************************/ 157 158 #define HAAR 0 159 #define DAUBECHIES 1 160 #define COIFLETS 2 161 #define SYMLETS 3 162 #define SPLINE_BIORTH 4 163 #define BEYLKIN 5 164 #define VAIDYANATHAN 6 165 #define DMEY 7 166 #define BATHLETS 8 167 #define LEGENDRE 9 168 #define SPLINE_RBIORTH 10 169 #define FARRAS 11 170 #define KINGSBURYQ 12 171 #define NOT_DEFINED 99 172 173 #define ORTH 0 174 #define BIORTH 1 175 176 177 /********************************************* 178 * Wavelet Structure Declarations 179 ********************************************/ 180 181 typedef struct { 182 int length; 183 double *pLowPass; 184 double *pHiPass; 185 } swt_wavelet; 186 187 typedef void(*Func)(int member, swt_wavelet *pWaveStruct); 188 189 typedef struct { 190 char wname[20]; 191 int rOrB; 192 int family; 193 int member; 194 Func analysis; 195 Func synthesis; 196 } wavelet_identity; 197 198 typedef struct { 199 char wname[20]; 200 char rOrB[20]; 201 char family[20]; 202 } wavelet_family; 203 204 205 /********************************************* 206 * Global Variable Declaration 207 ********************************************/ 208 209 // double LowDecomFilCoef[80]; 210 // double LowReconFilCoef[80]; 211 // double HiDecomFilCoef[80]; 212 // double HiReconFilCoef[80]; 213 214 /********************************************* 215 * swt Variable Declaration 216 ********************************************/ 217 218 219 void sinus(double *x, int sigInLength, double *psi, int sigOutLength, double ys); 220 221 void poisson(double *x, int sigInLength, double *psi, int sigOutLength, double ys); 222 void mexihat(double *x, int sigInLength, double *psi, int sigOutLength, double ys); 223 224 225 void morlet(double *x, int sigInLength, double *psi, int sigOutLength, double ys); 226 227 void DOGauss(double *x, int sigInLength, double *psi, int sigOutLength, double ys); 228 229 void Gauss(double *x, int sigInLength, double *psi, int sigOutLength, int n, double ys); 230 void Gaus1(double *x, int sigInLength, double *psi, int sigOutLength, double ys); 231 void Gaus2(double *x, int sigInLength, double *psi, int sigOutLength, double ys); 232 void Gaus3(double *x, int sigInLength, double *psi, int sigOutLength, double ys); 233 void Gaus4(double *x, int sigInLength, double *psi, int sigOutLength, double ys); 234 void Gaus5(double *x, int sigInLength, double *psi, int sigOutLength, double ys); 235 void Gaus6(double *x, int sigInLength, double *psi, int sigOutLength, double ys); 236 void Gaus7(double *x, int sigInLength, double *psi, int sigOutLength, double ys); 237 void Gaus8(double *x, int sigInLength, double *psi, int sigOutLength, double ys); 238 239 void cgauss(double *x, int sigInLength, int p, double *psir, double *psii, int sigOutLength, double ys); 240 void cgau1(double *x, int sigInLength, double *psir, double *psii, int sigOutLength, double ys); 241 void cgau1_packet(double *x, int sigInLength, double *f, int sigOutLength, double ys); 242 void cgau2(double *x, int sigInLength, double *psir, double *psii, int sigOutLength, double ys); 243 void cgau2_packet(double *x, int sigInLength, double *f, int sigOutLength, double ys); 244 void cgau3(double *x, int sigInLength, double *psir, double *psii, int sigOutLength, double ys); 245 void cgau3_packet(double *x, int sigInLength, double *f, int sigOutLength, double ys); 246 void cgau4(double *x, int sigInLength, double *psir, double *psii, int sigOutLength, double ys); 247 void cgau4_packet(double *x, int sigInLength, double *f, int sigOutLength, double ys); 248 249 void cgau5(double *x, int sigInLength, double *psir, double *psii, int sigOutLength, double ys); 250 void cgau5_packet(double *x, int sigInLength, double *f, int sigOutLength, double ys); 251 void cgau6(double *x, int sigInLength, double *psir, double *psii, int sigOutLength, double ys); 252 void cgau6_packet(double *x, int sigInLength, double *f, int sigOutLength, double ys); 253 void cgau7(double *x, int sigInLength, double *psir, double *psii, int sigOutLength, double ys); 254 void cgau7_packet(double *x, int sigInLength, double *f, int sigOutLength, double ys); 255 void cgau8(double *x, int sigInLength, double *psir, double *psii, int sigOutLength, double ys); 256 void cgau8_packet(double *x, int sigInLength, double *f, int sigOutLength, double ys); 257 258 259 void cmorlet(double *x, int sigInLength, 260 double fb, double fc, double *psir, double *psii, 261 int sigOutLength, double ys); 262 void cmorlet_packet(double *x, int sigInLength, 263 double *f, int sigOutLength, double ys); 264 265 void shanwavf(double *x, int sigInLength, 266 double fb, double fc, double *psir, double *psii, 267 int sigOutLength, double ys); 268 void shanwavf_packet(double *x, int sigInLength, 269 double *f, int sigOutLength, double ys); 270 void fbspwavf(double *x, int sigInLength,int m, 271 double fb, double fc, double *psir, double *psii, 272 int sigOutLength, double ys); 273 void fbspwavf_packet(double *x, int sigInLength, 274 double *f, int sigOutLength, double ys); 275 276 void cauchy(double *x, int sigInLength, 277 double fb, double fc, double *psir, double *psii, 278 int sigOutLength, double ys); 279 void cauchy_neo(double *x, int sigInLength, double *psir, double *psii, int sigOutLength, double ys); 280 void cauchy_packet(double *x, int sigInLength, 281 double *f, int sigOutLength, double ys); 282 283 284 void meyeraux(double x, double *y); 285 void meyer_phi(double *x, int sigInLength, double lb, double ub, double *phir, double *phii, int sigOutLength, double ys); 286 287 static cwt_identity ci[] = { 288 {"sinus", REAL, SINUS, PSI_ONLY, -0.5, 0.5, 1, sinus}, 289 {"poisson", REAL, POISSON, PSI_ONLY,-10, 10, 1, poisson}, 290 {"mexh", REAL, MEXICAN_HAT,PSI_ONLY, -5, 5, 1.0, mexihat}, 291 {"morl",REAL, MORLET, PSI_ONLY, -4, 4, 1.0, morlet}, 292 {"DOG", REAL, DOGAUSS, PSI_ONLY, -5, 5, 0.6455109, DOGauss}, 293 {"gaus1", REAL, GAUSS, PSI_ONLY, -5, 5, 1, Gaus1}, 294 {"gaus2", REAL, GAUSS, PSI_ONLY, -5, 5, 1, Gaus2}, 295 {"gaus3", REAL, GAUSS, PSI_ONLY, -5, 5, 1, Gaus3}, 296 {"gaus4", REAL, GAUSS, PSI_ONLY, -5, 5, 1, Gaus4}, 297 {"gaus5", REAL, GAUSS, PSI_ONLY, -5, 5, 1, Gaus5}, 298 {"gaus6", REAL, GAUSS, PSI_ONLY, -5, 5, 1, Gaus6}, 299 {"gaus7", REAL, GAUSS, PSI_ONLY, -5, 5, 1, Gaus7}, 300 {"gaus8", REAL, GAUSS, PSI_ONLY, -5, 5, 1, Gaus8}, 301 {"cmor",COMPLEX, CMORLET, PSI_ONLY, -8, 8, 1, cmorlet_packet}, 302 {"shan", COMPLEX, SHANNON, PSI_ONLY, -20, 20, 1, shanwavf_packet}, 303 {"fbsp", COMPLEX, FBSP, PSI_ONLY, -20, 20, 1, fbspwavf_packet}, 304 {"cauchy", COMPLEX, CAUCHY, PSI_ONLY, -5, 5, 1, cauchy_packet}, 305 {"cgau1", COMPLEX, CGAUSS, PSI_ONLY, -5, 5, 1, cgau1_packet}, 306 {"cgau2", COMPLEX, CGAUSS, PSI_ONLY, -5, 5, 1, cgau2_packet}, 307 {"cgau3", COMPLEX, CGAUSS, PSI_ONLY, -5, 5, 1, cgau3_packet}, 308 {"cgau4", COMPLEX, CGAUSS, PSI_ONLY, -5, 5, 1, cgau4_packet}, 309 {"cgau5", COMPLEX, CGAUSS, PSI_ONLY, -5, 5, 1, cgau5_packet}, 310 {"cgau6", COMPLEX, CGAUSS, PSI_ONLY, -5, 5, 1, cgau6_packet}, 311 {"cgau7", COMPLEX, CGAUSS, PSI_ONLY, -5, 5, 1, cgau7_packet}, 312 {"cgau8", COMPLEX, CGAUSS, PSI_ONLY, -5, 5, 1, cgau8_packet} 313 }; 314 static int cwtIdentityNum = sizeof(ci)/sizeof(cwt_identity); 315 316 static cwt_family cif[] = { 317 {"sinus", "REAL", "SINUS"}, 318 {"poisson", "REAL", "POISSON"}, 319 {"mexh", "REAL", "MEXICAN_HAT"}, 320 {"morl","REAL", "MORLET"}, 321 {"DOG", "REAL", "DOGAUSS"}, 322 {"cmor","COMPLEX", "CMORLET"}, 323 {"shan", "COMPLEX", "SHANNON"}, 324 {"fbsp", "COMPLEX", "FBSP"}, 325 {"cauchy", "COMPLEX", "CAUCHY"}, 326 {"gaus", "REAL", "GAUSS"}, 327 {"cgau", "COMPLEX", "CGAUSS"} 328 }; 329 static int cwtFamilyNum = sizeof(cif)/sizeof(cwt_family); 330 331 #define ISODD(x) ((x/2.0)== ((int)(x/2)) ? 0 : 1) 332 333 /********************************************* 334 * Function Prototype 335 ********************************************/ 336 337 void haar_analysis_initialize (int member, swt_wavelet *pWaveStruct); 338 void haar_synthesis_initialize (int member, swt_wavelet *pWaveStruct); 339 void daubechies_analysis_initialize (int memeber, swt_wavelet *pWaveStruct); 340 void daubechies_synthesis_initialize (int memeber, swt_wavelet *pWaveStruct); 341 void symlets_analysis_initialize (int member, swt_wavelet *pWaveStruct); 342 void symlets_synthesis_initialize (int member, swt_wavelet *pWaveStruct); 343 void coiflets_analysis_initialize (int member, swt_wavelet *pWaveStruct); 344 void coiflets_synthesis_initialize (int member, swt_wavelet *pWaveStruct); 345 void sp_bior_analysis_initialize (int member, swt_wavelet *pWaveStruct); 346 void sp_bior_synthesis_initialize (int member, swt_wavelet *pWaveStruct); 347 void sp_rbior_analysis_initialize (int member, swt_wavelet *pWaveStruct); 348 void sp_rbior_synthesis_initialize (int member, swt_wavelet *pWaveStruct); 349 void beylkin_analysis_initialize (int member, swt_wavelet *pWaveStruct); 350 void beylkin_synthesis_initialize (int member, swt_wavelet *pWaveStruct); 351 void vaidyanathan_analysis_initialize (int member, swt_wavelet *pWaveStruct); 352 void vaidyanathan_synthesis_initialize (int member, swt_wavelet *pWaveStruct); 353 void dmey_analysis_initialize (int member, swt_wavelet *pWaveStruct); 354 void dmey_synthesis_initialize (int member, swt_wavelet *pWaveStruct); 355 void bathlets_analysis_initialize (int member, swt_wavelet *pWaveStruct); 356 void bathlets_synthesis_initialize (int member, swt_wavelet *pWaveStruct); 357 void legendre_analysis_initialize (int member, swt_wavelet *pWaveStruct); 358 void legendre_synthesis_initialize (int member, swt_wavelet *pWaveStruct); 359 void farras_analysis_initialize (int member, swt_wavelet *pWaveStruct); 360 void farras_synthesis_initialize (int member, swt_wavelet *pWaveStruct); 361 void kingsburyq_analysis_initialize (int member, swt_wavelet *pWaveStruct); 362 void kingsburyq_synthesis_initialize (int member, swt_wavelet *pWaveStruct); 363 364 static wavelet_identity wi[] = { 365 {"haar",ORTH, HAAR, 0, haar_analysis_initialize , haar_synthesis_initialize}, 366 {"db1", ORTH, DAUBECHIES, 1, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 367 {"db2", ORTH, DAUBECHIES, 2, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 368 {"db3", ORTH, DAUBECHIES, 3, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 369 {"db4", ORTH, DAUBECHIES, 4, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 370 {"db5", ORTH, DAUBECHIES, 5, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 371 {"db6", ORTH, DAUBECHIES, 6, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 372 {"db7", ORTH, DAUBECHIES, 7, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 373 {"db8", ORTH, DAUBECHIES, 8, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 374 {"db9", ORTH, DAUBECHIES, 9, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 375 {"db10", ORTH, DAUBECHIES, 10, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 376 {"db11", ORTH, DAUBECHIES, 11, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 377 {"db12", ORTH, DAUBECHIES, 12, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 378 {"db13", ORTH, DAUBECHIES, 13, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 379 {"db14", ORTH, DAUBECHIES, 14, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 380 {"db15", ORTH, DAUBECHIES, 15, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 381 {"db16", ORTH, DAUBECHIES, 16, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 382 {"db17", ORTH, DAUBECHIES, 17, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 383 {"db18", ORTH, DAUBECHIES, 18, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 384 {"db19", ORTH, DAUBECHIES, 19, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 385 {"db20", ORTH, DAUBECHIES, 20, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 386 {"db21", ORTH, DAUBECHIES, 21, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 387 {"db22", ORTH, DAUBECHIES, 22, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 388 {"db23", ORTH, DAUBECHIES, 23, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 389 {"db24", ORTH, DAUBECHIES, 24, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 390 {"db25", ORTH, DAUBECHIES, 25, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 391 {"db26", ORTH, DAUBECHIES, 26, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 392 {"db27", ORTH, DAUBECHIES, 27, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 393 {"db28", ORTH, DAUBECHIES, 28, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 394 {"db29", ORTH, DAUBECHIES, 29, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 395 {"db30", ORTH, DAUBECHIES, 30, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 396 {"db31", ORTH, DAUBECHIES, 31, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 397 {"db32", ORTH, DAUBECHIES, 32, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 398 {"db33", ORTH, DAUBECHIES, 33, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 399 {"db34", ORTH, DAUBECHIES, 34, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 400 {"db35", ORTH, DAUBECHIES, 35, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 401 {"db36", ORTH, DAUBECHIES, 36, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 402 {"db37", ORTH, DAUBECHIES, 37, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 403 {"db38", ORTH, DAUBECHIES, 38, daubechies_analysis_initialize, daubechies_synthesis_initialize}, 404 {"coif1", ORTH, COIFLETS, 1, coiflets_analysis_initialize, coiflets_synthesis_initialize}, 405 {"coif2", ORTH, COIFLETS, 2, coiflets_analysis_initialize, coiflets_synthesis_initialize}, 406 {"coif3", ORTH, COIFLETS, 3, coiflets_analysis_initialize, coiflets_synthesis_initialize}, 407 {"coif4", ORTH, COIFLETS, 4, coiflets_analysis_initialize, coiflets_synthesis_initialize}, 408 {"coif5", ORTH, COIFLETS, 5, coiflets_analysis_initialize, coiflets_synthesis_initialize}, 409 {"coif6", ORTH, COIFLETS, 6, coiflets_analysis_initialize, coiflets_synthesis_initialize}, 410 {"coif7", ORTH, COIFLETS, 7, coiflets_analysis_initialize, coiflets_synthesis_initialize}, 411 {"coif8", ORTH, COIFLETS, 8, coiflets_analysis_initialize, coiflets_synthesis_initialize}, 412 {"coif9", ORTH, COIFLETS, 9, coiflets_analysis_initialize, coiflets_synthesis_initialize}, 413 {"coif10", ORTH, COIFLETS, 10, coiflets_analysis_initialize, coiflets_synthesis_initialize}, 414 {"coif11", ORTH, COIFLETS, 11, coiflets_analysis_initialize, coiflets_synthesis_initialize}, 415 {"coif12", ORTH, COIFLETS, 12, coiflets_analysis_initialize, coiflets_synthesis_initialize}, 416 {"coif13", ORTH, COIFLETS, 13, coiflets_analysis_initialize, coiflets_synthesis_initialize}, 417 {"coif14", ORTH, COIFLETS, 14, coiflets_analysis_initialize, coiflets_synthesis_initialize}, 418 {"coif15", ORTH, COIFLETS, 15, coiflets_analysis_initialize, coiflets_synthesis_initialize}, 419 {"coif16", ORTH, COIFLETS, 16, coiflets_analysis_initialize, coiflets_synthesis_initialize}, 420 {"coif17", ORTH, COIFLETS, 17, coiflets_analysis_initialize, coiflets_synthesis_initialize}, 421 {"sym2", ORTH, SYMLETS, 2, symlets_analysis_initialize, symlets_synthesis_initialize}, 422 {"sym3", ORTH, SYMLETS, 3, symlets_analysis_initialize, symlets_synthesis_initialize}, 423 {"sym4", ORTH, SYMLETS, 4, symlets_analysis_initialize, symlets_synthesis_initialize}, 424 {"sym5", ORTH, SYMLETS, 5, symlets_analysis_initialize, symlets_synthesis_initialize}, 425 {"sym6", ORTH, SYMLETS, 6, symlets_analysis_initialize, symlets_synthesis_initialize}, 426 {"sym7", ORTH, SYMLETS, 7, symlets_analysis_initialize, symlets_synthesis_initialize}, 427 {"sym8", ORTH, SYMLETS, 8, symlets_analysis_initialize, symlets_synthesis_initialize}, 428 {"sym9", ORTH, SYMLETS, 9, symlets_analysis_initialize, symlets_synthesis_initialize}, 429 {"sym10", ORTH, SYMLETS, 10, symlets_analysis_initialize, symlets_synthesis_initialize}, 430 {"sym11", ORTH, SYMLETS, 11, symlets_analysis_initialize, symlets_synthesis_initialize}, 431 {"sym12", ORTH, SYMLETS, 12, symlets_analysis_initialize, symlets_synthesis_initialize}, 432 {"sym13", ORTH, SYMLETS, 13, symlets_analysis_initialize, symlets_synthesis_initialize}, 433 {"sym14", ORTH, SYMLETS, 14, symlets_analysis_initialize, symlets_synthesis_initialize}, 434 {"sym15", ORTH, SYMLETS, 15, symlets_analysis_initialize, symlets_synthesis_initialize}, 435 {"sym16", ORTH, SYMLETS, 16, symlets_analysis_initialize, symlets_synthesis_initialize}, 436 {"sym17", ORTH, SYMLETS, 17, symlets_analysis_initialize, symlets_synthesis_initialize}, 437 {"sym18", ORTH, SYMLETS, 18, symlets_analysis_initialize, symlets_synthesis_initialize}, 438 {"sym19", ORTH, SYMLETS, 19, symlets_analysis_initialize, symlets_synthesis_initialize}, 439 {"sym20", ORTH, SYMLETS, 20, symlets_analysis_initialize, symlets_synthesis_initialize}, 440 {"bior1.1", BIORTH, SPLINE_BIORTH, 11, sp_bior_analysis_initialize, sp_bior_synthesis_initialize}, 441 {"bior1.3", BIORTH,SPLINE_BIORTH, 13, sp_bior_analysis_initialize, sp_bior_synthesis_initialize}, 442 {"bior1.5", BIORTH,SPLINE_BIORTH, 15, sp_bior_analysis_initialize, sp_bior_synthesis_initialize}, 443 {"bior2.2", BIORTH,SPLINE_BIORTH, 22, sp_bior_analysis_initialize, sp_bior_synthesis_initialize}, 444 {"bior2.4", BIORTH,SPLINE_BIORTH, 24, sp_bior_analysis_initialize, sp_bior_synthesis_initialize}, 445 {"bior2.6", BIORTH,SPLINE_BIORTH, 26, sp_bior_analysis_initialize, sp_bior_synthesis_initialize}, 446 {"bior2.8", BIORTH,SPLINE_BIORTH, 28, sp_bior_analysis_initialize, sp_bior_synthesis_initialize}, 447 {"bior3.1", BIORTH,SPLINE_BIORTH, 31, sp_bior_analysis_initialize, sp_bior_synthesis_initialize}, 448 {"bior3.3", BIORTH,SPLINE_BIORTH, 33, sp_bior_analysis_initialize, sp_bior_synthesis_initialize}, 449 {"bior3.5", BIORTH,SPLINE_BIORTH, 35, sp_bior_analysis_initialize, sp_bior_synthesis_initialize}, 450 {"bior3.7", BIORTH,SPLINE_BIORTH, 37, sp_bior_analysis_initialize, sp_bior_synthesis_initialize}, 451 {"bior3.9", BIORTH,SPLINE_BIORTH, 39, sp_bior_analysis_initialize, sp_bior_synthesis_initialize}, 452 {"bior4.4", BIORTH,SPLINE_BIORTH, 44, sp_bior_analysis_initialize, sp_bior_synthesis_initialize}, 453 {"bior5.5", BIORTH,SPLINE_BIORTH, 55, sp_bior_analysis_initialize, sp_bior_synthesis_initialize}, 454 {"bior6.8", BIORTH,SPLINE_BIORTH, 68, sp_bior_analysis_initialize, sp_bior_synthesis_initialize}, 455 {"rbior1.1", BIORTH,SPLINE_RBIORTH, 11, sp_rbior_analysis_initialize, sp_rbior_synthesis_initialize}, 456 {"rbior1.3", BIORTH,SPLINE_RBIORTH, 13, sp_rbior_analysis_initialize, sp_rbior_synthesis_initialize}, 457 {"rbior1.5", BIORTH,SPLINE_RBIORTH, 15, sp_rbior_analysis_initialize, sp_rbior_synthesis_initialize}, 458 {"rbior2.2", BIORTH,SPLINE_RBIORTH, 22, sp_rbior_analysis_initialize, sp_rbior_synthesis_initialize}, 459 {"rbior2.4", BIORTH,SPLINE_RBIORTH, 24, sp_rbior_analysis_initialize, sp_rbior_synthesis_initialize}, 460 {"rbior2.6", BIORTH,SPLINE_RBIORTH, 26, sp_rbior_analysis_initialize, sp_rbior_synthesis_initialize}, 461 {"rbior2.8", BIORTH,SPLINE_RBIORTH, 28, sp_rbior_analysis_initialize, sp_rbior_synthesis_initialize}, 462 {"rbior3.1", BIORTH,SPLINE_RBIORTH, 31, sp_rbior_analysis_initialize, sp_rbior_synthesis_initialize}, 463 {"rbior3.3", BIORTH,SPLINE_RBIORTH, 33, sp_rbior_analysis_initialize, sp_rbior_synthesis_initialize}, 464 {"rbior3.5", BIORTH,SPLINE_RBIORTH, 35, sp_rbior_analysis_initialize, sp_rbior_synthesis_initialize}, 465 {"rbior3.7", BIORTH,SPLINE_RBIORTH, 37, sp_rbior_analysis_initialize, sp_rbior_synthesis_initialize}, 466 {"rbior3.9", BIORTH,SPLINE_RBIORTH, 39, sp_rbior_analysis_initialize, sp_rbior_synthesis_initialize}, 467 {"rbior4.4", BIORTH,SPLINE_RBIORTH, 44, sp_rbior_analysis_initialize, sp_rbior_synthesis_initialize}, 468 {"rbior5.5", BIORTH,SPLINE_RBIORTH, 55, sp_rbior_analysis_initialize, sp_rbior_synthesis_initialize}, 469 {"rbior6.8", BIORTH,SPLINE_RBIORTH, 68, sp_rbior_analysis_initialize, sp_rbior_synthesis_initialize}, 470 {"beylkin", ORTH, BEYLKIN, 0, beylkin_analysis_initialize, beylkin_synthesis_initialize}, 471 {"vaidyanathan", ORTH, VAIDYANATHAN, 0, vaidyanathan_analysis_initialize, vaidyanathan_synthesis_initialize}, 472 {"dmey", ORTH, DMEY, 0, dmey_analysis_initialize, dmey_synthesis_initialize}, 473 {"bath4.0", ORTH, BATHLETS, 40, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 474 {"bath4.1", ORTH, BATHLETS, 41, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 475 {"bath4.2", ORTH, BATHLETS, 42, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 476 {"bath4.3", ORTH, BATHLETS, 43, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 477 {"bath4.4", ORTH, BATHLETS, 44, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 478 {"bath4.5", ORTH, BATHLETS, 45, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 479 {"bath4.6", ORTH, BATHLETS, 46, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 480 {"bath4.7", ORTH, BATHLETS, 47, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 481 {"bath4.8", ORTH, BATHLETS, 48, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 482 {"bath4.9", ORTH, BATHLETS, 49, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 483 {"bath4.10", ORTH, BATHLETS, 410, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 484 {"bath4.11", ORTH, BATHLETS, 411, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 485 {"bath4.12", ORTH, BATHLETS, 412, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 486 {"bath4.13", ORTH, BATHLETS, 413, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 487 {"bath4.14", ORTH, BATHLETS, 414, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 488 {"bath4.15", ORTH, BATHLETS, 415, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 489 {"bath6.0", ORTH, BATHLETS, 60, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 490 {"bath6.1", ORTH, BATHLETS, 61, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 491 {"bath6.2", ORTH, BATHLETS, 62, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 492 {"bath6.3", ORTH, BATHLETS, 63, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 493 {"bath6.4", ORTH, BATHLETS, 64, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 494 {"bath6.5", ORTH, BATHLETS, 65, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 495 {"bath6.6", ORTH, BATHLETS, 66, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 496 {"bath6.7", ORTH, BATHLETS, 67, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 497 {"bath6.8", ORTH, BATHLETS, 68, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 498 {"bath6.9", ORTH, BATHLETS, 69, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 499 {"bath6.10", ORTH, BATHLETS, 610, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 500 {"bath6.11", ORTH, BATHLETS, 611, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 501 {"bath6.12", ORTH, BATHLETS, 612, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 502 {"bath6.13", ORTH, BATHLETS, 613, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 503 {"bath6.14", ORTH, BATHLETS, 614, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 504 {"bath6.15", ORTH, BATHLETS, 615, bathlets_analysis_initialize, bathlets_synthesis_initialize}, 505 {"legd1", ORTH, LEGENDRE, 1, legendre_analysis_initialize, legendre_synthesis_initialize}, 506 {"legd2", ORTH, LEGENDRE, 2, legendre_analysis_initialize, legendre_synthesis_initialize}, 507 {"legd3", ORTH, LEGENDRE, 3, legendre_analysis_initialize, legendre_synthesis_initialize}, 508 {"legd4", ORTH, LEGENDRE, 4, legendre_analysis_initialize, legendre_synthesis_initialize}, 509 {"legd5", ORTH, LEGENDRE, 5, legendre_analysis_initialize, legendre_synthesis_initialize}, 510 {"legd6", ORTH, LEGENDRE, 6, legendre_analysis_initialize, legendre_synthesis_initialize}, 511 {"legd7", ORTH, LEGENDRE, 7, legendre_analysis_initialize, legendre_synthesis_initialize}, 512 {"legd8", ORTH, LEGENDRE, 8, legendre_analysis_initialize, legendre_synthesis_initialize}, 513 {"legd9", ORTH, LEGENDRE, 9, legendre_analysis_initialize, legendre_synthesis_initialize}, 514 {"fa1", ORTH, FARRAS, 1, farras_analysis_initialize, farras_synthesis_initialize}, 515 {"fa2", ORTH, FARRAS, 2, farras_analysis_initialize, farras_synthesis_initialize}, 516 {"ksq1", ORTH, KINGSBURYQ, 1, kingsburyq_analysis_initialize, kingsburyq_synthesis_initialize}, 517 {"ksq2", ORTH, KINGSBURYQ, 2, kingsburyq_analysis_initialize, kingsburyq_synthesis_initialize} 518 }; 519 520 static int waveletIdentityNum = sizeof(wi)/sizeof(wavelet_identity); 521 522 static wavelet_family wif[] = { 523 {"haar","ORTH", "HAAR"}, 524 {"db", "ORTH", "DAUBECHIES"}, 525 {"coif", "ORTH", "COIFLETS"}, 526 {"sym", "ORTH", "SYMLETS"}, 527 {"bior", "BIORTH", "SPLINE_BIORTH"}, 528 {"beylkin", "ORTH", "BEYLKIN"}, 529 {"vaidyanathan", "ORTH", "VAIDYANATHAN"}, 530 {"dmey", "ORTH", "DMEY"}, 531 {"bath", "ORTH", "BATHLETS"}, 532 {"legd", "ORTH", "LEGENDRE"}, 533 {"rbior", "BIORTH","SPLINE_RBIORTH"}, 534 {"fa", "ORTH", "FARRAS"}, 535 {"ksq", "ORTH", "KINGSBURYQ"} 536 }; 537 static int waveletFamilyIdentityNum = sizeof(wif)/sizeof(wavelet_family); 538 539 static extend_method dwtMode = SYMH; 540 541 542 543 544 // wavelet_identity wi[]; 545 546 static double LowDecomFilCoef[80] = {0.0,0.0,0.0,0.0,0.0, 547 0.0,0.0,0.0,0.0,0.0, 548 0.0,0.0,0.0,0.0,0.0, 549 0.0,0.0,0.0,0.0,0.0, 550 0.0,0.0,0.0,0.0,0.0, 551 0.0,0.0,0.0,0.0,0.0, 552 0.0,0.0,0.0,0.0,0.0, 553 0.0,0.0,0.0,0.0,0.0, 554 0.0,0.0,0.0,0.0,0.0, 555 0.0,0.0,0.0,0.0,0.0, 556 0.0,0.0,0.0,0.0,0.0, 557 0.0,0.0,0.0,0.0,0.0, 558 0.0,0.0,0.0,0.0,0.0, 559 0.0,0.0,0.0,0.0,0.0, 560 0.0,0.0,0.0,0.0,0.0, 561 0.0,0.0,0.0,0.0,0.0}; 562 563 static double LowReconFilCoef[80] = {0.0,0.0,0.0,0.0,0.0, 564 0.0,0.0,0.0,0.0,0.0, 565 0.0,0.0,0.0,0.0,0.0, 566 0.0,0.0,0.0,0.0,0.0, 567 0.0,0.0,0.0,0.0,0.0, 568 0.0,0.0,0.0,0.0,0.0, 569 0.0,0.0,0.0,0.0,0.0, 570 0.0,0.0,0.0,0.0,0.0, 571 0.0,0.0,0.0,0.0,0.0, 572 0.0,0.0,0.0,0.0,0.0, 573 0.0,0.0,0.0,0.0,0.0, 574 0.0,0.0,0.0,0.0,0.0, 575 0.0,0.0,0.0,0.0,0.0, 576 0.0,0.0,0.0,0.0,0.0, 577 0.0,0.0,0.0,0.0,0.0, 578 0.0,0.0,0.0,0.0,0.0}; 579 580 static double HiDecomFilCoef[80] = {0.0,0.0,0.0,0.0,0.0, 581 0.0,0.0,0.0,0.0,0.0, 582 0.0,0.0,0.0,0.0,0.0, 583 0.0,0.0,0.0,0.0,0.0, 584 0.0,0.0,0.0,0.0,0.0, 585 0.0,0.0,0.0,0.0,0.0, 586 0.0,0.0,0.0,0.0,0.0, 587 0.0,0.0,0.0,0.0,0.0, 588 0.0,0.0,0.0,0.0,0.0, 589 0.0,0.0,0.0,0.0,0.0, 590 0.0,0.0,0.0,0.0,0.0, 591 0.0,0.0,0.0,0.0,0.0, 592 0.0,0.0,0.0,0.0,0.0, 593 0.0,0.0,0.0,0.0,0.0, 594 0.0,0.0,0.0,0.0,0.0, 595 0.0,0.0,0.0,0.0,0.0}; 596 597 static double HiReconFilCoef[80] = {0.0,0.0,0.0,0.0,0.0, 598 0.0,0.0,0.0,0.0,0.0, 599 0.0,0.0,0.0,0.0,0.0, 600 0.0,0.0,0.0,0.0,0.0, 601 0.0,0.0,0.0,0.0,0.0, 602 0.0,0.0,0.0,0.0,0.0, 603 0.0,0.0,0.0,0.0,0.0, 604 0.0,0.0,0.0,0.0,0.0, 605 0.0,0.0,0.0,0.0,0.0, 606 0.0,0.0,0.0,0.0,0.0, 607 0.0,0.0,0.0,0.0,0.0, 608 0.0,0.0,0.0,0.0,0.0, 609 0.0,0.0,0.0,0.0,0.0, 610 0.0,0.0,0.0,0.0,0.0, 611 0.0,0.0,0.0,0.0,0.0, 612 0.0,0.0,0.0,0.0,0.0}; 613 614 static extension_identity ei[] = { 615 {"zpd", ZPD}, {"symh", SYMH}, {"symw", SYMW}, 616 {"asymh", ASYMH}, {"asymw", ASYMW}, {"sp0", SP0}, 617 {"sp1", SP1}, {"ppd", PPD}, {"per", PER}, 618 {"spd", SP1}, {"sym", SYMH}, {"asym", ASYMH}, 619 {"ZPD", ZPD}, {"SYMH", SYMH}, {"SYMW", SYMW}, 620 {"ASYMH", ASYMH}, {"ASYMW", ASYMW}, {"SP0", SP0}, 621 {"SP1", SP1}, {"PPD", PPD}, {"PER", PER}, 622 {"SPD", SP1}, {"SYM", SYMH}, {"ASYM", ASYMH} 623 }; 624 625 static int extensionIdentityNum = sizeof(ei)/sizeof(extension_identity); 626 627 628 void 629 cowavedec (double *sigIn, int sigInLength, double *sigOutR, 630 double *sigOutI, int sigOutLength, 631 double *lowDTree1S1, double *hiDTree1S1, 632 double *lowDTree2S1, double *hiDTree2S1, 633 double *lowDTree1S2, double *hiDTree1S2, 634 double *lowDTree2S2, double *hiDTree2S2, 635 int filterLen, int *waveDecLengthArray, 636 int lengthArrayLengh, int stride, extend_method extMethod); 637 638 639 void 640 cowaverec (double *sigInR, double *sigInI, int sigInLength, 641 double *sigOut, int sigOutLength, 642 double *lowRTree1S1, double *hiRTree1S1, 643 double *lowRTree2S1, double *hiRTree2S1, 644 double *lowRTree1S2, double *hiRTree1S2, 645 double *lowRTree2S2, double *hiRTree2S2, 646 int filterLen, int *waveDecLengthArray, 647 int lengthArraylength, int stride, 648 extend_method extMethod); 649 650 void 651 cowavedec2 (double *matrixIn, int matrixInRow, int matrixInCol, 652 double *lowDTree1S1, double *hiDTree1S1, 653 double *lowDTree1S2, double *hiDTree1S2, 654 int filterLen, int *pLen, double *coef, 655 int sigOutLength, int stride, extend_method extMethod); 656 657 void 658 cowavedec2a (double *matrixIn, int matrixInRow, int matrixInCol, 659 double *lowDTree1S1R, double *hiDTree1S1R, 660 double *lowDTree1S1C, double *hiDTree1S1C, 661 double *lowDTree1S2R, double *hiDTree1S2R, 662 double *lowDTree1S2C, double *hiDTree1S2C, 663 int filterLen, int *pLen, double *coef, 664 int sigOutLength, int stride, extend_method extMethod); 665 666 void 667 cowaverec2 (double *coef, int sigInLength, 668 double *lowRTree1S1, double *hiRTree1S1, 669 double *lowRTree1S2, double *hiRTree1S2, 670 int filterLen, double *matrixOut, int matrixOutRow, 671 int matrixOutCol, int *pLen, int stride, 672 extend_method extMethod); 673 674 void 675 cowaverec2a (double *coef, int sigInLength, 676 double *lowRTree1S1R, double *hiRTree1S1R, 677 double *lowRTree1S1C, double *hiRTree1S1C, 678 double *lowRTree1S2R, double *hiRTree1S2R, 679 double *lowRTree1S2C, double *hiRTree1S2C, 680 int filterLen, double *matrixOut, int matrixOutRow, 681 int matrixOutCol, int *pLen, int stride, 682 extend_method extMethod); 683 684 void 685 copmd (double *matrixInR, double *matrixInI, int sigInLength, 686 int InRow, int InCol, double *matrixOutR, double *matrixOutI); 687 688 void 689 copmr (double *matrixInR, double *matrixInI, int sigInLength, 690 int InRow, int InCol, double *matrixOutR, double *matrixOutI); 691 692 /*------------------------------------------*/ 693 /* Wavelet Family Function */ 694 /* -----------------------------------------*/ 695 void filter_clear (); 696 void orth_filt_group (double *filterIn, int sigInLength, 697 double *filterLowRec, 698 double *filterLowDec, 699 double *filterHiRec, 700 double *filterHiDec); 701 void bior_filt_group (double *f1, int sigInLength1, 702 double *f2, int sigInLength2, 703 double *lowDecom, int sigOutLength1, 704 double *hiDecom, int sigOutLength2, 705 double *lowRecon, int sigOutLength3, 706 double *hiRecon, int sigOutLength4); 707 void wavelet_parser (char *wname, int *family, int *member); 708 void wavelet_fun_parser (char *wname, int *ii); 709 void wave_len_validate (int sigInLen, int waveLength, int *lev, int *val); 710 711 extend_method getdwtMode(); 712 void dwt_write (char *mode, int *errCode); 713 void dwt_parse(char **strr); 714 void dwt (double *sigIn, int sigInLength, double *lowDe, 715 double *hiDe, int filterLen, double *approx, 716 double *detail, int sigOutLength, 717 extend_method extMethod); 718 void dwt_neo (double *sigIn, int sigInLength, double *lowDe, 719 double *hiDe, int filterLen, double *approx, 720 double *detail, int sigOutLength, 721 extend_method extMethod); 722 void dwt_nex (double *sigIn, int sigInLength, double *lowDe, 723 double *hiDe, int filterLen, double *approx, 724 double *detail, int sigOutLength); 725 void dwt_no_extension (double *sigIn, int sigInLength, double *lowDe, 726 double *hiDe, int filterLen, double *approx, 727 double *detail, int sigOutLength); 728 void dwt_conv (double *sigIn, int sigInLength, double *lowDe, 729 double *hiDe, int filterLen, double *approx, 730 double *detail, int sigOutLength); 731 void idwt_complete (double *approx, double *detail, 732 int sigInLength, double *lowRe, 733 double *hiRe, int filterLen, 734 double *sigOut, int sigOutLength); 735 void idwt_neo (double *approx, double *detail, 736 int sigInLength, double *lowRe, 737 double *hiRe, int filterLen, 738 double *sigOut, int sigOutLength); 739 void idwt_complete_ex (double *approx, double *detail, 740 int sigInLength, double *lowRe, 741 double *hiRe, int filterLen, 742 double *sigOut, int sigOutLength, 743 extend_method extMethod); 744 void idwt_approx (double *approx, int sigInLength, 745 double *lowRe, int filterLen, 746 double *sigOut, int sigOutLength); 747 void idwt_approx_ex (double *approx, int sigInLength, 748 double *lowRe, int filterLen, 749 double *sigOut, int sigOutLength, 750 extend_method extMethod); 751 void idwt_approx_neo (double *approx, int sigInLength, 752 double *lowRe, int filterLen, 753 double *sigOut, int sigOutLength); 754 void idwt_detail (double *detail, int sigInLength, 755 double *hiRe, int filterLen, 756 double *sigOut, int sigOutLength); 757 void idwt_detail_ex (double *detail, int sigInLength, 758 double *hiRe, int filterLen, 759 double *sigOut, int sigOutLength, 760 extend_method extMethod); 761 void idwt_detail_neo (double *detail, int sigInLength, 762 double *hiRe, int filterLen, 763 double *sigOut, int sigOutLength); 764 void wave_dec_len_cal (int filterLen, int sigLength, 765 int stride, int *waveDecLengthArray); 766 void wavedec (double *sigIn, int sigInLength, double *sigOut, 767 int sigOutLength, double *lowDe, double *hiDe, 768 int filterLen, int *waveDecLengthArray, 769 int lengthArrayLengh, int stride, 770 extend_method extMethod); 771 void waverec (double *sigIn, int sigInLength, double *sigOut, 772 int sigOutLength, double *lowRe, double *hiRe, 773 int filterLen, int *waveDecLengthArray, 774 int lengthArraylength, int stride, 775 extend_method extMethod); 776 void wenergy (double *coef, int coefLen, int *lenArray, 777 int arrayLen, double *aE, int aELen, 778 double *dE, int dELen); 779 void detcoef (double *sigIn, int sigInLength, 780 int *waveDecLengthArray, int arrayLen, 781 double *sigOut, int sigOutLength, 782 int stride, int level); 783 void appcoef (double *sigIn, int sigInLength, double *sigOut, 784 int sigOutLength, double *lowRe, double *hiRe, 785 int filterLen, int *waveDecLengthArray, 786 int lengthArraylength, int stride, int level, 787 extend_method extMethod); 788 void wrcoef (double *sigIn, int sigInLength, double *lowRe, 789 double *hiRe, int filterLen, 790 int *waveDecLengthArray, int arrayLen, 791 double *sigOut, int sigOutLength, 792 char *coefType, int stride, int level, 793 extend_method extMethod); 794 void upcoef_len_cal (int sigInLength, int filterLen, 795 int stride, int *sigOutLength, 796 int *sigOutLengthDefault); 797 void upwlev (double *coefArray, int coefLen, 798 int *waveDecLengthArray, int arrayLen, 799 double *lowRe, double *hiRe, int filterLen, 800 double *newCoefArray, int newCoefLen, 801 int *newLenArray, int newArrayLen, 802 double *approx, int approxLen, int stride, 803 extend_method extMethod); 804 void upcoef (double *sigIn, int sigInLength, double *lowRe, 805 double *hiRe, int filterLen, double *sigOut, 806 int sigOutLength, int defaultLength, 807 char *coefType, int step); 808 809 void dwt2D (double *matrixIn, int matrixInRow, 810 int matrixInCol, double *matrixOutApprox, 811 double *matrixOutColDetail, 812 double *matrixOutRowDetail, 813 double *matrixOutDetail, int matrixOutRow, 814 int matrixOutCol, double *lowDe, double *hiDe, 815 int filterLen, extend_method extMethod); 816 void 817 dwt2D_neo_a (double *matrixIn, int matrixInRow, int matrixInCol, 818 double *matrixOutApprox, double *matrixOutColDetail, 819 double *matrixOutRowDetail, double *matrixOutDetail, 820 int matrixOutRow, int matrixOutCol, double *lowDeR, 821 double *hiDeR, double *lowDeC, double *hiDeC, 822 int filterLen, extend_method extMethod); 823 void dwt2D_neo (double *matrixIn, int matrixInRow, 824 int matrixInCol, double *matrixOutApprox, 825 double *matrixOutColDetail, 826 double *matrixOutRowDetail, 827 double *matrixOutDetail, int matrixOutRow, 828 int matrixOutCol, double *lowDe, double *hiDe, 829 int filterLen, extend_method extMethod); 830 void idwt2D (double *matrixInApprox, 831 double *matrixInColDetail, 832 double *matrixInRowDetail, 833 double *matrixInDetail, 834 int matrixInRow, int matrixInCol, double *lowRe, 835 double *hiRe, int filterLen, double *matrixOut, 836 int matrixOutRow, int matrixOutCol, 837 extend_method extMethod); 838 void idwt2D_neo (double *matrixInApprox, double *matrixInColDetail, 839 double *matrixInRowDetail, double *matrixInDetail, 840 int matrixInRow, int matrixInCol, double *lowRe, 841 double *hiRe, int filterLen, double *matrixOut, 842 int matrixOutRow, int matrixOutCol); 843 void 844 idwt2D_neo_a (double *matrixInApprox, double *matrixInColDetail, 845 double *matrixInRowDetail, double *matrixInDetail, 846 int matrixInRow, int matrixInCol, double *lowReR, 847 double *hiReR, double *lowReC, double *hiReC, 848 int filterLen, double *matrixOut, 849 int matrixOutRow, int matrixOutCol); 850 851 void wave_mem_cal (int *pLen, int stride, int *total); 852 void matrix_wavedec_len_cal (int matrixInRow, int matrixInCol, 853 int stride, int filterLen, 854 int *pLen); 855 void matrix_locate (int stride, int *pLen, int *pH, 856 int *pV, int *pD); 857 void wavedec2 (double *matrixIn, int matrixInRow, 858 int matrixInCol, double *lowDe, double *hiDe, 859 int filterLen, int *pLen, double *coef, 860 int sigOutLength, int stride, 861 extend_method extMethod); 862 void 863 wavedec2a (double *matrixIn, int matrixInRow, int matrixInCol, 864 double *lowDeR, double *hiDeR, double *lowDeC, 865 double *hiDeC, int filterLen, int *pLen, 866 double *coef, int sigOutLength, int stride, 867 extend_method extMethod); 868 void waverec2 (double *coef, int sigInLength, double *lowRe, 869 double *hiRe, int filterLen, double *matrixOut, 870 int matrixOutRow, int matrixOutCol, int *pLen, 871 int stride, extend_method extMethod); 872 void 873 waverec2a (double *coef, int sigInLength, double *lowReR, 874 double *hiReR, double *lowReC, double *hiReC, 875 int filterLen, double *matrixOut, int matrixOutRow, 876 int matrixOutCol, int *pLen, int stride, 877 extend_method extMethod); 878 879 void wenergy_2output (double *coef, int sigInLength, 880 int *pLen, double *ae, double *de, 881 int deLength, int stride); 882 void wenergy_4output (double *coef, int sigInLength, 883 int *pLen, double *ae, double *he, 884 double *ve, double *de, int deLength, 885 int stride); 886 void detcoef2 (double *coef, int sigInLength, double *coefOut, 887 int sigOutLength, int *pLen, int stride, 888 int level, char *coefType); 889 void appcoef2 (double *coef, int sigInLength, double *lowRe, 890 double *hiRe, int filterLen, double *coefOut, 891 int matrixOutRow, int matrixOutCol, int *pLen, 892 int stride, int level, extend_method extMethod); 893 void wrcoef2 (double *coef, int sigInLength, double *lowRe, 894 double *hiRe, int filterLen, double *matrixOut, 895 int matrixOutRow, int matrixOutCol, int *pLen, 896 int stride, int level, char *type, 897 extend_method extMethod); 898 void upwlev2 (double *coef, int sigInLength, double *lowRe, 899 double *hiRe, 900 int filterLen, int *pLen, int matrixRow, int matrixCol, 901 double *approx, int approxLen, double *newCoef, 902 int newCoefLen, int *newLenMatrix, int lenMatrixRow, 903 int lenMatrixCol, int stride, extend_method extMethod); 904 void upcoef2 (double *matrixIn, int matrixInRow, 905 int matrixInCol, double *lowRe, double *hiRe, 906 int filterLen, double *matrixOut, 907 int matrixOutRow, int matrixOutCol, 908 int matrixOutDefaultRow, 909 int matrixOutDefaultCol, 910 int step, char *type);//, extend_method extMethod); 911 912 void dwt3d_tran(double *mat3DIn, int row1, int col1, int sli1, 913 double *mat3DOut, int row2, int col2, int sli2); 914 915 void dwt3d_line_forward(double *mat3DIn, int row1, int col1, int sli1, 916 double *mat3DOutApp, double *mat3DOutDet, 917 int row2, int col2, int sli2, 918 double *loDe, double *hiDe, int filterLen, 919 extend_method extMethod); 920 921 void dwt3d_tran_z(double *mat3DIn, int row1, int col1, int sli1, 922 double *mat3DOut, int row2, int col2, int sli2); 923 924 void dwt3d_tran_z_inv(double *mat3DIn, int row1, int col1, int sli1, 925 double *mat3DOut, int row2, int col2, int sli2); 926 927 void dwt3d_combine(double *mat1, double *mat2, double *mat3, 928 double *mat4, double *mat5, double *mat6, 929 double *mat7, double *mat8, int rowIn, 930 int colIn, int sliIn, double *matOut, 931 int rowOut, int colOut, int sliOut); 932 void dwt3d_line_reverse(double *mat3DInApp, double *mat3DInDet, 933 int row1, int col1, int sli1, 934 double *mat3DOut, int row2, int col2, 935 int sli2, 936 double *loDe, double *hiDe, int filterLen); 937 938 939 void dwt3d_split(double *matIn, int rowIn, int colIn, int sliIn, 940 double *mat1, double *mat2, double *mat3, 941 double *mat4, double *mat5, double *mat6, 942 double *mat7, double *mat8, int rowOut, 943 int colOut, int sliOut); 944 void dwt3(double *mat3DIn, int row, int col, int sli, 945 double *mat3DOut, int row2, int col2, int sli2, 946 int r, int c, int s, double *Lo1, double *Hi1, 947 double *Lo2, double *Hi2, double *Lo3, double *Hi3, 948 int fLen1, int fLen2, int fLen3, extend_method extMethod); 949 950 951 952 953 954 955 956 void cwt_fun_parser(char *wname, int *ind); 957 void cwt_len_cal (int sigInLength, int scale, int *sigOutLength, double *delta); 958 void full_range_scalef (char *wname, double *f, int sigOutLength); 959 void scale_real (double *f, int sigInLength, double delta, double *fout, int sigOutLength); 960 // void scale_complex (double *f, int sigInLength, double delta, double *fout, int sigOutLength); 961 void cwt_conv_real (double *sigIn, int sigInLength, double *f, int filterLen, double *sigOut, int sigOutLength); 962 void cwt_iconv_real (double *sigIn, int sigInLength, double *f, int filterLen, double *sigOut, int sigOutLength); 963 void cwt_conv_complex (double *sigIn, int sigInLength, double *fr, double *fi, int filterLen, double *sigOutR, double *sigOutI, int sigOutLength); 964 void cwt_conv_complex_complex (double *a, double *b, int sigInLength,double *c, double *d, 965 int filterLen, double *sigOutR, double *sigOutI, int sigOutLength); 966 967 968 969 970 /********************************************* 971 * Function Prototype 972 ********************************************/ 973 void swt_conv(double *sigIn, int sigInLength, 974 double *approx, int approxLength, 975 double *detail, int detailLength, 976 double *filterLow, double *filterHi, 977 int filterLength); 978 void swt_out1 (double *sigIn, int sigInLength, 979 double *sigOutMatrix, int rowLength, 980 int colLength, double *filterLow, 981 double *filterHi, int filterLength, int step); 982 983 void swt_out2 (double *sigIn, int sigInLength, 984 double *approxMatrix, double *detailMatrix, 985 int rowLength, int colLength, double *filterLow, 986 double *filterHi, int filterLength, int step); 987 988 void iswt_conv (double *approx, double *detail, int sigInLength, 989 double *sigOut, int sigOutLength, double *filterLow, 990 double *filterHi, int filterLength); 991 void iswt_conv_step (double *approx, double *detail, int sigInLength, 992 double *sigOut, int sigOutLength, double *filterLow, 993 double *filterHi, int filterLength, int level); 994 995 void iswt_input1 (double *matrixIn, int rowLength, int colLength, 996 double *sigOut, int sigOutLength, double *filterLow, 997 double *filterHi, int filterLength); 998 999 void iswt_input2 (double *matrixApproxIn, double *matrixDetailIn, 1000 int rowLength, int colLength, 1001 double *sigOut, int sigOutLength, double *filterLow, 1002 double *filterHi, int filterLength); 1003 void swt2_output4(double *matrixIn, int matrixInRow, int matrixInCol, 1004 double *matrixOutApprox, double *matrixOutColDetail, 1005 double *matrixOutRowDetail, double *matrixOutDetail, 1006 int matrixOutRow, int matrixOutCol, 1007 double *filterLow, double *filterHi, 1008 int filterLength, int step); 1009 void swt2_output4_step(double *matrixIn, int matrixInRow, int matrixInCol, 1010 double *matrixOutApprox, double *matrixOutColDetail, 1011 double *matrixOutRowDetail, double *matrixOutDetail, 1012 int matrixOutRow, int matrixOutCol, 1013 double *filterLow, double *filterHi, 1014 int filterLength, int step); 1015 void swt2_output1_step(double *matrixIn, int matrixInRow, 1016 int matrixInCol, double *matrixOut, 1017 int matrixOutRow, int matrixOutCol, 1018 double *filterLow, double *filterHi, 1019 int filterLength, int step); 1020 void iswt2(double *matrixInApprox, double *matrixInColDetail, 1021 double *matrixInRowDetail, double *matrixInDetail, 1022 int matrixInRow, int matrixInCol, 1023 double *matrixOut, int matrixOutRow, int matrixOutCol, 1024 double *filterLow, double *filterHi, 1025 int filterLength, int step); 1026 void iswt2_input4_step(double *matrixInApprox, double *matrixInColDetail, 1027 double *matrixInRowDetail, double *matrixInDetail, 1028 int matrixInRow, int matrixInCol, 1029 double *matrixOut, int matrixOutRow, int matrixOutCol, 1030 double *filterLow, double *filterHi, 1031 int filterLength, int step); 1032 void iswt2_input1_step(double *matrixIn, int matrixInRow, int matrixInCol, 1033 double *matrixOut, int matrixOutRow, int matrixOutCol, 1034 double *filterLow, double *filterHi, 1035 int filterLength, int step); 1036 1037 /*------------------------------------------*/ 1038 /* Utility Function */ 1039 /* -----------------------------------------*/ 1040 void matrix_tran (double *matrixIn, int matrixInRow, 1041 int matrixInCol, double *matrixOut, 1042 int matrixOutRow, int matrixOutCol); 1043 void wrev (const double *sigIn, int sigInLength, 1044 double *sigOut, int sigOutLength); 1045 void qmf_even (const double *sigIn, int sigInLength, 1046 double *sigOut, int sigOutLength); 1047 void qmf_odd (double *sigIn, int sigInLength, 1048 double *sigOut, int sigOutLength); 1049 void qmf_wrev (const double *sigIn, int sigInLength, 1050 double *sigOut, int sigOutLength); 1051 void verbatim_copy (const double *sigIn, int sigInLength, 1052 double *sigOut, int sigOutLength); 1053 void dyaddown_1D_keep_odd (double *sigIn, int sigInLength, 1054 double *sigOut, int sigOutLength); 1055 void dyaddown_1D_keep_even (double *sigIn, int sigInLength, 1056 double *sigOut, int sigOutLength); 1057 void dyaddown_2D_keep_odd_row (double *matrixIn, 1058 int matrixInRow, 1059 int matrixInCol, 1060 double *matrixOut, 1061 int matrixOutRow, 1062 int matrixOutCol); 1063 void dyaddown_2D_keep_odd_col (double *matrixIn, 1064 int matrixInRow, 1065 int matrixInCol, 1066 double *matrixOut, 1067 int matrixOutRow, 1068 int matrixOutCol); 1069 void dyaddown_2D_keep_even_row (double *matrixIn, 1070 int matrixInRow, 1071 int matrixInCol, 1072 double *matrixOut, 1073 int matrixOutRow, 1074 int matrixOutCol); 1075 void dyaddown_2D_keep_even_col (double *matrixIn, 1076 int matrixInRow, 1077 int matrixInCol, 1078 double *matrixOut, 1079 int matrixOutRow, 1080 int matrixOutCol); 1081 void dyaddown_2D_keep_odd (double *matrixIn, 1082 int matrixInRow, 1083 int matrixInCol, 1084 double *matrixOut, 1085 int matrixOutRow, 1086 int matrixOutCol); 1087 void dyaddown_2D_keep_even (double *matrixIn, 1088 int matrixInRow, 1089 int matrixInCol, 1090 double *matrixOut, 1091 int matrixOutRow, 1092 int matrixOutCol); 1093 void dyadup_1D_feed_odd (double *sigIn, int sigInLength, 1094 double *sigOut, int sigOutLength); 1095 void dyadup_1D_feed_even (double *sigIn, int sigInLength, 1096 double *sigOut, int sigOutLength); 1097 void dyadup_2D_feed_odd_row (double *matrixIn, 1098 int matrixInRow, 1099 int matrixInCol, 1100 double *matrixOut, 1101 int matrixOutRow, 1102 int matrixOutCol); 1103 void dyadup_2D_feed_odd_col (double *matrixIn, 1104 int matrixInRow, 1105 int matrixInCol, 1106 double *matrixOut, 1107 int matrixOutRow, 1108 int matrixOutCol); 1109 void dyadup_2D_feed_even_row (double *matrixIn, 1110 int matrixInRow, 1111 int matrixInCol, 1112 double *matrixOut, 1113 int matrixOutRow, 1114 int matrixOutCol); 1115 void dyadup_2D_feed_even_col (double *matrixIn, 1116 int matrixInRow, 1117 int matrixInCol, 1118 double *matrixOut, 1119 int matrixOutRow, 1120 int matrixOutCol); 1121 void dyadup_2D_feed_odd (double *matrixIn, 1122 int matrixInRow, 1123 int matrixInCol, 1124 double *matrixOut, 1125 int matrixOutRow, 1126 int matrixOutCol); 1127 void dyadup_2D_feed_even (double *matrixIn, 1128 int matrixInRow, 1129 int matrixInCol, 1130 double *matrixOut, 1131 int matrixOutRow, 1132 int matrixOutCol); 1133 void extend_method_parse (char *mode, extend_method *extMethod); 1134 void wextend_1D_center (double *sigIn, int sigInLength, 1135 double *sigOut, int sigOutLength, 1136 extend_method method); 1137 void wextend_1D_left (double *sigIn, int sigInLength, 1138 double *sigOut, int sigOutLength, 1139 extend_method method); 1140 void wextend_1D_right (double *sigIn, int sigInLength, 1141 double *sigOut, int sigOutLength, 1142 extend_method method); 1143 void wextend_2D (double *matrixIn, int matrixInRow, 1144 int matrixInCol, double *matrixOut, 1145 int matrixOutRow, int matrixOutCol, 1146 extend_method extMethod, char *rowOpt, 1147 char *colOpt); 1148 void wextend_2D_row (double *matrixIn, int matrixInRow, 1149 int matrixInCol, double *matrixOut, 1150 int matrixOutRow, int matrixOutCol, 1151 extend_method extMethod, char *Opt); 1152 void wextend_2D_col (double *matrixIn, int matrixInRow, 1153 int matrixInCol, double *matrixOut, 1154 int matrixOutRow, int matrixOutCol, 1155 extend_method extMethod, char *Opt); 1156 void wkeep_1D_center (double *sigIn, int sigInLength, 1157 double *sigOut, int sigOutLength); 1158 void wkeep_1D_left (double *sigIn, int sigInLength, 1159 double *sigOut, int sigOutLength); 1160 void wkeep_1D_right (double *sigIn, int sigInLength, 1161 double *sigOut, int sigOutLength); 1162 void wkeep_1D_index (double *sigIn, int sigInLength, 1163 double *sigOut, int sigOutLength, 1164 int first); 1165 void wkeep_2D_center (double *matrixIn, int matrixInRow, 1166 int matrixInCol, double *matrixOut, 1167 int matrixOutRow, int matrixOutCol); 1168 void wkeep_2D_index (double *matrixIn, int matrixInRow, 1169 int matrixInCol, double *matrixOut, 1170 int matrixOutRow, int matrixOutCol, 1171 int rowFirst, int colFirst); 1172 void conv (double *sigIn, int sigInLength, 1173 double *sigOut, int sigOutLength, 1174 double *fiter, int filterLength); 1175 void i_conv (double *sigIn, int sigInLength, 1176 double *sigOut, int sigOutLength, 1177 double *fiter, int filterLength); 1178 void swt_exp2(int lev, int *outputV); 1179 void linspace(double lb, double ub, int n, double *sigOut, int sigOutLength); 1180 void ocumsum (double *sigIn, int sigInLength); 1181 void swt_max(double *sigIn, int sigInLength, double *sigMax); 1182 void swt_min(double *sigIn, int sigInLength, double *sigMin); 1183 void wcodemat_abs(double *sigIn, int sigInLength, double *sigOut, int sigOutLength, int minv, int maxv); 1184 void swt_max_abs(double *sigIn, int sigInLength, double *sigMax); 1185 void swt_min_abs(double *sigIn, int sigInLength, double *sigMin); 1186 double swt_abs(double sigIn); 1187 void wcodemat(double *sigIn, int sigInLength, double *sigOut, int sigOutLength, int minv, int maxv); 1188 void wcodematd(double *sigIn, int sigInLength, double *sigOut, int sigOutLength, double minv, double maxv); 1189 void wcodemat_matrix (double *matrixIn, int matrixInRow, int matrixInCol, 1190 double *matrixOut, int matrixOutRow, int matrixOutCol, 1191 int minv, int maxv, int abso); 1192 void wcodemat_matrix_col (double *matrixIn, int matrixInRow, int matrixInCol, 1193 double *matrixOut, int matrixOutRow, int matrixOutCol, 1194 int minv, int maxv, int abso); 1195 void wcodemat_matrix_row (double *matrixIn, int matrixInRow, int matrixInCol, 1196 double *matrixOut, int matrixOutRow, int matrixOutCol, 1197 int minv, int maxv, int abso); 1198 1199 __END_DECLS 1200 1201 1202 #endif /** _SWTLIB_H_ **/ 1203