Fix / turn on jnt_comp_skip_mv_search for speed 0
About 10-15% speed-up in speed 0 and 1.
Change-Id: I100747a70132f16d14145d22bfeace4539ff832c
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 9bb379f..945642a 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -8136,6 +8136,9 @@
int plane_rate[MAX_MB_PLANE] = { 0 };
int64_t plane_sse[MAX_MB_PLANE] = { 0 };
int64_t plane_dist[MAX_MB_PLANE] = { 0 };
+ int64_t newmv_ret_val = INT64_MAX;
+ int_mv backup_mv[2] = { { 0 } };
+ int backup_rate_mv = 0;
int comp_idx;
const int search_jnt_comp = is_comp_pred & cm->seq_params.enable_jnt_comp &
@@ -8170,12 +8173,26 @@
continue;
}
if (have_newmv_in_inter_mode(this_mode)) {
+ if (comp_idx == 0) {
+ cur_mv[0] = backup_mv[0];
+ cur_mv[1] = backup_mv[1];
+ rate_mv = backup_rate_mv;
+ }
+
// when jnt_comp_skip_mv_search flag is on, new mv will be searched once
if (!(search_jnt_comp && cpi->sf.jnt_comp_skip_mv_search &&
- comp_idx == 0))
- ret_val =
+ comp_idx == 0)) {
+ newmv_ret_val =
handle_newmv(cpi, x, bsize, cur_mv, mi_row, mi_col, &rate_mv, args);
- if (ret_val != 0) {
+
+ // Store cur_mv and rate_mv so that they can be restored in the next
+ // iteration of the loop
+ backup_mv[0] = cur_mv[0];
+ backup_mv[1] = cur_mv[1];
+ backup_rate_mv = rate_mv;
+ }
+
+ if (newmv_ret_val != 0) {
early_terminate = INT64_MAX;
continue;
} else {
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 7ab89e0..d6161d2 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -149,6 +149,7 @@
sf->reduce_inter_modes = 1;
sf->prune_ext_partition_types_search_level = 1;
sf->adaptive_txb_search_level = 1;
+ sf->jnt_comp_skip_mv_search = 1;
if (speed >= 1) {
sf->gm_erroradv_type = GM_ERRORADV_TR_1;