GaussianBlur2.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // David Eberly, Geometric Tools, Redmond WA 98052
  2. // Copyright (c) 1998-2020
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // https://www.boost.org/LICENSE_1_0.txt
  5. // https://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
  6. // Version: 4.0.2020.01.11
  7. #pragma once
  8. #include <Mathematics/PdeFilter2.h>
  9. namespace WwiseGTE
  10. {
  11. template <typename Real>
  12. class GaussianBlur2 : public PdeFilter2<Real>
  13. {
  14. public:
  15. GaussianBlur2(int xBound, int yBound, Real xSpacing, Real ySpacing,
  16. Real const* data, bool const* mask, Real borderValue,
  17. typename PdeFilter<Real>::ScaleType scaleType)
  18. :
  19. PdeFilter2<Real>(xBound, yBound, xSpacing, ySpacing, data, mask,
  20. borderValue, scaleType)
  21. {
  22. mMaximumTimeStep = (Real)0.5 / (this->mInvDxDx + this->mInvDyDy);
  23. }
  24. virtual ~GaussianBlur2()
  25. {
  26. }
  27. inline Real GetMaximumTimeStep() const
  28. {
  29. return mMaximumTimeStep;
  30. }
  31. protected:
  32. virtual void OnUpdateSingle(int x, int y) override
  33. {
  34. this->LookUp5(x, y);
  35. Real uxx = this->mInvDxDx * (this->mUpz - (Real)2 * this->mUzz + this->mUmz);
  36. Real uyy = this->mInvDyDy * (this->mUzp - (Real)2 * this->mUzz + this->mUzm);
  37. this->mBuffer[this->mDst][y][x] = this->mUzz + this->mTimeStep * (uxx + uyy);
  38. }
  39. Real mMaximumTimeStep;
  40. };
  41. }