rtc: Tune the sf reduce_mv_pel_precision_highmotion
The sf reduce_mv_pel_precision_highmotion is extended to cpu 9
rtc testset using a newly introduced sf level 1. The new level
reduce_mv_pel_precision_highmotion == 1 is less aggressive than
the existing reduce_mv_pel_precision_highmotion == 2, in terms of
integer mv thresholds for various block sizes. The new level
reduces the mv pel precision to halfpel/fullpel based on
two related thresholds. It turns out that for cpu 10 rtc-derf,
reduce_mv_pel_precision_highmotion == 1 works out better.
The speed-up / quality trade off:
--------------------------------------------------------------
|cpu | Testset | Instr. Count | BD-Rate Drop (%) |
| | | Reduction(%) | avg. psnr | ovr. psnr| ssim |
--------------------------------------------------------------
| 9 | rtc | 1.043 | 0.2093 | 0.2149 | 0.2319 |
| 10 | rtc_derf| -0.797 | -0.5332 | -0.5256 | -0.6321 |
--------------------------------------------------------------
No changes to speed 7,8
No changes to speed 9 rtc-derf, speed 10 rtc and rtc-screen sets
STATS_CHANGED for rt
Change-Id: I2cab3485f46dbaef6c5a6f74d86aff9d18fa7fa2
diff --git a/av1/encoder/nonrd_pickmode.c b/av1/encoder/nonrd_pickmode.c
index eb29cf2..eb28c1e 100644
--- a/av1/encoder/nonrd_pickmode.c
+++ b/av1/encoder/nonrd_pickmode.c
@@ -177,18 +177,30 @@
static INLINE int subpel_select(AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
int_mv *mv, MV ref_mv, FULLPEL_MV start_mv,
bool fullpel_performed_well) {
- // Reduce MV precision to halfpel for higher int MV value& frame-level motion
- if (cpi->sf.rt_sf.reduce_mv_pel_precision_highmotion == 1) {
+ const int frame_lowmotion = cpi->rc.avg_frame_low_motion;
+ // Reduce MV precision for higher int MV value & frame-level motion
+ if (cpi->sf.rt_sf.reduce_mv_pel_precision_highmotion >= 2) {
int mv_thresh = 4;
const int is_low_resoln =
(cpi->common.width * cpi->common.height <= 320 * 240);
mv_thresh = (bsize > BLOCK_32X32) ? 2 : (bsize > BLOCK_16X16) ? 4 : 6;
- if (cpi->rc.avg_frame_low_motion > 0 && cpi->rc.avg_frame_low_motion < 40)
- mv_thresh = 12;
+ if (frame_lowmotion > 0 && frame_lowmotion < 40) mv_thresh = 12;
mv_thresh = (is_low_resoln) ? mv_thresh >> 1 : mv_thresh;
if (abs(mv->as_fullmv.row) >= mv_thresh ||
abs(mv->as_fullmv.col) >= mv_thresh)
return HALF_PEL;
+ } else if (cpi->sf.rt_sf.reduce_mv_pel_precision_highmotion >= 1) {
+ int mv_thresh;
+ if (frame_lowmotion > 0 && frame_lowmotion < 40)
+ mv_thresh = 12;
+ else
+ mv_thresh = (bsize >= BLOCK_32X32) ? 4 : (bsize >= BLOCK_16X16) ? 6 : 8;
+ if (abs(mv->as_fullmv.row) >= (mv_thresh << 1) ||
+ abs(mv->as_fullmv.col) >= (mv_thresh << 1))
+ return FULL_PEL;
+ else if (abs(mv->as_fullmv.row) >= mv_thresh ||
+ abs(mv->as_fullmv.col) >= mv_thresh)
+ return HALF_PEL;
}
// Reduce MV precision for relatively static (e.g. background), low-complex
// large areas
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 9f11e87..ed3e9b4 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -1295,6 +1295,7 @@
sf->rt_sf.skip_intra_pred = 2;
sf->rt_sf.hybrid_intra_pickmode = 3;
sf->rt_sf.reduce_mv_pel_precision_lowcomplex = 1;
+ sf->rt_sf.reduce_mv_pel_precision_highmotion = 1;
}
} else {
sf->rt_sf.prune_intra_mode_based_on_mv_range = 2;
@@ -1320,12 +1321,13 @@
sf->rt_sf.gf_length_lvl = 1;
sf->rt_sf.skip_cdef_sb = 1;
sf->rt_sf.sad_based_adp_altref_lag = 2;
+ sf->rt_sf.reduce_mv_pel_precision_highmotion = 1;
}
-
if (speed >= 10) {
sf->rt_sf.hybrid_intra_pickmode = 2;
sf->rt_sf.sad_based_adp_altref_lag = 4;
sf->rt_sf.tx_size_level_based_on_qstep = 0;
+ sf->rt_sf.reduce_mv_pel_precision_highmotion = 2;
}
}
if (!is_480p_or_larger) {
@@ -1351,10 +1353,7 @@
sf->rt_sf.sad_based_adp_altref_lag = 1;
sf->rt_sf.reduce_mv_pel_precision_lowcomplex = 0;
}
- if (speed >= 10) {
- sf->rt_sf.sad_based_adp_altref_lag = 3;
- sf->rt_sf.reduce_mv_pel_precision_highmotion = 1;
- }
+ if (speed >= 10) sf->rt_sf.sad_based_adp_altref_lag = 3;
}
// Setting for SVC, or when the ref_frame_config control is
// used to set the reference structure.
@@ -1375,7 +1374,7 @@
}
if (speed >= 8) {
sf->rt_sf.disable_cdf_update_non_reference_frame = true;
- sf->rt_sf.reduce_mv_pel_precision_highmotion = 1;
+ sf->rt_sf.reduce_mv_pel_precision_highmotion = 2;
if (rtc_ref->non_reference_frame) {
sf->rt_sf.nonrd_agressive_skip = 1;
sf->mv_sf.subpel_search_method = SUBPEL_TREE_PRUNED_MORE;
@@ -1413,7 +1412,7 @@
sf->rt_sf.nonrd_prune_ref_frame_search = 3;
sf->rt_sf.var_part_split_threshold_shift = 10;
sf->mv_sf.subpel_search_method = SUBPEL_TREE_PRUNED_MORE;
- sf->rt_sf.reduce_mv_pel_precision_highmotion = 1;
+ sf->rt_sf.reduce_mv_pel_precision_highmotion = 2;
sf->rt_sf.reduce_mv_pel_precision_lowcomplex = 1;
sf->rt_sf.screen_content_cdef_filter_qindex_thresh = 20;
}
@@ -1739,7 +1738,6 @@
sf->rt_sf.nonrd_prune_ref_frame_search = 3;
sf->rt_sf.var_part_split_threshold_shift = 10;
sf->mv_sf.subpel_search_method = SUBPEL_TREE_PRUNED_MORE;
- sf->rt_sf.reduce_mv_pel_precision_highmotion = 1;
}
}
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index 4cbce7d..1888e23 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -1506,6 +1506,9 @@
int prune_inter_modes_using_temp_var;
// Reduce MV precision to halfpel for higher int MV value & frame-level motion
+ // 0: disabled
+ // 1: Reduce precision to halfpel, fullpel based on conservative thresholds
+ // 2: Reduce precision to halfpel using more aggressive thresholds
int reduce_mv_pel_precision_highmotion;
// Reduce MV precision for low complexity blocks