From 52fa10a9a337dcaf2b30839560841ec836a94717 Mon Sep 17 00:00:00 2001 From: Dmitry Kovalev Date: Fri, 22 Nov 2013 15:28:32 -0800 Subject: [PATCH] Cleaning up vp9_append_sub8x8_mvs_for_idx. Change-Id: Ic92f15d82ff5cfa3df655d08e460335c2ef8a325 --- vp9/common/vp9_findnearmv.c | 54 +++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/vp9/common/vp9_findnearmv.c b/vp9/common/vp9_findnearmv.c index b91c50143..66178cd1b 100644 --- a/vp9/common/vp9_findnearmv.c +++ b/vp9/common/vp9_findnearmv.c @@ -36,50 +36,44 @@ void vp9_find_best_ref_mvs(MACROBLOCKD *xd, int allow_hp, void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd, const TileInfo *const tile, - int_mv *dst_nearest, - int_mv *dst_near, + int_mv *dst_nearest, int_mv *dst_near, int block_idx, int ref_idx, int mi_row, int mi_col) { - int_mv dst_list[MAX_MV_REF_CANDIDATES]; int_mv mv_list[MAX_MV_REF_CANDIDATES]; MODE_INFO *const mi = xd->mi_8x8[0]; + b_mode_info *bmi = mi->bmi; + int n; assert(ref_idx == 0 || ref_idx == 1); - assert(MAX_MV_REF_CANDIDATES == 2); // makes code here slightly easier + assert(MAX_MV_REF_CANDIDATES == 2); vp9_find_mv_refs_idx(cm, xd, tile, mi, xd->last_mi, mi->mbmi.ref_frame[ref_idx], mv_list, block_idx, mi_row, mi_col); - dst_list[1].as_int = 0; + dst_near->as_int = 0; if (block_idx == 0) { - vpx_memcpy(dst_list, mv_list, MAX_MV_REF_CANDIDATES * sizeof(int_mv)); + dst_nearest->as_int = mv_list[0].as_int; + dst_near->as_int = mv_list[1].as_int; } else if (block_idx == 1 || block_idx == 2) { - int dst = 0, n; - b_mode_info *bmi = mi->bmi; - - dst_list[dst++].as_int = bmi[0].as_mv[ref_idx].as_int; - for (n = 0; dst < MAX_MV_REF_CANDIDATES && - n < MAX_MV_REF_CANDIDATES; n++) - if (mv_list[n].as_int != dst_list[0].as_int) - dst_list[dst++].as_int = mv_list[n].as_int; + dst_nearest->as_int = bmi[0].as_mv[ref_idx].as_int; + for (n = 0; n < MAX_MV_REF_CANDIDATES; ++n) + if (dst_nearest->as_int != mv_list[n].as_int) { + dst_near->as_int = mv_list[n].as_int; + break; + } } else { - int dst = 0, n; - b_mode_info *bmi = mi->bmi; - + int_mv candidates[2 + MAX_MV_REF_CANDIDATES] = { bmi[1].as_mv[ref_idx], + bmi[0].as_mv[ref_idx], + mv_list[0], + mv_list[1] }; assert(block_idx == 3); - dst_list[dst++].as_int = bmi[2].as_mv[ref_idx].as_int; - if (dst_list[0].as_int != bmi[1].as_mv[ref_idx].as_int) - dst_list[dst++].as_int = bmi[1].as_mv[ref_idx].as_int; - if (dst < MAX_MV_REF_CANDIDATES && - dst_list[0].as_int != bmi[0].as_mv[ref_idx].as_int) - dst_list[dst++].as_int = bmi[0].as_mv[ref_idx].as_int; - for (n = 0; dst < MAX_MV_REF_CANDIDATES && - n < MAX_MV_REF_CANDIDATES; n++) - if (mv_list[n].as_int != dst_list[0].as_int) - dst_list[dst++].as_int = mv_list[n].as_int; + dst_nearest->as_int = bmi[2].as_mv[ref_idx].as_int; + for (n = 0; n < 2 + MAX_MV_REF_CANDIDATES; ++n) { + if (dst_nearest->as_int != candidates[n].as_int) { + dst_near->as_int = candidates[n].as_int; + break; + } + } } - - dst_nearest->as_int = dst_list[0].as_int; - dst_near->as_int = dst_list[1].as_int; } -- 2.40.0