From de80da39dc9b7b56c180bf27ee6e47779280fa4d Mon Sep 17 00:00:00 2001 From: Paul Wilkins Date: Fri, 19 Apr 2013 15:40:36 +0100 Subject: Mv ref candidates cut to 2. Further simplification of mvref search to return only the top two candidates. Distance weights removed as the test order reflects distance anyway. Change-Id: I0518cab7280258fec2058670add4f853fab7b855 --- vp9/common/vp9_blockd.h | 2 +- vp9/common/vp9_findnearmv.c | 2 -- vp9/common/vp9_findnearmv.h | 2 -- vp9/common/vp9_mvref_common.c | 52 +++++++++++++------------------------------ 4 files changed, 16 insertions(+), 42 deletions(-) (limited to 'vp9/common') diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h index a2a136d8a..e8c823a59 100644 --- a/vp9/common/vp9_blockd.h +++ b/vp9/common/vp9_blockd.h @@ -41,7 +41,7 @@ #define SEGMENT_DELTADATA 0 #define SEGMENT_ABSDATA 1 #define MAX_MV_REFS 9 -#define MAX_MV_REF_CANDIDATES 4 +#define MAX_MV_REF_CANDIDATES 2 typedef enum { PLANE_TYPE_Y_WITH_DC, diff --git a/vp9/common/vp9_findnearmv.c b/vp9/common/vp9_findnearmv.c index 832e8ddf1..b5a32d9b3 100644 --- a/vp9/common/vp9_findnearmv.c +++ b/vp9/common/vp9_findnearmv.c @@ -39,8 +39,6 @@ vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc, vp9_prob p[4], int context) { } void vp9_find_best_ref_mvs(MACROBLOCKD *xd, - uint8_t *ref_y_buffer, - int ref_y_stride, int_mv *mvlist, int_mv *nearest, int_mv *near) { diff --git a/vp9/common/vp9_findnearmv.h b/vp9/common/vp9_findnearmv.h index c360c20eb..085454512 100644 --- a/vp9/common/vp9_findnearmv.h +++ b/vp9/common/vp9_findnearmv.h @@ -24,8 +24,6 @@ // above and a number cols of pixels in the left to select the one with best // score to use as ref motion vector void vp9_find_best_ref_mvs(MACROBLOCKD *xd, - uint8_t *ref_y_buffer, - int ref_y_stride, int_mv *mvlist, int_mv *nearest, int_mv *near); diff --git a/vp9/common/vp9_mvref_common.c b/vp9/common/vp9_mvref_common.c index d8ac68829..fa4158f84 100644 --- a/vp9/common/vp9_mvref_common.c +++ b/vp9/common/vp9_mvref_common.c @@ -17,28 +17,16 @@ static int mb_mv_ref_search[MVREF_NEIGHBOURS][2] = { {-2, 0}, {-1, -2}, {-2, -1}, {-2, -2} }; -static int mb_ref_distance_weight[MVREF_NEIGHBOURS] = - { 3, 3, 2, 1, 1, 1, 1, 1 }; - static int sb_mv_ref_search[MVREF_NEIGHBOURS][2] = { {0, -1}, {-1, 0}, {1, -1}, {-1, 1}, {-1, -1}, {0, -2}, {-2, 0}, {-1, -2} }; -static int sb_ref_distance_weight[MVREF_NEIGHBOURS] = - { 3, 3, 2, 2, 2, 1, 1, 1 }; - - - static int sb64_mv_ref_search[MVREF_NEIGHBOURS][2] = { {0, -1}, {-1, 0}, {1, -1}, {-1, 1}, {2, -1}, {-1, 2}, {3, -1}, {-1,-1} }; -static int sb64_ref_distance_weight[MVREF_NEIGHBOURS] = - { 1, 1, 1, 1, 1, 1, 1, 1 }; - - // clamp_mv_ref #define MV_BORDER (16 << 3) // Allow 16 pels in 1/8th pel units @@ -164,7 +152,6 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here, int i; MODE_INFO *candidate_mi; MB_MODE_INFO * mbmi = &xd->mode_info_context->mbmi; - int_mv candidate_mvs[MAX_MV_REF_CANDIDATES]; int_mv c_refmv; int_mv c2_refmv; MV_REFERENCE_FRAME c_ref_frame; @@ -173,23 +160,17 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here, int refmv_count = 0; int split_count = 0; int (*mv_ref_search)[2]; - int *ref_distance_weight; const int mb_col = (-xd->mb_to_left_edge) >> 7; - // Blank the reference vector lists and other local structures. vpx_memset(mv_ref_list, 0, sizeof(int_mv) * MAX_MV_REF_CANDIDATES); - vpx_memset(candidate_mvs, 0, sizeof(int_mv) * MAX_MV_REF_CANDIDATES); vpx_memset(candidate_scores, 0, sizeof(candidate_scores)); if (mbmi->sb_type == BLOCK_SIZE_SB64X64) { mv_ref_search = sb64_mv_ref_search; - ref_distance_weight = sb64_ref_distance_weight; } else if (mbmi->sb_type >= BLOCK_SIZE_SB32X32) { mv_ref_search = sb_mv_ref_search; - ref_distance_weight = sb_ref_distance_weight; } else { mv_ref_search = mb_mv_ref_search; - ref_distance_weight = mb_ref_distance_weight; } // We first scan for candidate vectors that match the current reference frame @@ -205,8 +186,8 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here, (mv_ref_search[i][1] * xd->mode_info_stride); if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv)) { - add_candidate_mv(candidate_mvs, candidate_scores, - &refmv_count, c_refmv, ref_distance_weight[i] + 16); + add_candidate_mv(mv_ref_list, candidate_scores, + &refmv_count, c_refmv, 16); } split_count += (candidate_mi->mbmi.mode == SPLITMV); } @@ -224,8 +205,8 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here, (mv_ref_search[i][1] * xd->mode_info_stride); if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv)) { - add_candidate_mv(candidate_mvs, candidate_scores, - &refmv_count, c_refmv, ref_distance_weight[i] + 16); + add_candidate_mv(mv_ref_list, candidate_scores, + &refmv_count, c_refmv, 16); } } } @@ -234,8 +215,8 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here, if (lf_here && (refmv_count < MAX_MV_REF_CANDIDATES)) { candidate_mi = lf_here; if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv)) { - add_candidate_mv(candidate_mvs, candidate_scores, - &refmv_count, c_refmv, 17); + add_candidate_mv(mv_ref_list, candidate_scores, + &refmv_count, c_refmv, 16); } } @@ -259,14 +240,14 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here, if (c_ref_frame != INTRA_FRAME) { scale_mv(xd, ref_frame, c_ref_frame, &c_refmv, ref_sign_bias); - add_candidate_mv(candidate_mvs, candidate_scores, - &refmv_count, c_refmv, ref_distance_weight[i]); + add_candidate_mv(mv_ref_list, candidate_scores, + &refmv_count, c_refmv, 1); } if (c2_ref_frame != INTRA_FRAME) { scale_mv(xd, ref_frame, c2_ref_frame, &c2_refmv, ref_sign_bias); - add_candidate_mv(candidate_mvs, candidate_scores, - &refmv_count, c2_refmv, ref_distance_weight[i]); + add_candidate_mv(mv_ref_list, candidate_scores, + &refmv_count, c2_refmv, 1); } } } @@ -280,20 +261,20 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here, if (c_ref_frame != INTRA_FRAME) { scale_mv(xd, ref_frame, c_ref_frame, &c_refmv, ref_sign_bias); - add_candidate_mv(candidate_mvs, candidate_scores, + add_candidate_mv(mv_ref_list, candidate_scores, &refmv_count, c_refmv, 1); } if (c2_ref_frame != INTRA_FRAME) { scale_mv(xd, ref_frame, c2_ref_frame, &c2_refmv, ref_sign_bias); - add_candidate_mv(candidate_mvs, candidate_scores, + add_candidate_mv(mv_ref_list, candidate_scores, &refmv_count, c2_refmv, 1); } } // Define inter mode coding context. // 0,0 was best - if (candidate_mvs[0].as_int == 0) { + if (mv_ref_list[0].as_int == 0) { // 0,0 is only candidate if (refmv_count <= 1) { mbmi->mb_mode_context[ref_frame] = 0; @@ -311,11 +292,8 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here, mbmi->mb_mode_context[ref_frame] = candidate_scores[0] >= 16 ? 5 : 6; } - // Scan for 0,0 case and clamp non zero choices + // Clamp vectors for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) { - clamp_mv_ref(xd, &candidate_mvs[i]); + clamp_mv_ref(xd, &mv_ref_list[i]); } - - // Copy over the candidate list. - vpx_memcpy(mv_ref_list, candidate_mvs, sizeof(candidate_mvs)); } -- cgit v1.2.3