Extend sf prune_compound_using_neighbors to speed 2 and 3
Pruning of extended-compound mode using neighbor blocks is
extended to speed 2 and 3 with less aggressiveness.
Encode Time BD-Rate Loss
cpu-used Reduction avg.psnr ovr.psnr ssim
2 0.776% 0.0144% 0.0179% 0.0206%
3 1.132% 0.0009% 0.0084% 0.0117%
STATS_CHANGED
Change-Id: Ib755a0fcfa89c97a8be2f6aef7a547e248478c63
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 2b86b8e..96df847 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -4046,7 +4046,7 @@
// Prune compound mode using ref frames of neighbor blocks.
static INLINE int compound_skip_using_neighbor_refs(
MACROBLOCKD *const xd, const PREDICTION_MODE this_mode,
- const MV_REFERENCE_FRAME *ref_frames) {
+ const MV_REFERENCE_FRAME *ref_frames, int prune_compound_using_neighbors) {
// Exclude non-extended compound modes from pruning
if (this_mode == NEAREST_NEARESTMV || this_mode == NEAR_NEARMV ||
this_mode == NEW_NEWMV || this_mode == GLOBAL_GLOBALMV)
@@ -4062,7 +4062,12 @@
if (xd->up_available)
match_ref_frame(xd->above_mbmi, ref_frames, is_ref_match);
- return !(is_ref_match[0] && is_ref_match[1]);
+ // Combine ref frame match with neighbors in forward and backward refs.
+ const int track_ref_match = is_ref_match[0] + is_ref_match[1];
+
+ // Pruning based on ref frame match with neighbors.
+ if (track_ref_match >= prune_compound_using_neighbors) return 0;
+ return 1;
}
static int compare_int64(const void *a, const void *b) {
@@ -4315,7 +4320,10 @@
}
if (sf->inter_sf.prune_compound_using_neighbors && comp_pred) {
- if (compound_skip_using_neighbor_refs(xd, this_mode, ref_frames)) return 1;
+ if (compound_skip_using_neighbor_refs(
+ xd, this_mode, ref_frames,
+ sf->inter_sf.prune_compound_using_neighbors))
+ return 1;
}
return 0;
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index a45f665..5fdb7c8 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -407,6 +407,7 @@
sf->inter_sf.fast_interintra_wedge_search = 1;
sf->inter_sf.fast_wedge_sign_estimate = 1;
sf->inter_sf.prune_comp_search_by_single_result = boosted ? 4 : 1;
+ sf->inter_sf.prune_compound_using_neighbors = 1;
sf->inter_sf.prune_comp_type_by_comp_avg = 2;
sf->inter_sf.prune_warp_using_wmtype = 1;
sf->inter_sf.selective_ref_frame = 3;
@@ -514,7 +515,7 @@
(boosted || allow_screen_content_tools) ? 0 : 3;
sf->inter_sf.prune_inter_modes_based_on_tpl = boosted ? 0 : 2;
- sf->inter_sf.prune_compound_using_neighbors = 1;
+ sf->inter_sf.prune_compound_using_neighbors = 2;
sf->inter_sf.disable_smooth_interintra = 1;
sf->interp_sf.cb_pred_filter_search = 1;
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index e67f2bc..6eb39c2 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -577,6 +577,9 @@
// Skip extended compound mode using ref frames of above and left neighbor
// blocks.
+ // 0 : no pruning
+ // 1 : prune extended compound mode (less aggressiveness)
+ // 2 : prune extended compound mode (high aggressiveness)
int prune_compound_using_neighbors;
// Based on previous ref_mv_idx search result, prune the following search.