Add speed feature prune_ref_frame_for_gm_search
Introduce a speed feature for cpu-used >= 2, to prune
reference frames during global motion estimation.
This speed feature will prune ref frames in a direction (past/future)
if the farthest ref_frame in that direction yields gm_type as
INVALID/TRANSLATION/IDENTITY.
Instruction Count
cpu-used Reduction Quality Loss
2 6% 0.01%
STATS_CHANGED
Change-Id: I0927cee46d075f8bb661f67b28aa24dcdde66874
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 120d7d2..ad1604d 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -5157,6 +5157,12 @@
compute_gm_for_valid_ref_frames(
cpi, ref_buf, frame, &num_frm_corners, frm_corners, frm_buffer,
params_by_motion, segment_map, segment_map_w, segment_map_h);
+ // If farthest ref frame yields INVALID/TRANSLATION/IDENTITY global
+ // motion, skip evaluation of global motion w.r.t to other ref frames in
+ // that direction
+ if (cpi->sf.prune_ref_frame_for_gm_search && past_frame == 0 &&
+ cm->global_motion[frame].wmtype != ROTZOOM)
+ break;
}
// Compute global motion w.r.t. future reference frames
@@ -5166,6 +5172,12 @@
compute_gm_for_valid_ref_frames(
cpi, ref_buf, frame, &num_frm_corners, frm_corners, frm_buffer,
params_by_motion, segment_map, segment_map_w, segment_map_h);
+ // If farthest ref frame yields INVALID/TRANSLATION/IDENTITY global
+ // motion, skip evaluation of global motion w.r.t to other ref frames in
+ // that direction
+ if (cpi->sf.prune_ref_frame_for_gm_search && future_frame == 0 &&
+ cm->global_motion[frame].wmtype != ROTZOOM)
+ break;
}
aom_free(segment_map);
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index b455abb..d0c8bf9 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -332,6 +332,7 @@
if (speed >= 2) {
sf->gm_erroradv_type = GM_ERRORADV_TR_2;
+ sf->prune_ref_frame_for_gm_search = 1;
sf->selective_ref_frame = 3;
@@ -853,6 +854,7 @@
sf->tx_domain_dist_thres_level = 0;
sf->gm_search_type = GM_FULL_SEARCH;
sf->gm_disable_recode = 0;
+ sf->prune_ref_frame_for_gm_search = 0;
sf->use_fast_interpolation_filter_search = 0;
sf->disable_dual_filter = 0;
sf->skip_repeat_interpolation_filter_search = 0;
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index 49cbf0f..643f33a 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -512,6 +512,11 @@
// whether to disable the global motion recode loop
int gm_disable_recode;
+ // prune reference frames during global motion estimation, if the farthest
+ // ref_frame in either direction (past/future) yields gm_type as
+ // INVALID/TRANSLATION/IDENTITY
+ int prune_ref_frame_for_gm_search;
+
// Do limited interpolation filter search for dual filters, since best choice
// usually includes EIGHTTAP_REGULAR.
int use_fast_interpolation_filter_search;