Speed up jnt_comp search
(1). If 1/2 of model_rd of compound modes are larger than rd of
jnt_comp, choose jnt_comp and stop searching.
(2). In motion_mode_rd, if it's jnt_comp mode, do not search
interintra.
(3). If motion vector is GLOBAL_GLOBALMV, do not search jnt_comp mode.
STATS_CHANGE
Performance: 0.02% worse (because GLOBAL_GLOBALMV is skipped),
on Google test 30 frames lowres
Speed up: not significant, within 3%.
Change-Id: I937c8b89425bc2b9ae3c734346edc29e38599336
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index f33ba84..3bfb624 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -6971,8 +6971,8 @@
RD_STATS best_rd_stats, best_rd_stats_y, best_rd_stats_uv;
MB_MODE_INFO base_mbmi, best_mbmi;
uint8_t best_blk_skip[MAX_MIB_SIZE * MAX_MIB_SIZE];
- int interintra_allowed =
- cm->seq_params.enable_interintra_compound && is_interintra_allowed(mbmi);
+ int interintra_allowed = cm->seq_params.enable_interintra_compound &&
+ is_interintra_allowed(mbmi) && mbmi->compound_idx;
int pts0[SAMPLES_ARRAY_SIZE], pts_inref0[SAMPLES_ARRAY_SIZE];
int total_samples;
@@ -7534,7 +7534,8 @@
int64_t early_terminate = 0;
int comp_idx;
- const int search_jnt_comp = is_comp_pred & cm->seq_params.enable_jnt_comp;
+ const int search_jnt_comp = is_comp_pred & cm->seq_params.enable_jnt_comp &
+ (mbmi->mode != GLOBAL_GLOBALMV);
// If !search_jnt_comp, we need to force mbmi->compound_idx = 1.
for (comp_idx = !search_jnt_comp; comp_idx < 2; ++comp_idx) {
compmode_interinter_cost = 0;
@@ -7863,6 +7864,13 @@
model_rd_for_sb(cpi, bsize, x, xd, 0, num_planes - 1, &tmp_rate,
&tmp_dist, &skip_txfm_sb, &skip_sse_sb);
rd = RDCOST(x->rdmult, rs + tmp_rate, tmp_dist);
+
+ // if 1/2 model rd is larger than best_rd in jnt_comp mode,
+ // use jnt_comp mode, save additional search
+ if ((rd >> 1) > best_rd) {
+ restore_dst_buf(xd, orig_dst, num_planes);
+ continue;
+ }
}
if (!is_comp_pred)