Revert "Consolidate skip extended comp mode speed features" The baseline coding stats are changed. Speed 2 and 3 compression efficiency dropped by 0.3 - 0.6% in both overall PSNR and SSIM. This reverts commit 2a307d6f69f1751dfe8685f6d4dfa5c0bc606680. STATS_CHANGED Change-Id: Ic8217f4828d626528c2ca67cb4f0c737756f9b50
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c index fbffe07..c7540f2 100644 --- a/av1/encoder/rdopt.c +++ b/av1/encoder/rdopt.c
@@ -4452,7 +4452,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, int prune_extended_comp_mode) { + 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) @@ -4472,7 +4472,7 @@ 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_extended_comp_mode) return 0; + if (track_ref_match >= prune_compound_using_neighbors) return 0; return 1; } @@ -4490,7 +4490,8 @@ // Prune compound mode using best single mode for the same reference. static INLINE int skip_compound_using_best_single_mode_ref( const PREDICTION_MODE this_mode, const MV_REFERENCE_FRAME *ref_frames, - const PREDICTION_MODE *best_single_mode) { + const PREDICTION_MODE *best_single_mode, + int prune_comp_using_best_single_mode_ref) { // Exclude non-extended compound modes from pruning if (this_mode == NEAREST_NEARESTMV || this_mode == NEAR_NEARMV || this_mode == NEW_NEWMV || this_mode == GLOBAL_GLOBALMV) @@ -4513,6 +4514,9 @@ const PREDICTION_MODE single_mode = best_single_mode[ref_frames[newmv_dir]]; if (single_mode == NEWMV) return 0; + // Avoid pruning the compound mode when best single mode is not available + if (prune_comp_using_best_single_mode_ref == 1) + if (single_mode == MB_MODE_COUNT) return 0; return 1; } @@ -4766,13 +4770,17 @@ return 1; } - if (sf->inter_sf.prune_extended_comp_mode && comp_pred) { + if (sf->inter_sf.prune_compound_using_neighbors && comp_pred) { if (compound_skip_using_neighbor_refs( - xd, this_mode, ref_frames, sf->inter_sf.prune_extended_comp_mode)) + xd, this_mode, ref_frames, + sf->inter_sf.prune_compound_using_neighbors)) return 1; + } + if (sf->inter_sf.prune_comp_using_best_single_mode_ref && comp_pred) { if (skip_compound_using_best_single_mode_ref( - this_mode, ref_frames, args->search_state->best_single_mode)) + this_mode, ref_frames, args->search_state->best_single_mode, + sf->inter_sf.prune_comp_using_best_single_mode_ref)) return 1; } @@ -5464,7 +5472,7 @@ collect_single_states(x, &search_state, mbmi); } - if (sf->inter_sf.prune_extended_comp_mode > 1 && + if (sf->inter_sf.prune_comp_using_best_single_mode_ref > 0 && is_inter_singleref_mode(this_mode)) update_best_single_mode(&search_state, this_mode, ref_frame, this_rd);
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c index 807cd6c..337a707 100644 --- a/av1/encoder/speed_features.c +++ b/av1/encoder/speed_features.c
@@ -498,7 +498,7 @@ sf->inter_sf.disable_interinter_wedge_var_thresh = 100; sf->inter_sf.fast_interintra_wedge_search = 1; sf->inter_sf.prune_comp_search_by_single_result = boosted ? 4 : 1; - sf->inter_sf.prune_extended_comp_mode = 1; + sf->inter_sf.prune_compound_using_neighbors = 1; sf->inter_sf.prune_comp_type_by_comp_avg = 2; sf->inter_sf.reuse_best_prediction_for_part_ab = 1; sf->inter_sf.selective_ref_frame = 3; @@ -611,7 +611,8 @@ sf->inter_sf.txfm_rd_gate_level = boosted ? 0 : 4; sf->inter_sf.prune_inter_modes_based_on_tpl = boosted ? 0 : 2; - sf->inter_sf.prune_extended_comp_mode = 2; + sf->inter_sf.prune_compound_using_neighbors = 2; + sf->inter_sf.prune_comp_using_best_single_mode_ref = 2; sf->inter_sf.disable_smooth_interintra = 1; sf->inter_sf.disable_obmc = 1; sf->inter_sf.disable_onesided_comp = 1; @@ -1155,7 +1156,8 @@ inter_sf->skip_repeated_full_newmv = 0; inter_sf->inter_mode_rd_model_estimation = 0; inter_sf->prune_compound_using_single_ref = 0; - inter_sf->prune_extended_comp_mode = 0; + inter_sf->prune_compound_using_neighbors = 0; + inter_sf->prune_comp_using_best_single_mode_ref = 0; inter_sf->disable_onesided_comp = 0; inter_sf->prune_mode_search_simple_translation = 0; inter_sf->prune_comp_type_by_comp_avg = 0;
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h index 04972a9..6bcaa4b 100644 --- a/av1/encoder/speed_features.h +++ b/av1/encoder/speed_features.h
@@ -671,12 +671,18 @@ int prune_compound_using_single_ref; // Skip extended compound mode using ref frames of above and left neighbor - // blocks and also skip when ref frame NEWMV mode does not have NEWMV as - // single mode winner + // blocks. // 0 : no pruning // 1 : prune extended compound mode (less aggressiveness) // 2 : prune extended compound mode (high aggressiveness) - int prune_extended_comp_mode; + int prune_compound_using_neighbors; + + // Skip extended compound mode when ref frame corresponding to NEWMV does not + // have NEWMV as single mode winner. + // 0 : no pruning + // 1 : prune extended compound mode (less aggressiveness) + // 2 : prune extended compound mode (high aggressiveness) + int prune_comp_using_best_single_mode_ref; // Based on previous ref_mv_idx search result, prune the following search. int prune_ref_mv_idx_search;