From 07e256b26e5ac82c282478a1bd3289d61cac5461 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Thu, 11 Oct 2012 00:43:02 +0200 Subject: [PATCH] Simplify the refocus shader a bit. --- deconvolution_sharpen_effect.frag | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/deconvolution_sharpen_effect.frag b/deconvolution_sharpen_effect.frag index 7b90ac7..62a8d6d 100644 --- a/deconvolution_sharpen_effect.frag +++ b/deconvolution_sharpen_effect.frag @@ -35,28 +35,24 @@ vec4 FUNCNAME(vec2 tc) { // Case D: Diagonal samples have four-way symmetry. for (int xy = 1; xy <= R; ++xy) { vec4 sample = PREFIX(samples)[xy * (R + 1) + xy]; + vec2 mirror_sample = vec2(sample.x, -sample.y); vec4 local_sum = INPUT(tc - sample.xy) + INPUT(tc + sample.xy); - sample.y = -sample.y; - local_sum += INPUT(tc - sample.xy) + INPUT(tc + sample.xy); + local_sum += INPUT(tc - mirror_sample.xy) + INPUT(tc + mirror_sample.xy); sum += sample.z * local_sum; } // Case *: All other samples have eight-way symmetry. - for (int y = 1; y <= R; ++y) { + for (int y = 1; y < R; ++y) { for (int x = y + 1; x <= R; ++x) { vec4 sample = PREFIX(samples)[y * (R + 1) + x]; vec2 mirror_sample = vec2(sample.x, -sample.y); vec4 local_sum = INPUT(tc - sample.xy) + INPUT(tc + sample.xy); local_sum += INPUT(tc - mirror_sample.xy) + INPUT(tc + mirror_sample.xy); - - sample.xy = sample.yx; - mirror_sample.xy = mirror_sample.yx; - - local_sum += INPUT(tc - sample.xy) + INPUT(tc + sample.xy); - local_sum += INPUT(tc - mirror_sample.xy) + INPUT(tc + mirror_sample.xy); + local_sum += INPUT(tc - sample.yx) + INPUT(tc + sample.yx); + local_sum += INPUT(tc - mirror_sample.yx) + INPUT(tc + mirror_sample.yx); sum += sample.z * local_sum; } -- 2.39.2