Skip affine evaluation based on warp parameters
Introduced a speed feature to gate warp evaluation for motions of type IDENTITY,
TRANSLATION and AFFINE based on number of warp neighbors.
This speed feature is turned on for speeds >= 3.
For speed = 4 and 3 presets, BD-rate impact is seen by -0.02% and 0.01% (as per AWCY runs) with encode time reduction
of 0.85% and 0.65% (averaged across multiple test cases) respectively.
STATS_CHANGED
Change-Id: Ic7e11408023578602244b165bb34ab4cbfff28a7
diff --git a/av1/common/mv.h b/av1/common/mv.h
index 5b02251..737d715 100644
--- a/av1/common/mv.h
+++ b/av1/common/mv.h
@@ -263,7 +263,7 @@
return res;
}
-static INLINE TransformationType get_gmtype(const WarpedMotionParams *gm) {
+static INLINE TransformationType get_wmtype(const WarpedMotionParams *gm) {
if (gm->wmmat[5] == (1 << WARPEDMODEL_PREC_BITS) && !gm->wmmat[4] &&
gm->wmmat[2] == (1 << WARPEDMODEL_PREC_BITS) && !gm->wmmat[3]) {
return ((!gm->wmmat[1] && !gm->wmmat[0]) ? IDENTITY : TRANSLATION);
diff --git a/av1/encoder/global_motion.c b/av1/encoder/global_motion.c
index 24d2c42..495c0ef 100644
--- a/av1/encoder/global_motion.c
+++ b/av1/encoder/global_motion.c
@@ -106,7 +106,7 @@
void av1_convert_model_to_params(const double *params,
WarpedMotionParams *model) {
convert_to_params(params, model->wmmat);
- model->wmtype = get_gmtype(model);
+ model->wmtype = get_wmtype(model);
model->invalid = 0;
}
@@ -239,7 +239,7 @@
}
}
force_wmtype(wm, wmtype);
- wm->wmtype = get_gmtype(wm);
+ wm->wmtype = get_wmtype(wm);
return best_error;
}
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 759775c..3195768 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -9132,6 +9132,23 @@
mbmi->wm_params = wm_params0;
mbmi->num_proj_ref = num_proj_ref0;
}
+ } else {
+ if (cpi->sf.prune_warp_using_wmtype) {
+ TransformationType wmtype = get_wmtype(&mbmi->wm_params);
+ // If number of valid neighbours is 1,
+ // 1) ROTZOOM parameters can be obtained reliably (2 parameters from
+ // one neighbouring MV)
+ // 2) For IDENTITY/TRANSLATION cases, warp can perform better due to
+ // a different interpolation filter being used. However the quality
+ // gains (due to the same) may not be much
+ // For above 2 cases warp evaluation is skipped
+ // TODO(any) : Extend this logic for NEWMV case
+ if (mbmi->num_proj_ref == 1) {
+ if (wmtype != ROTZOOM) continue;
+ } else {
+ if (wmtype < ROTZOOM) continue;
+ }
+ }
}
av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize);
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 8e99887..94c698e 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -290,6 +290,7 @@
sf->gm_search_type = GM_DISABLE_SEARCH;
sf->prune_comp_search_by_single_result = 2;
sf->prune_motion_mode_level = boosted ? 2 : 3;
+ sf->prune_warp_using_wmtype = 1;
}
if (speed >= 4) {
@@ -527,6 +528,7 @@
sf->skip_sharp_interp_filter_search = 0;
sf->prune_comp_type_by_comp_avg = 0;
sf->prune_motion_mode_level = 0;
+ sf->prune_warp_using_wmtype = 0;
if (oxcf->mode == GOOD)
set_good_speed_features_framesize_independent(cpi, sf, oxcf->speed);
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index b2ff8e2..a9d9338 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -605,6 +605,10 @@
// Values are 0 (not used) , 1 - 3 with progressively increasing
// aggressiveness
int prune_motion_mode_level;
+
+ // Gate warp evaluation for motions of type IDENTITY,
+ // TRANSLATION and AFFINE(based on number of warp neighbors)
+ int prune_warp_using_wmtype;
} SPEED_FEATURES;
struct AV1_COMP;