You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

wavelet2s.h 6.6KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #pragma once
  2. #if defined(TARGET_HAS_ThirdPartyFFTW3)
  3. #include <vector>
  4. #include <complex>
  5. // 1D Functions
  6. // void* dwt(std::vector<double> &, int ,std::string , std::vector<double> &, std::vector<double> &);
  7. void* dwt1(const std::string& wname, std::vector<double>& signal, std::vector<double>& cA, std::vector<double>& cD);
  8. void* dyadic_zpad_1d(std::vector<double>& signal);
  9. double convol(std::vector<double>& a1, std::vector<double>& b1, std::vector<double>& c);
  10. int filtcoef(const std::string& name, std::vector<double>& lp1, std::vector<double>& hp1, std::vector<double>& lp2, std::vector<double>& hp2);
  11. void downsamp(std::vector<double>& sig, int m, std::vector<double>& sigD);
  12. void upsamp(std::vector<double>& sig, int m, std::vector<double>& sigU);
  13. void circshift(std::vector<double>& sigCir, int l);
  14. int sign(int x);
  15. void* idwt1(const std::string& wname, std::vector<double>& X, std::vector<double>& cA, std::vector<double>& cD);
  16. int vecsum(std::vector<double>& a, std::vector<double>& b, std::vector<double>& c);
  17. // 1D Symmetric Extension DWT Functions
  18. void* dwt_sym(std::vector<double>& signal, int J, const std::string& nm, std::vector<double>& dwtOutput, std::vector<double>& flag,
  19. std::vector<size_t>& length);
  20. void* dwt1_sym(const std::string& wname, std::vector<double>& signal, std::vector<double>& cA, std::vector<double>& cD);
  21. void* idwt_sym(std::vector<double>& dwtop, std::vector<double>& flag, const std::string& nm, std::vector<double>& idwtOutput, std::vector<size_t>& length);
  22. void* symm_ext(std::vector<double>& sig, int a);
  23. void* idwt1_sym(const std::string& wname, std::vector<double>& x, std::vector<double>& app, std::vector<double>& detail); // Not Tested
  24. // 1D Stationary Wavelet Transform
  25. void* swt(std::vector<double>& signal1, int J, const std::string& nm, std::vector<double>& swtOutput, int& length);
  26. void* iswt(std::vector<double>& swtop, int J, const std::string& nm, std::vector<double>& iswtOutput);
  27. void* per_ext(std::vector<double>& sig, int a);
  28. // 2D Functions
  29. void* branch_lp_dn(const std::string& wname, std::vector<double>& signal, std::vector<double>& sigop);
  30. void* branch_hp_dn(const std::string& wname, std::vector<double>& signal, std::vector<double>& sigop);
  31. void* branch_lp_hp_up(const std::string& wname, std::vector<double>& cA, std::vector<double>& cD, std::vector<double>& x);
  32. // void* dwt_2d(std::vector<std::vector<double> > &, int , std::string , std::vector<std::vector<double> > &, std::vector<double> &) ;
  33. // void* idwt_2d(std::vector<std::vector<double> > &,std::vector<double> &, std::string ,std::vector<std::vector<double> > &);
  34. void* dyadic_zpad_2d(std::vector<std::vector<double>>& signal, std::vector<std::vector<double>>& mod);
  35. void* dwt_output_dim(std::vector<std::vector<double>>& signal, int& r, int& c);
  36. void* zero_remove(std::vector<std::vector<double>>& input, std::vector<std::vector<double>>& output);
  37. void* getcoeff2d(std::vector<std::vector<double>>& dwtoutput, std::vector<std::vector<double>>& cH, std::vector<std::vector<double>>& cV,
  38. std::vector<std::vector<double>>& cD, std::vector<double>& flag, int& n);
  39. void* idwt2(const std::string& name, std::vector<std::vector<double>>& signal, std::vector<std::vector<double>>& cLL, std::vector<std::vector<double>>& cLH,
  40. std::vector<std::vector<double>>& cHL, std::vector<std::vector<double>>& cHH);
  41. void* dwt2(const std::string& name, std::vector<std::vector<double>>& signal, std::vector<std::vector<double>>& cLL, std::vector<std::vector<double>>& cLH,
  42. std::vector<std::vector<double>>& cHL, std::vector<std::vector<double>>& cHH);
  43. void* downsamp2(std::vector<std::vector<double>>& vec1, std::vector<std::vector<double>>& vec2, int rowsDn, int colsDn);
  44. void* upsamp2(std::vector<std::vector<double>>& vec1, std::vector<std::vector<double>>& vec2, int rowsUp, int colsUp);
  45. // 2D DWT (Symmetric Extension) Functions
  46. void* dwt_2d_sym(std::vector<std::vector<double>>& origsig, int J, const std::string& nm, std::vector<double>& dwtOutput, std::vector<double>& flag,
  47. std::vector<size_t>& length);
  48. void* dwt2_sym(const std::string& name, std::vector<std::vector<double>>& signal, std::vector<std::vector<double>>& cLL, std::vector<std::vector<double>>& cLH,
  49. std::vector<std::vector<double>>& cHL, std::vector<std::vector<double>>& cHH);
  50. void* idwt_2d_sym(std::vector<double>& dwtop, std::vector<double>& flag, const std::string& nm, std::vector<std::vector<double>>& idwtOutput,
  51. std::vector<size_t>& length);
  52. void* circshift2d(std::vector<std::vector<double>>& signal, int x, int y);
  53. void symm_ext2d(std::vector<std::vector<double>>& signal, std::vector<std::vector<double>>& temp2, int a);
  54. void* dispDWT(std::vector<double>& output, std::vector<std::vector<double>>& dwtdisp, std::vector<size_t>& length, std::vector<size_t>& length2, int J);
  55. //2D Stationary Wavelet Transform
  56. void* swt_2d(std::vector<std::vector<double>>& sig, int J, const std::string& nm, std::vector<double>& swtOutput);
  57. void* per_ext2d(std::vector<std::vector<double>>& signal, std::vector<std::vector<double>>& temp2, int a);
  58. // FFT functions
  59. double convfft(std::vector<double>& a, std::vector<double>& b, std::vector<double>& c);
  60. double convfftm(std::vector<double>& a, std::vector<double>& b, std::vector<double>& c);
  61. void* fft(std::vector<std::complex<double>>& data, int sign, size_t n);
  62. void* bitreverse(std::vector<std::complex<double>>& sig);
  63. void* freq(std::vector<double>& sig, std::vector<double>& freqResp);
  64. //New
  65. void* dwt1_sym_m(const std::string& wname, std::vector<double>& signal, std::vector<double>& cA, std::vector<double>& cD);//FFTW3 for 2D
  66. void* idwt1_sym_m(const std::string& wname, std::vector<double>& x, std::vector<double>& app, std::vector<double>& detail);
  67. void* dwt(std::vector<double>& sig, int j, const std::string& nm, std::vector<double>& dwtOutput, std::vector<double>& flag, std::vector<size_t>& length);
  68. void* idwt(std::vector<double>& dwtop, std::vector<double>& flag, const std::string& nm, std::vector<double>& idwtOutput, std::vector<size_t>& length);
  69. void* dwt_2d(std::vector<std::vector<double>>& origsig, int J, const std::string& nm, std::vector<double>& dwtOutput, std::vector<double>& flag,
  70. std::vector<size_t>& length);
  71. void* dwt1_m(const std::string& wname, std::vector<double>& signal, std::vector<double>& cA, std::vector<double>& cD);
  72. void* idwt_2d(std::vector<double>& dwtop, std::vector<double>& flag, const std::string& nm, std::vector<std::vector<double>>& idwtOutput,
  73. std::vector<size_t>& length);
  74. void* idwt1_m(const std::string& wname, std::vector<double>& x, std::vector<double>& cA, std::vector<double>& cD);
  75. void* dwt_output_dim2(std::vector<size_t>& length, std::vector<size_t>& length2, int j);
  76. #endif