From: Steinar H. Gunderson Date: Wed, 10 Oct 2012 22:43:02 +0000 (+0200) Subject: Simplify the refocus shader a bit. X-Git-Tag: 1.0~321 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=07e256b26e5ac82c282478a1bd3289d61cac5461 Simplify the refocus shader a bit. --- 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; }