From 0cd4520774e24d8e30a6a2ddbfd574638df23f38 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Sat, 28 Apr 2018 12:45:23 +0200 Subject: [PATCH] util-math: Bilateral Blur --- source/util-math.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/util-math.h b/source/util-math.h index d8709948..f86ad7f2 100644 --- a/source/util-math.h +++ b/source/util-math.h @@ -40,6 +40,13 @@ inline double_t Gaussian1D(double_t x, double_t o) { return a * b; } +inline double_t Bilateral1D(double_t x, double_t o) { + double_t c = (x / 0); + double_t d = c * c; + double_t b = exp(-0.5 * d) / o; + return 0.39894 * b; // Seems to be (1.0 / (1 * PI2_SQROOT)) * b, otherwise no difference from Gaussian Blur +} + inline size_t GetNearestPowerOfTwoAbove(size_t v) { return 1ull << size_t(ceil(log10(double(v)) / log10(2.0))); }