CGaussianFilter.cpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. //
  2. // File: CGaussianFilter.cpp
  3. //
  4. // MATLAB Coder version : 4.3
  5. // C/C++ source code generated on : 12-Jan-2022 14:46:32
  6. //
  7. // Include Files
  8. #include "CGaussianFilter.h"
  9. #include "GaussianFilter_data.h"
  10. #include "GaussianFilter_emxutil.h"
  11. #include "conv2AXPY.h"
  12. #include <math.h>
  13. // Function Definitions
  14. //
  15. // Arguments : void
  16. // Return Type : void
  17. //
  18. CGaussianFilter::~CGaussianFilter()
  19. {
  20. omp_destroy_nest_lock(&emlrtNestLockGlobal);
  21. }
  22. //
  23. // Arguments : void
  24. // Return Type : void
  25. //
  26. CGaussianFilter::CGaussianFilter()
  27. {
  28. omp_init_nest_lock(&emlrtNestLockGlobal);
  29. }
  30. //
  31. // Arguments : const emxArray_real_T *x
  32. // emxArray_real_T *xlpf
  33. // Return Type : void
  34. //
  35. void CGaussianFilter::GaussianFilter(const emxArray_real_T *x, emxArray_real_T
  36. *xlpf)
  37. {
  38. emxArray_real_T *work;
  39. int32_T rank;
  40. int32_T k;
  41. static const real_T s[25] = { 0.22354978351691851, 0.0, 0.0, 0.0, 0.0, 0.0,
  42. 3.1892324657149476E-17, 0.0, 0.0, 0.0, 0.0, 0.0, 8.1422304240527224E-18, 0.0,
  43. 0.0, 0.0, 0.0, 0.0, 6.5350494864904178E-19, 0.0, 0.0, 0.0, 0.0, 0.0,
  44. 2.4277338668394078E-34 };
  45. int32_T nb;
  46. int32_T i;
  47. int32_T u1;
  48. int32_T jlo;
  49. int32_T ix;
  50. static const real_T hrow[5] = { 0.1200783842432135, 0.23388075658535037,
  51. 0.29208171834287255, 0.23388075658535035, 0.1200783842432135 };
  52. emxInit_real_T(&work, 2);
  53. if (25 <= x->size[1]) {
  54. frexp(2.4277338668394078E-34, &rank);
  55. rank = 0;
  56. for (k = 0; k < 5; k++) {
  57. if (s[k + 5 * k] > 2.1382117680737565E-49) {
  58. rank++;
  59. }
  60. }
  61. if (rank == 1) {
  62. nb = x->size[1];
  63. i = work->size[0] * work->size[1];
  64. work->size[0] = 1;
  65. work->size[1] = x->size[1];
  66. emxEnsureCapacity_real_T(work, i);
  67. rank = x->size[1];
  68. for (i = 0; i < rank; i++) {
  69. work->data[i] = 0.0;
  70. }
  71. i = xlpf->size[0] * xlpf->size[1];
  72. xlpf->size[0] = 1;
  73. xlpf->size[1] = x->size[1];
  74. emxEnsureCapacity_real_T(xlpf, i);
  75. rank = x->size[1];
  76. for (i = 0; i < rank; i++) {
  77. xlpf->data[i] = 0.0;
  78. }
  79. for (rank = 0; rank < nb; rank++) {
  80. work->data[rank] += 0.29208171834287244 * x->data[rank];
  81. }
  82. u1 = x->size[1] + 2;
  83. if (5 < u1) {
  84. u1 = 5;
  85. }
  86. for (k = 1; k <= u1; k++) {
  87. if (k - 2 > 0) {
  88. jlo = k - 3;
  89. } else {
  90. jlo = 0;
  91. }
  92. rank = (nb + k) - 3;
  93. if (rank > nb) {
  94. rank = nb;
  95. }
  96. rank -= jlo;
  97. if (rank >= 1) {
  98. ix = (jlo - k) + 3;
  99. i = rank - 1;
  100. for (rank = 0; rank <= i; rank++) {
  101. xlpf->data[jlo] += hrow[k - 1] * work->data[ix];
  102. ix++;
  103. jlo++;
  104. }
  105. }
  106. }
  107. } else {
  108. conv2AXPYSameCMP(x, xlpf);
  109. }
  110. } else {
  111. conv2AXPYSameCMP(x, xlpf);
  112. }
  113. emxFree_real_T(&work);
  114. }
  115. void CGaussianFilter::SetPdoa1dEnable(bool bEnable)
  116. {
  117. s_enabled_pdoa1d = bEnable;
  118. }
  119. bool CGaussianFilter::GetPdoa1dEnable()
  120. {
  121. return s_enabled_pdoa1d;
  122. }
  123. void CGaussianFilter::SetPdoa1dDist(double dist)
  124. {
  125. s_pdoa1d_act_dist = dist;
  126. }
  127. double CGaussianFilter::GetPdoa1dDist()
  128. {
  129. return 25;
  130. //return s_pdoa1d_act_dist;
  131. }
  132. bool CGaussianFilter::s_enabled_pdoa1d = false;
  133. double CGaussianFilter::s_pdoa1d_act_dist = 0.0;
  134. //
  135. // File trailer for CGaussianFilter.cpp
  136. //
  137. // [EOF]
  138. //