From b1b09c4bdecd36d73ec976cd6244fd99914a5313 Mon Sep 17 00:00:00 2001 From: Steven Robertson Date: Fri, 6 Apr 2012 21:08:44 -0700 Subject: [PATCH] Fix filter width/offset in density blur. Fun fact: static initializers of the wrong length are filled with zeros or whatever. Thanks, C! (This fixes some of the anisotropy which you can kinda see all over the place with the bugged filtering. Very subtle but still important to fix.) --- cuburn/code/filters.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cuburn/code/filters.py b/cuburn/code/filters.py index ae2d44f..f35c0d5 100644 --- a/cuburn/code/filters.py +++ b/cuburn/code/filters.py @@ -72,7 +72,7 @@ fma_buf(float4 *dst, const float4 *src, int astride, float scale) { denblurlib = devlib(decls=''' texture blur_src; -__constant__ float gauss_coefs[9] = { +__constant__ float gauss_coefs[7] = { 0.00443305f, 0.05400558f, 0.24203623f, 0.39905028f, 0.24203623f, 0.05400558f, 0.00443305f }; @@ -88,8 +88,8 @@ __global__ void den_blur(float *dst, int pattern, int upsample) { float den = 0.0f; #pragma unroll - for (int i = 0; i < 9; i++) - den += tex_shear(bilateral_src, pattern, x, y, (i - 4) << upsample).w + for (int i = 0; i < 7; i++) + den += tex_shear(bilateral_src, pattern, x, y, (i - 3) << upsample).w * gauss_coefs[i]; dst[yi * (blockDim.x * gridDim.x) + xi] = den; } @@ -103,8 +103,8 @@ __global__ void den_blur_1c(float *dst, int pattern, int upsample) { float den = 0.0f; #pragma unroll - for (int i = 0; i < 9; i++) - den += tex_shear(blur_src, pattern, x, y, (i - 4) << upsample) + for (int i = 0; i < 7; i++) + den += tex_shear(blur_src, pattern, x, y, (i - 3) << upsample) * gauss_coefs[i]; dst[yi * (blockDim.x * gridDim.x) + xi] = den; }