summaryrefslogtreecommitdiff
path: root/vp9/encoder
diff options
context:
space:
mode:
Diffstat (limited to 'vp9/encoder')
-rw-r--r--vp9/encoder/vp9_encoder.c5
-rw-r--r--vp9/encoder/vp9_mcomp.c34
-rw-r--r--vp9/encoder/vp9_mcomp.h5
-rw-r--r--vp9/encoder/vp9_non_greedy_mv.c11
-rw-r--r--vp9/encoder/vp9_rdopt.c12
-rw-r--r--vp9/encoder/vp9_svc_layercontext.c4
6 files changed, 42 insertions, 29 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index 08d6d4d2e..868cd4358 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -5937,9 +5937,8 @@ static uint32_t motion_compensated_prediction(VP9_COMP *cpi, ThreadData *td,
(void)sadpb;
nb_full_mv_num = vp9_prepare_nb_full_mvs(&cpi->tpl_stats[frame_idx], mi_row,
mi_col, rf_idx, bsize, nb_full_mvs);
- vp9_full_pixel_diamond_new(cpi, x, &best_ref_mv1_full, step_param, lambda, 1,
- &cpi->fn_ptr[bsize], nb_full_mvs, nb_full_mv_num,
- mv);
+ vp9_full_pixel_diamond_new(cpi, x, bsize, &best_ref_mv1_full, step_param,
+ lambda, 1, nb_full_mvs, nb_full_mv_num, mv);
#else
(void)frame_idx;
(void)mi_row;
diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c
index 0e44bb4ea..b6e3090e7 100644
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -2437,16 +2437,24 @@ unsigned int vp9_int_pro_motion_estimation(const VP9_COMP *cpi, MACROBLOCK *x,
return best_sad;
}
+static int get_exhaustive_threshold(int exhaustive_searches_thresh,
+ BLOCK_SIZE bsize) {
+ return exhaustive_searches_thresh >>
+ (8 - (b_width_log2_lookup[bsize] + b_height_log2_lookup[bsize]));
+}
+
#if CONFIG_NON_GREEDY_MV
// Runs sequence of diamond searches in smaller steps for RD.
/* do_refine: If last step (1-away) of n-step search doesn't pick the center
point as the best match, we will do a final 1-away diamond
refining search */
-int vp9_full_pixel_diamond_new(const VP9_COMP *cpi, MACROBLOCK *x, MV *mvp_full,
- int step_param, int lambda, int do_refine,
- const vp9_variance_fn_ptr_t *fn_ptr,
+int vp9_full_pixel_diamond_new(const VP9_COMP *cpi, MACROBLOCK *x,
+ BLOCK_SIZE bsize, MV *mvp_full, int step_param,
+ int lambda, int do_refine,
const int_mv *nb_full_mvs, int full_mv_num,
MV *best_mv) {
+ const vp9_variance_fn_ptr_t *fn_ptr = &cpi->fn_ptr[bsize];
+ const SPEED_FEATURES *const sf = &cpi->sf;
int n, num00 = 0;
int thissme;
int bestsme;
@@ -2495,9 +2503,16 @@ int vp9_full_pixel_diamond_new(const VP9_COMP *cpi, MACROBLOCK *x, MV *mvp_full,
}
}
- full_pixel_exhaustive_new(cpi, x, best_mv, fn_ptr, best_mv, lambda,
- nb_full_mvs, full_mv_num);
- bestsme = vp9_get_mvpred_var(x, best_mv, &center_mv, fn_ptr, 0);
+ if (sf->exhaustive_searches_thresh < INT_MAX &&
+ !cpi->rc.is_src_frame_alt_ref) {
+ const int64_t exhaustive_thr =
+ get_exhaustive_threshold(sf->exhaustive_searches_thresh, bsize);
+ if (bestsme > exhaustive_thr) {
+ full_pixel_exhaustive_new(cpi, x, best_mv, fn_ptr, best_mv, lambda,
+ nb_full_mvs, full_mv_num);
+ bestsme = vp9_get_mvpred_var(x, best_mv, &center_mv, fn_ptr, 0);
+ }
+ }
return bestsme;
}
#endif // CONFIG_NON_GREEDY_MV
@@ -2886,9 +2901,10 @@ int vp9_full_pixel_search(const VP9_COMP *const cpi, const MACROBLOCK *const x,
if (sf->exhaustive_searches_thresh < INT_MAX &&
!cpi->rc.is_src_frame_alt_ref) {
const int64_t exhaustive_thr =
- sf->exhaustive_searches_thresh >>
- (8 - (b_width_log2_lookup[bsize] + b_height_log2_lookup[bsize]));
- if (var > exhaustive_thr) run_exhaustive_search = 1;
+ get_exhaustive_threshold(sf->exhaustive_searches_thresh, bsize);
+ if (var > exhaustive_thr) {
+ run_exhaustive_search = 1;
+ }
}
} else if (method == MESH) {
run_exhaustive_search = 1;
diff --git a/vp9/encoder/vp9_mcomp.h b/vp9/encoder/vp9_mcomp.h
index 424ca6275..6f460414e 100644
--- a/vp9/encoder/vp9_mcomp.h
+++ b/vp9/encoder/vp9_mcomp.h
@@ -136,9 +136,8 @@ int64_t vp9_refining_search_sad_new(const MACROBLOCK *x, MV *best_full_mv,
const int_mv *nb_full_mvs, int full_mv_num);
int vp9_full_pixel_diamond_new(const struct VP9_COMP *cpi, MACROBLOCK *x,
- MV *mvp_full, int step_param, int lambda,
- int do_refine,
- const vp9_variance_fn_ptr_t *fn_ptr,
+ BLOCK_SIZE bsize, MV *mvp_full, int step_param,
+ int lambda, int do_refine,
const int_mv *nb_full_mvs, int full_mv_num,
MV *best_mv);
diff --git a/vp9/encoder/vp9_non_greedy_mv.c b/vp9/encoder/vp9_non_greedy_mv.c
index f54e40cc7..d83aeca88 100644
--- a/vp9/encoder/vp9_non_greedy_mv.c
+++ b/vp9/encoder/vp9_non_greedy_mv.c
@@ -180,12 +180,12 @@ static int64_t log2_approximation(int64_t v) {
int64_t vp9_nb_mvs_inconsistency(const MV *mv, const int_mv *nb_full_mvs,
int mv_num) {
- // The bahavior of this function is to compute log2 of mv difference,
+ // The behavior of this function is to compute log2 of mv difference,
// i.e. min log2(1 + row_diff * row_diff + col_diff * col_diff)
- // against available neghbor mvs.
- // Since the log2 is monotonic increasing, we can compute
+ // against available neighbor mvs.
+ // Since the log2 is monotonically increasing, we can compute
// min row_diff * row_diff + col_diff * col_diff first
- // then apply log2 in the end
+ // then apply log2 in the end.
int i;
int64_t min_abs_diff = INT64_MAX;
int cnt = 0;
@@ -201,7 +201,6 @@ int64_t vp9_nb_mvs_inconsistency(const MV *mv, const int_mv *nb_full_mvs,
}
if (cnt) {
return log2_approximation(1 + min_abs_diff);
- } else {
- return 0;
}
+ return 0;
}
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index 65b94357d..e243e03a4 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -2579,9 +2579,9 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
mvp_full.row >>= 3;
#if CONFIG_NON_GREEDY_MV
- bestsme = vp9_full_pixel_diamond_new(cpi, x, &mvp_full, step_param, lambda, 1,
- &cpi->fn_ptr[bsize], nb_full_mvs,
- nb_full_mv_num, &tmp_mv->as_mv);
+ bestsme = vp9_full_pixel_diamond_new(cpi, x, bsize, &mvp_full, step_param,
+ lambda, 1, nb_full_mvs, nb_full_mv_num,
+ &tmp_mv->as_mv);
#else // CONFIG_NON_GREEDY_MV
bestsme = vp9_full_pixel_search(
cpi, x, bsize, &mvp_full, step_param, cpi->sf.mv.search_method, sadpb,
@@ -2617,9 +2617,9 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
mvp_full.row >>= 3;
#if CONFIG_NON_GREEDY_MV
this_me = vp9_full_pixel_diamond_new(
- cpi, x, &mvp_full, VPXMAX(step_param, MAX_MVSEARCH_STEPS - step),
- lambda, 1, &cpi->fn_ptr[bsize], nb_full_mvs, nb_full_mv_num,
- &this_mv);
+ cpi, x, bsize, &mvp_full,
+ VPXMAX(step_param, MAX_MVSEARCH_STEPS - step), lambda, 1, nb_full_mvs,
+ nb_full_mv_num, &this_mv);
#else // CONFIG_NON_GREEDY_MV
this_me = vp9_full_pixel_search(
cpi, x, bsize, &mvp_full,
diff --git a/vp9/encoder/vp9_svc_layercontext.c b/vp9/encoder/vp9_svc_layercontext.c
index 8ba113bf3..bfe803b24 100644
--- a/vp9/encoder/vp9_svc_layercontext.c
+++ b/vp9/encoder/vp9_svc_layercontext.c
@@ -57,8 +57,8 @@ void vp9_init_layer_context(VP9_COMP *const cpi) {
svc->simulcast_mode = 0;
for (i = 0; i < REF_FRAMES; ++i) {
- svc->fb_idx_spatial_layer_id[i] = -1;
- svc->fb_idx_temporal_layer_id[i] = -1;
+ svc->fb_idx_spatial_layer_id[i] = 0xff;
+ svc->fb_idx_temporal_layer_id[i] = 0xff;
svc->fb_idx_base[i] = 0;
}
for (sl = 0; sl < oxcf->ss_number_layers; ++sl) {