wavelib.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. #ifndef WAVELIB_H_
  2. #define WAVELIB_H_
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #if defined(_MSC_VER)
  7. #pragma warning(disable : 4200)
  8. #pragma warning(disable : 4996)
  9. #endif
  10. #ifndef fft_type
  11. #define fft_type float
  12. #endif
  13. #ifndef cplx_type
  14. #define cplx_type float
  15. #endif
  16. typedef struct Filter{
  17. uint Len;
  18. float C0;
  19. float C1;
  20. float C2;
  21. float C3;
  22. }Filter;
  23. typedef struct
  24. {
  25. float x1;
  26. float x2;
  27. float x3;
  28. float x4;
  29. float x5;
  30. float x6;
  31. float x7;
  32. float y1;
  33. float y2;
  34. float y3;
  35. float y4;
  36. float y5;
  37. float y6;
  38. float y7;
  39. }hilbert_para; //�˲���ϵ��
  40. typedef struct wave_set* wave_object;
  41. wave_object wave_init(const char* wname);
  42. struct wave_set{
  43. char wname[50];
  44. int filtlength;// When all filters are of the same length. [Matlab uses zero-padding to make all filters of the same length]
  45. int lpd_len;// Default filtlength = lpd_len = lpr_len = hpd_len = hpr_len
  46. int hpd_len;
  47. int lpr_len;
  48. int hpr_len;
  49. float *lpd;
  50. float *hpd;
  51. float *lpr;
  52. float *hpr;
  53. float params[0];
  54. };
  55. typedef struct fft_t {
  56. fft_type re;
  57. fft_type im;
  58. } fft_data;
  59. typedef struct fft_set* fft_object;
  60. fft_object fft_init(int N, int sgn);
  61. struct fft_set{
  62. int N;
  63. int sgn;
  64. int factors[64];
  65. int lf;
  66. int lt;
  67. fft_data twiddle[1];
  68. };
  69. typedef struct fft_real_set* fft_real_object;
  70. fft_real_object fft_real_init(int N, int sgn);
  71. struct fft_real_set{
  72. fft_object cobj;
  73. fft_data twiddle2[1];
  74. };
  75. typedef struct conv_set* conv_object;
  76. conv_object conv_init(int N, int L);
  77. struct conv_set{
  78. fft_real_object fobj;
  79. fft_real_object iobj;
  80. int ilen1;
  81. int ilen2;
  82. int clen;
  83. };
  84. typedef struct wt_set* wt_object;
  85. wt_object wt_init(wave_object wave,const char* method, int siglength, int J);
  86. struct wt_set{
  87. wave_object wave;
  88. conv_object cobj;
  89. char method[10];
  90. int siglength;// Length of the original signal.
  91. int modwtsiglength; // Modified signal length for MODWT
  92. int outlength;// Length of the output DWT vector
  93. int lenlength;// Length of the Output Dimension Vector "length"
  94. int J; // Number of decomposition Levels
  95. int MaxIter;// Maximum Iterations J <= MaxIter
  96. int even;// even = 1 if signal is of even length. even = 0 otherwise
  97. char ext[10];// Type of Extension used - "per" or "sym"
  98. char cmethod[10]; // Convolution Method - "direct" or "FFT"
  99. int N; //
  100. int cfftset;
  101. int zpad;
  102. int length[102];
  103. float *output;
  104. float params[0];
  105. };
  106. void filter_Init(void);
  107. float hilbert_filter(float *channel1, float *channel2, int len);
  108. void DWT_Matrix_Transform(float *srcData, s16 *resData, int srcLen);
  109. void modwt(wt_object wt, const float *inp);
  110. void imodwt(wt_object wt, float *dwtop);
  111. float* getMODWTmra(wt_object wt, float *wavecoeffs);
  112. void wave_free(wave_object object);
  113. void wt_free(wt_object object);
  114. extern struct file *g_fpuo,*g_fpio;
  115. #ifdef __cplusplus
  116. }
  117. #endif
  118. #endif /* WAVELIB_H_ */