123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- #pragma once
- #include <Mathematics/Math.h>
- namespace WwiseGTE
- {
-
-
-
- template <typename T>
- class FastGaussianBlur1
- {
- public:
- void Execute(int xBound, T const* input, T* output,
- double scale, double logBase)
- {
- int xBoundM1 = xBound - 1;
- for (int x = 0; x < xBound; ++x)
- {
- double rxps = static_cast<double>(x) + scale;
- double rxms = static_cast<double>(x) - scale;
- int xp1 = static_cast<int>(std::floor(rxps));
- int xm1 = static_cast<int>(std::ceil(rxms));
- double center = static_cast<double>(input[x]);
- double xsum = -2.0 * center;
- if (xp1 >= xBoundM1)
- {
- xsum += static_cast<double>(input[xBoundM1]);
- }
- else
- {
- double imgXp1 = static_cast<double>(input[xp1]);
- double imgXp2 = static_cast<double>(input[xp1 + 1]);
- double delta = rxps - static_cast<double>(xp1);
- xsum += imgXp1 + delta * (imgXp2 - imgXp1);
- }
- if (xm1 <= 0)
- {
- xsum += static_cast<double>(input[0]);
- }
- else
- {
- double imgXm1 = static_cast<double>(input[xm1]);
- double imgXm2 = static_cast<double>(input[xm1 - 1]);
- double delta = rxms - static_cast<double>(xm1);
- xsum += imgXm1 + delta * (imgXm1 - imgXm2);
- }
- output[x] = static_cast<T>(center + logBase * xsum);
- }
- }
- };
- }
|