Adds speed feature to prune wedge search
Adds a speed feature to disable wedge search if the difference
between the two best single predictors so far is small. The
threshold is tighter for modes with newmv than without.
About 3-4% speed-up with 0.03 coding efficiency loss for lowres
and midres with 30 frames in end-usage=q mode.
STATS_CHANGED
Change-Id: I038750a5a1b9ad1e11ed6e40dde1ea9bee882f68
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 5b7747e..cd49118 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -7894,6 +7894,19 @@
preds1, residual1, diff10, strides);
*calc_pred_masked_compound = 0;
}
+ if (cpi->sf.prune_wedge_pred_diff_based && compound_type == COMPOUND_WEDGE) {
+ unsigned int sse;
+ if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
+ (void)cpi->fn_ptr[bsize].vf(CONVERT_TO_BYTEPTR(*preds0), *strides,
+ CONVERT_TO_BYTEPTR(*preds1), *strides, &sse);
+ else
+ (void)cpi->fn_ptr[bsize].vf(*preds0, *strides, *preds1, *strides, &sse);
+ const unsigned int mse =
+ ROUND_POWER_OF_TWO(sse, num_pels_log2_lookup[bsize]);
+ // If two predictors are very similar, skip wedge compound mode search
+ if (mse < 8 || (!have_newmv_in_inter_mode(this_mode) && mse < 64))
+ return INT64_MAX;
+ }
best_rd_cur =
pick_interinter_mask(cpi, x, bsize, *preds0, *preds1, residual1, diff10);
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index f3c5104..48abe7c 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -199,6 +199,7 @@
sf->intra_tx_size_search_init_depth_sqr = 1;
sf->intra_angle_estimation = 1;
sf->selective_ref_frame = 1;
+ sf->prune_wedge_pred_diff_based = 1;
if (speed >= 1) {
sf->gm_erroradv_type = GM_ERRORADV_TR_1;
@@ -443,6 +444,7 @@
sf->use_accurate_subpel_search = USE_8_TAPS;
sf->disable_wedge_search_var_thresh = 0;
sf->fast_wedge_sign_estimate = 0;
+ sf->prune_wedge_pred_diff_based = 0;
sf->drop_ref = 0;
sf->skip_intra_in_interframe = 1;
sf->txb_split_cap = 1;
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index 8f0f9a6..7041eab 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -446,6 +446,9 @@
// Whether fast wedge sign estimate is used
int fast_wedge_sign_estimate;
+ // Whether to prune wedge search based on predictor difference
+ int prune_wedge_pred_diff_based;
+
// These bit masks allow you to enable or disable intra modes for each
// transform size separately.
int intra_y_mode_mask[TX_SIZES];