From 8b2f57d0b8da5a51e4579da6baa3e7bf4ea40b5b Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Mon, 6 Aug 2012 10:51:20 -0700 Subject: a new way of determining reference motion vector Using surrounding reconstructed pixels from left and above to select best matching mv to use as reference motion vector for mv encoding. Test results: AVGPSNR GLBPSNR VPXSSIM Derf: 1.107% 1.062% 0.992% Std-hd:1.209% 1.176% 1.029% Change-Id: I8f10e09ee6538c05df2fb9f069abcaf1edb3fca6 --- vp8/common/findnearmv.h | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) (limited to 'vp8/common/findnearmv.h') diff --git a/vp8/common/findnearmv.h b/vp8/common/findnearmv.h index d4769e608..3bb2024c2 100644 --- a/vp8/common/findnearmv.h +++ b/vp8/common/findnearmv.h @@ -33,20 +33,14 @@ static void mv_bias(int refmb_ref_frame_sign_bias, int refframe, int_mv *mvp, co #define LEFT_TOP_MARGIN (16 << 3) #define RIGHT_BOTTOM_MARGIN (16 << 3) -static void vp8_clamp_mv2(int_mv *mv, const MACROBLOCKD *xd) { - if (mv->as_mv.col < (xd->mb_to_left_edge - LEFT_TOP_MARGIN)) - mv->as_mv.col = xd->mb_to_left_edge - LEFT_TOP_MARGIN; - else if (mv->as_mv.col > xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN) - mv->as_mv.col = xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN; - - if (mv->as_mv.row < (xd->mb_to_top_edge - LEFT_TOP_MARGIN)) - mv->as_mv.row = xd->mb_to_top_edge - LEFT_TOP_MARGIN; - else if (mv->as_mv.row > xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN) - mv->as_mv.row = xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN; -} -static void vp8_clamp_mv(int_mv *mv, int mb_to_left_edge, int mb_to_right_edge, - int mb_to_top_edge, int mb_to_bottom_edge) { + + +static void vp8_clamp_mv(int_mv *mv, + int mb_to_left_edge, + int mb_to_right_edge, + int mb_to_top_edge, + int mb_to_bottom_edge) { mv->as_mv.col = (mv->as_mv.col < mb_to_left_edge) ? mb_to_left_edge : mv->as_mv.col; mv->as_mv.col = (mv->as_mv.col > mb_to_right_edge) ? @@ -56,15 +50,26 @@ static void vp8_clamp_mv(int_mv *mv, int mb_to_left_edge, int mb_to_right_edge, mv->as_mv.row = (mv->as_mv.row > mb_to_bottom_edge) ? mb_to_bottom_edge : mv->as_mv.row; } -static unsigned int vp8_check_mv_bounds(int_mv *mv, int mb_to_left_edge, - int mb_to_right_edge, int mb_to_top_edge, + +static void vp8_clamp_mv2(int_mv *mv, const MACROBLOCKD *xd) { + vp8_clamp_mv(mv, + xd->mb_to_left_edge - LEFT_TOP_MARGIN, + xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN, + xd->mb_to_top_edge - LEFT_TOP_MARGIN, + xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN); +} + + + +static unsigned int vp8_check_mv_bounds(int_mv *mv, + int mb_to_left_edge, + int mb_to_right_edge, + int mb_to_top_edge, int mb_to_bottom_edge) { - unsigned int need_to_clamp; - need_to_clamp = (mv->as_mv.col < mb_to_left_edge) ? 1 : 0; - need_to_clamp |= (mv->as_mv.col > mb_to_right_edge) ? 1 : 0; - need_to_clamp |= (mv->as_mv.row < mb_to_top_edge) ? 1 : 0; - need_to_clamp |= (mv->as_mv.row > mb_to_bottom_edge) ? 1 : 0; - return need_to_clamp; + return (mv->as_mv.col < mb_to_left_edge) || + (mv->as_mv.col > mb_to_right_edge) || + (mv->as_mv.row < mb_to_top_edge) || + (mv->as_mv.row > mb_to_bottom_edge); } void vp8_find_near_mvs -- cgit v1.2.3