diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c index d40f7133c..26f1a0289 100644 --- a/vp9/encoder/vp9_mcomp.c +++ b/vp9/encoder/vp9_mcomp.c @@ -882,6 +882,20 @@ int vp9_fast_hex_search(const MACROBLOCK *x, center_mv, best_mv); } +int vp9_fast_dia_search(const MACROBLOCK *x, + MV *ref_mv, + int search_param, + int sad_per_bit, + int do_init_search, + const vp9_variance_fn_ptr_t *vfp, + int use_mvcost, + const MV *center_mv, + MV *best_mv) { + return vp9_bigdia_search(x, ref_mv, MAX(MAX_MVSEARCH_STEPS - 2, search_param), + sad_per_bit, do_init_search, vfp, use_mvcost, + center_mv, best_mv); +} + #undef CHECK_BETTER int vp9_full_range_search_c(const MACROBLOCK *x, MV *ref_mv, MV *best_mv, diff --git a/vp9/encoder/vp9_mcomp.h b/vp9/encoder/vp9_mcomp.h index 0d127106c..917de75e6 100644 --- a/vp9/encoder/vp9_mcomp.h +++ b/vp9/encoder/vp9_mcomp.h @@ -75,6 +75,7 @@ integer_mv_pattern_search_fn vp9_hex_search; integer_mv_pattern_search_fn vp9_bigdia_search; integer_mv_pattern_search_fn vp9_square_search; integer_mv_pattern_search_fn vp9_fast_hex_search; +integer_mv_pattern_search_fn vp9_fast_dia_search; typedef int (fractional_mv_step_fp) ( const MACROBLOCK *x, diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index 1e5ed8268..57d2c78ab 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -872,7 +872,7 @@ static void set_rt_speed_feature(VP9_COMMON *cm, if (speed >= 7) { sf->partition_search_type = VAR_BASED_FIXED_PARTITION; sf->use_nonrd_pick_mode = 1; - sf->search_method = FAST_HEX; + sf->search_method = FAST_DIAMOND; } if (speed >= 8) { int i; diff --git a/vp9/encoder/vp9_onyx_int.h b/vp9/encoder/vp9_onyx_int.h index a8e7b69e2..4ee035b37 100644 --- a/vp9/encoder/vp9_onyx_int.h +++ b/vp9/encoder/vp9_onyx_int.h @@ -137,7 +137,8 @@ typedef enum { HEX = 2, BIGDIA = 3, SQUARE = 4, - FAST_HEX = 5 + FAST_HEX = 5, + FAST_DIAMOND = 6 } SEARCH_METHODS; typedef enum { diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c index 3a73d3ef4..c10b4f3e2 100644 --- a/vp9/encoder/vp9_pickmode.c +++ b/vp9/encoder/vp9_pickmode.c @@ -86,7 +86,12 @@ static int full_pixel_motion_search(VP9_COMP *cpi, MACROBLOCK *x, mvp_full.col >>= 3; mvp_full.row >>= 3; - if (cpi->sf.search_method == FAST_HEX) { + if (cpi->sf.search_method == FAST_DIAMOND) { + // NOTE: this returns SAD + vp9_fast_dia_search(x, &mvp_full, step_param, sadpb, 0, + &cpi->fn_ptr[bsize], 1, + &ref_mv, &tmp_mv->as_mv); + } else if (cpi->sf.search_method == FAST_HEX) { // NOTE: this returns SAD vp9_fast_hex_search(x, &mvp_full, step_param, sadpb, 0, &cpi->fn_ptr[bsize], 1, diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 361bbd90d..0542a3447 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -2457,7 +2457,14 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x, // Further step/diamond searches as necessary further_steps = (cpi->sf.max_step_search_steps - 1) - step_param; - if (cpi->sf.search_method == FAST_HEX) { + if (cpi->sf.search_method == FAST_DIAMOND) { + bestsme = vp9_fast_dia_search(x, &mvp_full, step_param, sadpb, 0, + &cpi->fn_ptr[bsize], 1, + &ref_mv, &tmp_mv->as_mv); + if (bestsme < INT_MAX) + bestsme = vp9_get_mvpred_var(x, &tmp_mv->as_mv, &ref_mv, + &cpi->fn_ptr[bsize], 1); + } else if (cpi->sf.search_method == FAST_HEX) { bestsme = vp9_fast_hex_search(x, &mvp_full, step_param, sadpb, 0, &cpi->fn_ptr[bsize], 1, &ref_mv, &tmp_mv->as_mv);