From f62b33f140a150470d784b6ff37ef1c5c227212b Mon Sep 17 00:00:00 2001 From: Yunqing Wang Date: Fri, 13 May 2011 10:56:45 -0400 Subject: Modify MVcount in pick_inter_mode to eliminate calling of vp8_find_near_mvs Moved MVcount modification in pick_inter_mode, and eliminated calling of vp8_find_near_mvs. Change-Id: Icd47448a1dfc8fdf526f86757d0e5a7f218cb5e8 --- vp8/encoder/rdopt.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'vp8/encoder/rdopt.c') diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c index 85d617d4e..7ce7378f9 100644 --- a/vp8/encoder/rdopt.c +++ b/vp8/encoder/rdopt.c @@ -1686,6 +1686,28 @@ void vp8_cal_sad(VP8_COMP *cpi, MACROBLOCKD *xd, MACROBLOCK *x, int recon_yoffse } } +static void vp8_rd_update_mvcount(VP8_COMP *cpi, MACROBLOCKD *xd, int_mv *best_ref_mv) +{ + int i; + + if (xd->mode_info_context->mbmi.mode == SPLITMV) + { + for (i = 0; i < 16; i++) + { + if (xd->block[i].bmi.mode == NEW4X4) + { + cpi->MVcount[0][mv_max+((xd->block[i].bmi.mv.as_mv.row - best_ref_mv->as_mv.row) >> 1)]++; + cpi->MVcount[1][mv_max+((xd->block[i].bmi.mv.as_mv.col - best_ref_mv->as_mv.col) >> 1)]++; + } + } + } + else if (xd->mode_info_context->mbmi.mode == NEWMV) + { + cpi->MVcount[0][mv_max+((xd->block[0].bmi.mv.as_mv.row - best_ref_mv->as_mv.row) >> 1)]++; + cpi->MVcount[1][mv_max+((xd->block[0].bmi.mv.as_mv.col - best_ref_mv->as_mv.col) >> 1)]++; + } +} + void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int recon_uvoffset, int *returnrate, int *returndistortion, int *returnintra) { BLOCK *b = &x->block[0]; @@ -2400,4 +2422,6 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int } x->e_mbd.mode_info_context->mbmi.mv.as_mv = x->e_mbd.block[15].bmi.mv.as_mv; + + vp8_rd_update_mvcount(cpi, &x->e_mbd, &frame_best_ref_mv[xd->mode_info_context->mbmi.ref_frame]); } -- cgit v1.2.3 From 9c62f94129fc3ed63fb710009a952afe11456ccd Mon Sep 17 00:00:00 2001 From: Yunqing Wang Date: Wed, 18 May 2011 09:52:56 -0400 Subject: Fix a bug in vp8_clamp_mv function Scott fixed the bug in MV clamping function in encoder, which could cause artifacts. Change-Id: Id05f2794c43c31cdd45e66179c8811f3ee452cb9 --- vp8/encoder/rdopt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'vp8/encoder/rdopt.c') diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c index 7bd2dfbbe..d18bae3fe 100644 --- a/vp8/encoder/rdopt.c +++ b/vp8/encoder/rdopt.c @@ -1878,10 +1878,10 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int /* adjust mvp to make sure it is within MV range */ vp8_clamp_mv(&mvp, - best_ref_mv.as_mv.row - MAX_FULL_PEL_VAL, - best_ref_mv.as_mv.row + MAX_FULL_PEL_VAL, best_ref_mv.as_mv.col - MAX_FULL_PEL_VAL, - best_ref_mv.as_mv.col + MAX_FULL_PEL_VAL); + best_ref_mv.as_mv.col + MAX_FULL_PEL_VAL, + best_ref_mv.as_mv.row - MAX_FULL_PEL_VAL, + best_ref_mv.as_mv.row + MAX_FULL_PEL_VAL); } // Check to see if the testing frequency for this mode is at its max -- cgit v1.2.3