wavelib.h 3.2 KB

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