]> git.sesse.net Git - movit/commitdiff
Drop the 8-way symmetry; it causes bugs due to normalized texture coordinates.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 10 Oct 2012 22:52:09 +0000 (00:52 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 10 Oct 2012 22:52:09 +0000 (00:52 +0200)
deconvolution_sharpen_effect.cpp
deconvolution_sharpen_effect.frag

index d9d54aa0a30d4dcfe1718659a1aecdbab754019e..ab28eb387d980ec8923ec150b1f3903e04e85f10 100644 (file)
@@ -372,8 +372,7 @@ void DeconvolutionSharpenEffect::update_deconvolution_kernel()
        //   (G+H)     x0 + I x2     = y2
        //
        // This both increases accuracy and provides us with a very nice speed
-       // boost. We could have gone even further and went for 8-way symmetry
-       // like the shader does, but this is good enough right now.
+       // boost.
        MatrixXf M(MatrixXf::Zero((R + 1) * (R + 1), (R + 1) * (R + 1)));
        MatrixXf r_uv_flattened(MatrixXf::Zero((R + 1) * (R + 1), 1));
        for (int outer_i = 0; outer_i < 2 * R + 1; ++outer_i) {
@@ -438,7 +437,6 @@ void DeconvolutionSharpenEffect::set_gl_state(GLuint glsl_program_num, const std
                update_deconvolution_kernel();
        }
        // Now encode it as uniforms, and pass it on to the shader.
-       // (Actually the shader only uses about half of the elements.)
        float samples[4 * (R + 1) * (R + 1)];
        for (int y = 0; y <= R; ++y) {
                for (int x = 0; x <= R; ++x) {
index 62a8d6d6c79365f7cc647e689e38c9bb2dbee9df..90ca3c1efd967df06a1656bf6c22aeebb19bf0d1 100644 (file)
@@ -3,19 +3,20 @@ uniform vec4 PREFIX(samples)[(R + 1) * (R + 1)];
 vec4 FUNCNAME(vec2 tc) {
        // The full matrix has five different symmetry cases, that look like this:
        //
-       // D * * C * * D
-       // * D * C * D *
-       // * * D C D * *
+       // D D D C D D D
+       // D D D C D D D
+       // D D D C D D D
        // B B B A B B B
-       // * * D C D * *
-       // * D * C * D *
-       // D * * C * * D
+       // D D D C D D D
+       // D D D C D D D
+       // D D D C D D D
        //
        // We only store the lower-right part of the matrix:
        //
-       // A B B 
-       // C D *
-       // C * D
+       // A B B B 
+       // C D D D
+       // C D D D
+       // C D D D
 
        // Case A: Top-left sample has no symmetry.
        vec4 sum = PREFIX(samples)[0].z * INPUT(tc);
@@ -32,28 +33,16 @@ vec4 FUNCNAME(vec2 tc) {
                sum += sample.z * (INPUT(tc - sample.xy) + INPUT(tc + sample.xy));
        }
 
-       // 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);
-               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.
+       // Case D: All other samples have four-way symmetry.
+       // (Actually we have eight-way, but since we are using normalized
+       // coordinates, we can't just flip x and y.)
        for (int y = 1; y < R; ++y) {
-               for (int x = y + 1; x <= R; ++x) {
+               for (int x = 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);
-                       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;
                }
        }