From 24265e884eb640748821233e94e502a6657eafb8 Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Tue, 30 Oct 2012 09:43:24 -0700 Subject: [PATCH] Separated experiment for subpel refmv selection As suggested by Paul, this commit separate the subpel refmv selection into a separate experiment. It also changed a couple variable names to better reflect the nature of the variables. Change-Id: Id951c3cadc61a982dd15afe641000f60213b8995 --- configure | 1 + vp8/common/findnearmv.c | 48 ++++++++++++++++++++++++++++++----------- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/configure b/configure index 94c978163..05c54a3e4 100755 --- a/configure +++ b/configure @@ -222,6 +222,7 @@ EXPERIMENT_LIST=" pred_filter lossless newbestrefmv + subpelrefmv new_mvref implicit_segmentation " diff --git a/vp8/common/findnearmv.c b/vp8/common/findnearmv.c index 3f1a451eb..cf10a261e 100644 --- a/vp8/common/findnearmv.c +++ b/vp8/common/findnearmv.c @@ -202,9 +202,9 @@ void vp8_find_best_ref_mvs(MACROBLOCKD *xd, unsigned char *left_src; unsigned char *above_ref; unsigned char *left_ref; - int sad; + int score; int sse; - int sad_scores[MAX_MV_REFS] = {0}; + int ref_scores[MAX_MV_REFS] = {0}; int_mv sorted_mvs[MAX_MV_REFS]; int zero_seen = FALSE; @@ -212,10 +212,17 @@ void vp8_find_best_ref_mvs(MACROBLOCKD *xd, best_mv->as_int = nearest->as_int = near->as_int = 0; vpx_memset(sorted_mvs, 0, sizeof(sorted_mvs)); +#if CONFIG_SUBPELREFMV above_src = xd->dst.y_buffer - xd->dst.y_stride * 2; left_src = xd->dst.y_buffer - 2; above_ref = ref_y_buffer - ref_y_stride * 2; left_ref = ref_y_buffer - 2; +#else + above_src = xd->dst.y_buffer - xd->dst.y_stride * 3; + left_src = xd->dst.y_buffer - 3; + above_ref = ref_y_buffer - ref_y_stride * 3; + left_ref = ref_y_buffer - 3; +#endif //for(i = 0; i < MAX_MV_REFS; ++i) { // Limit search to the predicted best 4 @@ -234,37 +241,52 @@ void vp8_find_best_ref_mvs(MACROBLOCKD *xd, zero_seen = zero_seen || !this_mv.as_int; vp8_clamp_mv(&this_mv, - xd->mb_to_left_edge - LEFT_TOP_MARGIN + 16, + xd->mb_to_left_edge - LEFT_TOP_MARGIN + 24, xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN, - xd->mb_to_top_edge - LEFT_TOP_MARGIN + 16, + xd->mb_to_top_edge - LEFT_TOP_MARGIN + 24, xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN); - +#if CONFIG_SUBPELREFMV row_offset = this_mv.as_mv.row >> 3; col_offset = this_mv.as_mv.col >> 3; offset = ref_y_stride * row_offset + col_offset; - - sad = 0; + score = 0; if (xd->up_available) { vp8_sub_pixel_variance16x2_c(above_ref + offset, ref_y_stride, SP(this_mv.as_mv.col), SP(this_mv.as_mv.row), above_src, xd->dst.y_stride, &sse); - sad += sse; + score += sse; } if (xd->left_available) { vp8_sub_pixel_variance2x16_c(left_ref + offset, ref_y_stride, SP(this_mv.as_mv.col), SP(this_mv.as_mv.row), left_src, xd->dst.y_stride, &sse); - sad += sse; + score += sse; } +#else + row_offset = (this_mv.as_mv.row > 0) ? + ((this_mv.as_mv.row + 3) >> 3):((this_mv.as_mv.row + 4) >> 3); + col_offset = (this_mv.as_mv.col > 0) ? + ((this_mv.as_mv.col + 3) >> 3):((this_mv.as_mv.col + 4) >> 3); + offset = ref_y_stride * row_offset + col_offset; + score = 0; + if (xd->up_available) { + score += vp8_sad16x3(above_src, xd->dst.y_stride, + above_ref + offset, ref_y_stride, INT_MAX); + } + if (xd->left_available) { + score += vp8_sad3x16(left_src, xd->dst.y_stride, + left_ref + offset, ref_y_stride, INT_MAX); + } +#endif // Add the entry to our list and then resort the list on score. - sad_scores[i] = sad; + ref_scores[i] = score; sorted_mvs[i].as_int = this_mv.as_int; j = i; while (j > 0) { - if (sad_scores[j] < sad_scores[j-1]) { - sad_scores[j] = sad_scores[j-1]; + if (ref_scores[j] < ref_scores[j-1]) { + ref_scores[j] = ref_scores[j-1]; sorted_mvs[j].as_int = sorted_mvs[j-1].as_int; - sad_scores[j-1] = sad; + ref_scores[j-1] = score; sorted_mvs[j-1].as_int = this_mv.as_int; j--; } else