From 20cf22a1289c01cc44ac948103fa4755293f9df3 Mon Sep 17 00:00:00 2001 From: Jingning Han Date: Tue, 21 Jan 2014 11:40:33 -0800 Subject: [PATCH] Enforce effective motion vector search range This commit explicitly enforces the effective motion vector range in the motion search stage. The range needs to be the intersection of UMV border, effective absolute motion vector value range, and the target search area. Change-Id: I1cf7c563e02b1086040dad6c1f4f6be1538635a6 --- vp9/encoder/vp9_mcomp.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c index 88d527a22..8b3da0e0b 100644 --- a/vp9/encoder/vp9_mcomp.c +++ b/vp9/encoder/vp9_mcomp.c @@ -24,10 +24,15 @@ // #define NEW_DIAMOND_SEARCH void vp9_set_mv_search_range(MACROBLOCK *x, const MV *mv) { - const int col_min = (mv->col >> 3) - MAX_FULL_PEL_VAL + (mv->col & 7 ? 1 : 0); - const int row_min = (mv->row >> 3) - MAX_FULL_PEL_VAL + (mv->row & 7 ? 1 : 0); - const int col_max = (mv->col >> 3) + MAX_FULL_PEL_VAL; - const int row_max = (mv->row >> 3) + MAX_FULL_PEL_VAL; + int col_min = (mv->col >> 3) - MAX_FULL_PEL_VAL + (mv->col & 7 ? 1 : 0); + int row_min = (mv->row >> 3) - MAX_FULL_PEL_VAL + (mv->row & 7 ? 1 : 0); + int col_max = (mv->col >> 3) + MAX_FULL_PEL_VAL; + int row_max = (mv->row >> 3) + MAX_FULL_PEL_VAL; + + col_min = MAX(col_min, (MV_LOW >> 3) + 1); + row_min = MAX(row_min, (MV_LOW >> 3) + 1); + col_max = MIN(col_max, (MV_UPP >> 3) - 1); + row_max = MIN(row_max, (MV_UPP >> 3) - 1); // Get intersection of UMV window and valid MV window to reduce # of checks // in diamond search. -- 2.40.0