rtc-screen: Set force_zeromv_skip for kVeryLowSad case
Currently, the variable force_zeromv_skip is set only
when source sad is equal to kZeroSad. This CL enables
force_zeromv_skip for kLowSad cases in speed preset 10.
Instruction Count BD-Rate Loss(%)
cpu Test-set Reduction(%) avg.psnr ovr.psnr ssim
10 rtc-screen 1.939 -0.0361 0.1555 0.0140
STATS_CHANGED for rtc-screen speed 10
Change-Id: Ica42407e88e2bb49b58fa738b1392214b871d3a9
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 50e6c37..f6fc32a 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -1402,8 +1402,11 @@
sf->rt_sf.reduce_mv_pel_precision = 2;
sf->rt_sf.reduce_zeromv_mvres = true;
}
- if (speed >= 10 && cm->width * cm->height > 1920 * 1080)
- sf->part_sf.disable_8x8_part_based_on_qidx = 1;
+ if (speed >= 10) {
+ if (cm->width * cm->height > 1920 * 1080)
+ sf->part_sf.disable_8x8_part_based_on_qidx = 1;
+ sf->rt_sf.set_zeromv_skip_based_on_source_sad = 2;
+ }
sf->rt_sf.skip_cdef_sb = 1;
sf->rt_sf.use_rtc_tf = 0;
sf->rt_sf.use_comp_ref_nonrd = 0;
@@ -2058,6 +2061,7 @@
rt_sf->prune_compoundmode_with_singlemode_var = false;
rt_sf->skip_compound_based_on_var = false;
rt_sf->top_right_sync_wait_in_mis = false;
+ rt_sf->set_zeromv_skip_based_on_source_sad = 1;
}
// Populate appropriate sub-pel search method based on speed feature and user
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index d53d4cf..0c23572 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -1616,6 +1616,13 @@
// In multi-threaded encoding, enable top right dependency wait of threads at
// mi level.
bool top_right_sync_wait_in_mis;
+
+ // Sets force_zeromv_skip based on the source sad available. Aggressiveness
+ // increases with increase in the level set for speed feature.
+ // 0: No setting
+ // 1: If source sad is kZeroSad
+ // 2: If source sad <= kVeryLowSad
+ int set_zeromv_skip_based_on_source_sad;
} REAL_TIME_SPEED_FEATURES;
/*!\endcond */
diff --git a/av1/encoder/var_based_part.c b/av1/encoder/var_based_part.c
index 91f309b..7135f37 100644
--- a/av1/encoder/var_based_part.c
+++ b/av1/encoder/var_based_part.c
@@ -1205,6 +1205,18 @@
: PART_EVAL_ONLY_NONE;
}
+static AOM_INLINE bool is_set_force_zeromv_skip_based_on_src_sad(
+ int set_zeromv_skip_based_on_source_sad, SOURCE_SAD source_sad_nonrd) {
+ if (set_zeromv_skip_based_on_source_sad == 0) return false;
+
+ if (set_zeromv_skip_based_on_source_sad >= 2)
+ return source_sad_nonrd <= kVeryLowSad;
+ else if (set_zeromv_skip_based_on_source_sad >= 1)
+ return source_sad_nonrd == kZeroSad;
+
+ return false;
+}
+
int av1_choose_var_based_partitioning(AV1_COMP *cpi, const TileInfo *const tile,
ThreadData *td, MACROBLOCK *x, int mi_row,
int mi_col) {
@@ -1334,6 +1346,11 @@
uv_sad);
x->force_zeromv_skip = 0;
+ const bool is_set_force_zeromv_skip =
+ is_set_force_zeromv_skip_based_on_src_sad(
+ cpi->sf.rt_sf.set_zeromv_skip_based_on_source_sad,
+ x->content_state_sb.source_sad_nonrd);
+
const unsigned int thresh_exit_part =
(cm->seq_params->sb_size == BLOCK_64X64) ? 5000 : 10000;
// If the superblock is completely static (zero source sad) and
@@ -1345,8 +1362,7 @@
if (!is_key_frame && cpi->sf.rt_sf.part_early_exit_zeromv &&
cpi->oxcf.q_cfg.aq_mode == CYCLIC_REFRESH_AQ &&
cpi->cyclic_refresh->apply_cyclic_refresh &&
- segment_id == CR_SEGMENT_ID_BASE &&
- x->content_state_sb.source_sad_nonrd == kZeroSad &&
+ segment_id == CR_SEGMENT_ID_BASE && is_set_force_zeromv_skip &&
ref_frame_partition == LAST_FRAME && xd->mi[0]->mv[0].as_int == 0 &&
y_sad < thresh_exit_part && uv_sad[0]<(3 * thresh_exit_part)>> 2 &&
uv_sad[1]<(3 * thresh_exit_part)>> 2) {