]> git.sesse.net Git - nageru/commitdiff
Change the discard condition for motion search.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 23 Jul 2018 18:16:29 +0000 (20:16 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 23 Jul 2018 18:16:29 +0000 (20:16 +0200)
motion_search.frag

index 490db331a40ef77f2efe26e62f5894de04790d33..d407c0d7ea2a2a29889f5a4b5075d7286c0b0528 100644 (file)
@@ -132,10 +132,14 @@ void main()
                u -= H_inv * du;
        }
 
-       // Reject if we moved too far. Also reject if the patch goes out-of-bounds
-       // (the paper does not mention this, but the code does, and it seems to be
-       // critical to avoid really bad behavior at the edges).
-       if (length(u - initial_u) > patch_size ||
+       // Reject if we moved too far. Note that the paper says “too far” is the
+       // patch size, but the DIS code uses half of a patch size. The latter seems
+       // to give much better overall results.
+       //
+       // Also reject if the patch goes out-of-bounds (the paper does not mention this,
+       // but the code does, and it seems to be critical to avoid really bad behavior
+       // at the edges).
+       if (length(u - initial_u) > (patch_size * 0.5f) ||
            u.x < -(patch_size * 0.5f) ||
            image_size.x - u.x < -(patch_size * 0.5f) ||
            u.y < -(patch_size * 0.5f) ||