Save mask search results from first time search
Store the masked compound type search results from the first time search
for a block, to speed-up encoding. This is enabled for speed 3 and 4.
Instruction Count BD-Rate Loss(%)
cpu-used Reduction(%) avg.psnr ovr.psnr ssim
3 27.745 0.2411 0.2484 0.2436
4 30.489 0.3380 0.3517 0.3737
STATS_CHANGED
Change-Id: I076e8bbf354964317a0e83701a59a330cd40e88d
diff --git a/av1/encoder/compound_type.c b/av1/encoder/compound_type.c
index f7ad1d0..4339fcb 100644
--- a/av1/encoder/compound_type.c
+++ b/av1/encoder/compound_type.c
@@ -1002,6 +1002,14 @@
comp_rs2[cur_type] = rs2;
}
+static INLINE int save_mask_search_results(const PREDICTION_MODE this_mode,
+ const int reuse_level) {
+ if (reuse_level || (this_mode == NEW_NEWMV))
+ return 1;
+ else
+ return 0;
+}
+
static int64_t masked_compound_type_rd(
const AV1_COMP *const cpi, MACROBLOCK *x, const int_mv *const cur_mv,
const BLOCK_SIZE bsize, const PREDICTION_MODE this_mode, int *rs2,
@@ -1402,7 +1410,8 @@
}
if (need_mask_search) {
- if (this_mode == NEW_NEWMV) {
+ if (save_mask_search_results(
+ this_mode, cpi->sf.inter_sf.reuse_mask_search_results)) {
args->wedge_index = best_mask_index;
args->wedge_sign = best_wedge_sign;
}
@@ -1477,7 +1486,9 @@
}
if (need_mask_search) {
- if (this_mode == NEW_NEWMV) args->diffwtd_index = best_mask_index;
+ if (save_mask_search_results(
+ this_mode, cpi->sf.inter_sf.reuse_mask_search_results))
+ args->diffwtd_index = best_mask_index;
} else {
mbmi->interinter_comp.mask_type = args->diffwtd_index;
rs2 = masked_type_cost[cur_type];
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index fdee5c6..907fcea 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -878,6 +878,7 @@
sf->inter_sf.reuse_compound_type_decision = 1;
sf->inter_sf.txfm_rd_gate_level =
boosted ? 0 : (is_boosted_arf2_bwd_type ? 1 : 2);
+ sf->inter_sf.reuse_mask_search_results = 1;
// TODO(chiyotsai@google.com): the thresholds chosen for intra hog are
// inherited directly from luma hog with some minor tweaking. Eventually we
@@ -1489,6 +1490,7 @@
inter_sf->disable_masked_comp = 0;
inter_sf->reuse_best_prediction_for_part_ab = 0;
inter_sf->enable_fast_compound_mode_search = 0;
+ inter_sf->reuse_mask_search_results = 0;
}
static AOM_INLINE void init_interp_sf(INTERP_FILTER_SPEED_FEATURES *interp_sf) {
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index 6a4ea3c..4a7d024 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -745,6 +745,9 @@
// Enable/disable the fast compound mode search.
int enable_fast_compound_mode_search;
+
+ // Reuse masked compound type search results
+ int reuse_mask_search_results;
} INTER_MODE_SPEED_FEATURES;
typedef struct INTERP_FILTER_SPEED_FEATURES {