Bypass wedge compound search in certain derived mv mode
Allow the encoder to bypass the wedge compound search in the
derived motion vector modes. The encoding speed is up by ~3%.
Compression loss is under 0.02% in speed 1.
STATS_CHANGED
Change-Id: I50197dbd5f8f1b1373bc4217e602f487c23bef66
diff --git a/av1/encoder/compound_type.c b/av1/encoder/compound_type.c
index bc32281..8e8cca8 100644
--- a/av1/encoder/compound_type.c
+++ b/av1/encoder/compound_type.c
@@ -1236,6 +1236,7 @@
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *mbmi = xd->mi[0];
const PREDICTION_MODE this_mode = mbmi->mode;
+ int ref_frame = av1_ref_frame_type(mbmi->ref_frame);
const int bw = block_size_wide[bsize];
int rs2;
int_mv best_mv[2];
@@ -1310,6 +1311,11 @@
// Loop over valid compound types
for (int i = 0; i < valid_type_count; i++) {
cur_type = valid_comp_types[i];
+
+ if (args->cmp_mode[ref_frame] == COMPOUND_AVERAGE) {
+ if (cur_type == COMPOUND_WEDGE) continue;
+ }
+
comp_model_rd_cur = INT64_MAX;
tmp_rate_mv = *rate_mv;
best_rd_cur = INT64_MAX;
@@ -1560,6 +1566,10 @@
rd_stats->rate += best_tmp_rate_mv - *rate_mv;
*rate_mv = best_tmp_rate_mv;
}
+
+ if (this_mode == NEW_NEWMV)
+ args->cmp_mode[ref_frame] = mbmi->interinter_comp.type;
+
restore_dst_buf(xd, *orig_dst, 1);
if (!match_found)
save_comp_rd_search_stat(x, mbmi, comp_rate, comp_dist, comp_model_rate,
diff --git a/av1/encoder/interp_search.h b/av1/encoder/interp_search.h
index 9a6dcfa..1ee26d1 100644
--- a/av1/encoder/interp_search.h
+++ b/av1/encoder/interp_search.h
@@ -135,6 +135,10 @@
* Estimated diff wtd index.
*/
int diffwtd_index;
+ /*!
+ * Estimated cmp mode.
+ */
+ int cmp_mode[MODE_CTX_REF_FRAMES];
} HandleInterModeArgs;
/*!\cond */
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index d9cbc90..0cfadc8 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -5228,7 +5228,9 @@
0,
-1,
-1,
- -1 };
+ -1,
+ { 0 } };
+ for (i = 0; i < MODE_CTX_REF_FRAMES; ++i) args.cmp_mode[i] = -1;
// Indicates the appropriate number of simple translation winner modes for
// exhaustive motion mode evaluation
const int max_winner_motion_mode_cand =