From: Hui Su Date: Wed, 8 Aug 2018 19:11:36 +0000 (-0700) Subject: Use the pred_mv feature for speed 0 X-Git-Tag: v1.8.0~436^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f7148bbddec6a68f5240a99a24ae9cc16ee70fba;p=libvpx Use the pred_mv feature for speed 0 Before this patch, pred_mv is used only when the adaptive_motion_search speed feature is on(speed>=1). This patch enables pred_mv for speed 0 as well. Coding gains: avg_psnr ovr_psnr ssim lowres -0.31% -0.32% -0.38% midres -0.37% -0.41% -0.42% hdres -0.30% -0.31% -0.29% Tested encoding speed over 18 midres sequences with QP=40. The overall speed loss is about 0.6%. Change-Id: I8987e9efb5a70d2bf8779fc2a43838009f9bbd8a --- diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index a172af30b..cb5cb1901 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -3963,7 +3963,7 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td, } // store estimated motion vector - if (cpi->sf.adaptive_motion_search) store_pred_mv(x, ctx); + store_pred_mv(x, ctx); // If the interp_filter is marked as SWITCHABLE_FILTERS, it was for an // intra block and used for context purposes. @@ -3978,7 +3978,7 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td, // the starting point of motion search in the following partition type check. if (do_split || must_split) { subsize = get_subsize(bsize, PARTITION_SPLIT); - if (cpi->sf.adaptive_motion_search) load_pred_mv(x, ctx); + load_pred_mv(x, ctx); if (bsize == BLOCK_8X8) { i = 4; if (cpi->sf.adaptive_pred_interp_filter && partition_none_allowed) @@ -4091,7 +4091,7 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td, const int64_t part_mode_rdcost = RDCOST(partition_mul, x->rddiv, part_mode_rate, 0); subsize = get_subsize(bsize, PARTITION_HORZ); - if (cpi->sf.adaptive_motion_search) load_pred_mv(x, ctx); + load_pred_mv(x, ctx); if (cpi->sf.adaptive_pred_interp_filter && bsize == BLOCK_8X8 && partition_none_allowed) pc_tree->horizontal[0].pred_interp_filter = pred_interp_filter; @@ -4141,7 +4141,7 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td, const int64_t part_mode_rdcost = RDCOST(partition_mul, x->rddiv, part_mode_rate, 0); subsize = get_subsize(bsize, PARTITION_VERT); - if (cpi->sf.adaptive_motion_search) load_pred_mv(x, ctx); + load_pred_mv(x, ctx); if (cpi->sf.adaptive_pred_interp_filter && bsize == BLOCK_8X8 && partition_none_allowed) pc_tree->vertical[0].pred_interp_filter = pred_interp_filter; @@ -4683,7 +4683,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi, ThreadData *td, // PARTITION_HORZ if (partition_horz_allowed && do_rect) { subsize = get_subsize(bsize, PARTITION_HORZ); - if (sf->adaptive_motion_search) load_pred_mv(x, ctx); + load_pred_mv(x, ctx); pc_tree->horizontal[0].pred_pixel_ready = 1; nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, &sum_rdc, subsize, &pc_tree->horizontal[0]); @@ -4727,7 +4727,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi, ThreadData *td, // PARTITION_VERT if (partition_vert_allowed && do_rect) { subsize = get_subsize(bsize, PARTITION_VERT); - if (sf->adaptive_motion_search) load_pred_mv(x, ctx); + load_pred_mv(x, ctx); pc_tree->vertical[0].pred_pixel_ready = 1; nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, &sum_rdc, subsize, &pc_tree->vertical[0]); diff --git a/vp9/encoder/vp9_rd.c b/vp9/encoder/vp9_rd.c index dcdd00d92..5ce228202 100644 --- a/vp9/encoder/vp9_rd.c +++ b/vp9/encoder/vp9_rd.c @@ -545,8 +545,7 @@ void vp9_mv_pred(VP9_COMP *cpi, MACROBLOCK *x, uint8_t *ref_y_buffer, uint8_t *src_y_ptr = x->plane[0].src.buf; uint8_t *ref_y_ptr; const int num_mv_refs = - MAX_MV_REF_CANDIDATES + - (cpi->sf.adaptive_motion_search && block_size < x->max_partition_size); + MAX_MV_REF_CANDIDATES + (block_size < x->max_partition_size); MV pred_mv[3]; pred_mv[0] = x->mbmi_ext->ref_mvs[ref_frame][0].as_mv; diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index b20d57332..282cf2f52 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -2019,8 +2019,7 @@ static int64_t rd_pick_best_sub8x8_mode( seg_mvs[i][mi->ref_frame[0]].as_mv = *new_mv; } - if (sf->adaptive_motion_search) - x->pred_mv[mi->ref_frame[0]] = *new_mv; + x->pred_mv[mi->ref_frame[0]] = *new_mv; // restore src pointers mi_buf_restore(x, orig_src, orig_pre); @@ -2363,7 +2362,7 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, } if (cpi->sf.adaptive_motion_search && bsize < BLOCK_64X64) { - int boffset = + const int boffset = 2 * (b_width_log2_lookup[BLOCK_64X64] - VPXMIN(b_height_log2_lookup[bsize], b_width_log2_lookup[bsize])); step_param = VPXMAX(step_param, boffset); @@ -2447,7 +2446,7 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, *rate_mv = vp9_mv_bit_cost(&tmp_mv->as_mv, &ref_mv, x->nmvjointcost, x->mvcost, MV_COST_WEIGHT); - if (cpi->sf.adaptive_motion_search) x->pred_mv[ref] = tmp_mv->as_mv; + x->pred_mv[ref] = tmp_mv->as_mv; if (scaled_ref_frame) { int i;