From 7d354cb7314933332f32c1fc9ddb5c3b4ebca066 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Mon, 23 Jul 2018 20:16:29 +0200 Subject: [PATCH] Change the discard condition for motion search. --- motion_search.frag | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/motion_search.frag b/motion_search.frag index 490db33..d407c0d 100644 --- a/motion_search.frag +++ b/motion_search.frag @@ -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) || -- 2.39.2