summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_speed_features.c
diff options
context:
space:
mode:
authorJerome Jiang <jianj@google.com>2019-02-08 15:11:28 -0800
committerJerome Jiang <jianj@google.com>2019-02-11 14:03:50 -0800
commit793c45305ea5617d36a71a4866498c9128cdbce0 (patch)
treee1018e927c144a863382772c7b0372ea9e5e1901 /vp9/encoder/vp9_speed_features.c
parent51da38f8ab087ca554c47e387ad9aff3f38d379f (diff)
downloadlibvpx-793c45305ea5617d36a71a4866498c9128cdbce0.tar
libvpx-793c45305ea5617d36a71a4866498c9128cdbce0.tar.gz
libvpx-793c45305ea5617d36a71a4866498c9128cdbce0.tar.bz2
libvpx-793c45305ea5617d36a71a4866498c9128cdbce0.zip
vp9: ML var partition as speed feature & cleanup.
Remove it from runtime flag. Add new struct for rd ml partition. BUG=webm:1599 Change-Id: I883edbba83c65b7e557b8832419e212cffc85997
Diffstat (limited to 'vp9/encoder/vp9_speed_features.c')
-rw-r--r--vp9/encoder/vp9_speed_features.c115
1 files changed, 54 insertions, 61 deletions
diff --git a/vp9/encoder/vp9_speed_features.c b/vp9/encoder/vp9_speed_features.c
index 0ba3edf7f..7c567a14c 100644
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -76,27 +76,27 @@ static void set_good_speed_feature_framesize_dependent(VP9_COMP *cpi,
if (is_480p_or_larger) {
// Currently, the machine-learning based partition search early termination
// is only used while VPXMIN(cm->width, cm->height) >= 480 and speed = 0.
- sf->ml_partition_search_early_termination = 1;
+ sf->rd_ml_partition.search_early_termination = 1;
} else {
sf->use_square_only_thresh_high = BLOCK_32X32;
}
if (!is_1080p_or_larger) {
- sf->use_ml_partition_search_breakout = 1;
+ sf->rd_ml_partition.search_breakout = 1;
if (is_720p_or_larger) {
- sf->ml_partition_search_breakout_thresh[0] = 0.0f;
- sf->ml_partition_search_breakout_thresh[1] = 0.0f;
- sf->ml_partition_search_breakout_thresh[2] = 0.0f;
+ sf->rd_ml_partition.search_breakout_thresh[0] = 0.0f;
+ sf->rd_ml_partition.search_breakout_thresh[1] = 0.0f;
+ sf->rd_ml_partition.search_breakout_thresh[2] = 0.0f;
} else {
- sf->ml_partition_search_breakout_thresh[0] = 2.5f;
- sf->ml_partition_search_breakout_thresh[1] = 1.5f;
- sf->ml_partition_search_breakout_thresh[2] = 1.5f;
+ sf->rd_ml_partition.search_breakout_thresh[0] = 2.5f;
+ sf->rd_ml_partition.search_breakout_thresh[1] = 1.5f;
+ sf->rd_ml_partition.search_breakout_thresh[2] = 1.5f;
}
}
if (speed >= 1) {
- sf->ml_partition_search_early_termination = 0;
- sf->use_ml_partition_search_breakout = 1;
+ sf->rd_ml_partition.search_early_termination = 0;
+ sf->rd_ml_partition.search_breakout = 1;
if (is_480p_or_larger)
sf->use_square_only_thresh_high = BLOCK_64X64;
else
@@ -106,21 +106,21 @@ static void set_good_speed_feature_framesize_dependent(VP9_COMP *cpi,
sf->disable_split_mask =
cm->show_frame ? DISABLE_ALL_SPLIT : DISABLE_ALL_INTER_SPLIT;
sf->partition_search_breakout_thr.dist = (1 << 22);
- sf->ml_partition_search_breakout_thresh[0] = -5.0f;
- sf->ml_partition_search_breakout_thresh[1] = -5.0f;
- sf->ml_partition_search_breakout_thresh[2] = -9.0f;
+ sf->rd_ml_partition.search_breakout_thresh[0] = -5.0f;
+ sf->rd_ml_partition.search_breakout_thresh[1] = -5.0f;
+ sf->rd_ml_partition.search_breakout_thresh[2] = -9.0f;
} else {
sf->disable_split_mask = DISABLE_COMPOUND_SPLIT;
sf->partition_search_breakout_thr.dist = (1 << 21);
- sf->ml_partition_search_breakout_thresh[0] = -1.0f;
- sf->ml_partition_search_breakout_thresh[1] = -1.0f;
- sf->ml_partition_search_breakout_thresh[2] = -1.0f;
+ sf->rd_ml_partition.search_breakout_thresh[0] = -1.0f;
+ sf->rd_ml_partition.search_breakout_thresh[1] = -1.0f;
+ sf->rd_ml_partition.search_breakout_thresh[2] = -1.0f;
}
#if CONFIG_VP9_HIGHBITDEPTH
if (cpi->Source->flags & YV12_FLAG_HIGHBITDEPTH) {
- sf->ml_partition_search_breakout_thresh[0] -= 1.0f;
- sf->ml_partition_search_breakout_thresh[1] -= 1.0f;
- sf->ml_partition_search_breakout_thresh[2] -= 1.0f;
+ sf->rd_ml_partition.search_breakout_thresh[0] -= 1.0f;
+ sf->rd_ml_partition.search_breakout_thresh[1] -= 1.0f;
+ sf->rd_ml_partition.search_breakout_thresh[2] -= 1.0f;
}
#endif // CONFIG_VP9_HIGHBITDEPTH
}
@@ -134,14 +134,14 @@ static void set_good_speed_feature_framesize_dependent(VP9_COMP *cpi,
sf->adaptive_pred_interp_filter = 0;
sf->partition_search_breakout_thr.dist = (1 << 24);
sf->partition_search_breakout_thr.rate = 120;
- sf->use_ml_partition_search_breakout = 0;
+ sf->rd_ml_partition.search_breakout = 0;
} else {
sf->disable_split_mask = LAST_AND_INTRA_SPLIT_ONLY;
sf->partition_search_breakout_thr.dist = (1 << 22);
sf->partition_search_breakout_thr.rate = 100;
- sf->ml_partition_search_breakout_thresh[0] = 0.0f;
- sf->ml_partition_search_breakout_thresh[1] = -1.0f;
- sf->ml_partition_search_breakout_thresh[2] = -4.0f;
+ sf->rd_ml_partition.search_breakout_thresh[0] = 0.0f;
+ sf->rd_ml_partition.search_breakout_thresh[1] = -1.0f;
+ sf->rd_ml_partition.search_breakout_thresh[2] = -4.0f;
}
sf->rd_auto_partition_min_limit = set_partition_min_limit(cm);
@@ -158,7 +158,7 @@ static void set_good_speed_feature_framesize_dependent(VP9_COMP *cpi,
}
if (speed >= 3) {
- sf->use_ml_partition_search_breakout = 0;
+ sf->rd_ml_partition.search_breakout = 0;
if (is_720p_or_larger) {
sf->disable_split_mask = DISABLE_ALL_SPLIT;
sf->schedule_mode_search = cm->base_qindex < 220 ? 1 : 0;
@@ -215,12 +215,12 @@ static void set_good_speed_feature_framesize_independent(VP9_COMP *cpi,
sf->less_rectangular_check = 1;
sf->use_square_partition_only = !boosted;
sf->prune_ref_frame_for_rect_partitions = 1;
- sf->ml_var_partition_pruning = 1;
+ sf->rd_ml_partition.var_pruning = 1;
- sf->ml_prune_rect_partition_threhold[0] = -1;
- sf->ml_prune_rect_partition_threhold[1] = 350;
- sf->ml_prune_rect_partition_threhold[2] = 325;
- sf->ml_prune_rect_partition_threhold[3] = 250;
+ sf->rd_ml_partition.prune_rect_thresh[0] = -1;
+ sf->rd_ml_partition.prune_rect_thresh[1] = 350;
+ sf->rd_ml_partition.prune_rect_thresh[2] = 325;
+ sf->rd_ml_partition.prune_rect_thresh[3] = 250;
if (cpi->twopass.fr_content_type == FC_GRAPHICS_ANIMATION) {
sf->exhaustive_searches_thresh = (1 << 22);
@@ -238,10 +238,10 @@ static void set_good_speed_feature_framesize_independent(VP9_COMP *cpi,
if (speed >= 1) {
sf->temporal_filter_search_method = NSTEP;
- sf->ml_var_partition_pruning = !boosted;
- sf->ml_prune_rect_partition_threhold[1] = 225;
- sf->ml_prune_rect_partition_threhold[2] = 225;
- sf->ml_prune_rect_partition_threhold[3] = 225;
+ sf->rd_ml_partition.var_pruning = !boosted;
+ sf->rd_ml_partition.prune_rect_thresh[1] = 225;
+ sf->rd_ml_partition.prune_rect_thresh[2] = 225;
+ sf->rd_ml_partition.prune_rect_thresh[3] = 225;
if (oxcf->pass == 2) {
TWO_PASS *const twopass = &cpi->twopass;
@@ -284,7 +284,7 @@ static void set_good_speed_feature_framesize_independent(VP9_COMP *cpi,
}
if (speed >= 2) {
- sf->ml_var_partition_pruning = 0;
+ sf->rd_ml_partition.var_pruning = 0;
if (oxcf->vbr_corpus_complexity)
sf->recode_loop = ALLOW_RECODE_FIRST;
else
@@ -308,9 +308,9 @@ static void set_good_speed_feature_framesize_independent(VP9_COMP *cpi,
sf->recode_tolerance_high = 45;
sf->enhanced_full_pixel_motion_search = 0;
sf->prune_ref_frame_for_rect_partitions = 0;
- sf->ml_prune_rect_partition_threhold[1] = -1;
- sf->ml_prune_rect_partition_threhold[2] = -1;
- sf->ml_prune_rect_partition_threhold[3] = -1;
+ sf->rd_ml_partition.prune_rect_thresh[1] = -1;
+ sf->rd_ml_partition.prune_rect_thresh[2] = -1;
+ sf->rd_ml_partition.prune_rect_thresh[3] = -1;
sf->mv.subpel_search_level = 0;
if (cpi->twopass.fr_content_type == FC_GRAPHICS_ANIMATION) {
@@ -448,6 +448,7 @@ static void set_rt_speed_feature_framesize_independent(
sf->enable_tpl_model = 0;
sf->enhanced_full_pixel_motion_search = 0;
sf->use_accurate_subpel_search = USE_2_TAPS;
+ sf->nonrd_use_ml_partition = 0;
if (speed >= 1) {
sf->allow_txfm_domain_distortion = 1;
@@ -563,16 +564,14 @@ static void set_rt_speed_feature_framesize_independent(
(frames_since_key % (sf->last_partitioning_redo_frequency << 1) == 1);
sf->max_delta_qindex = is_keyframe ? 20 : 15;
sf->partition_search_type = REFERENCE_PARTITION;
-#if CONFIG_ML_VAR_PARTITION
- if (!frame_is_intra_only(cm) && cm->width >= 360 && cm->height >= 360)
- sf->partition_search_type = ML_BASED_PARTITION;
- else
- sf->partition_search_type = REFERENCE_PARTITION;
+ if (sf->nonrd_use_ml_partition) {
+ if (!frame_is_intra_only(cm) && cm->width >= 360 && cm->height >= 360)
+ sf->partition_search_type = ML_BASED_PARTITION;
#if CONFIG_VP9_HIGHBITDEPTH
- if (cpi->Source->flags & YV12_FLAG_HIGHBITDEPTH)
- sf->partition_search_type = REFERENCE_PARTITION;
+ if (cpi->Source->flags & YV12_FLAG_HIGHBITDEPTH)
+ sf->partition_search_type = REFERENCE_PARTITION;
#endif // CONFIG_VP9_HIGHBITDEPTH
-#endif // CONFIG_ML_VAR_PARTITION
+ }
if (cpi->oxcf.rc_mode == VPX_VBR && cpi->oxcf.lag_in_frames > 0 &&
cpi->rc.is_src_frame_alt_ref) {
sf->partition_search_type = VAR_BASED_PARTITION;
@@ -633,16 +632,10 @@ static void set_rt_speed_feature_framesize_independent(
sf->use_altref_onepass = 1;
sf->use_compound_nonrd_pickmode = 1;
}
-#if CONFIG_ML_VAR_PARTITION
- if (frame_is_intra_only(cm) || cm->width < 360 || cm->height < 360)
- sf->partition_search_type = VAR_BASED_PARTITION;
-#if CONFIG_VP9_HIGHBITDEPTH
- if (cpi->Source->flags & YV12_FLAG_HIGHBITDEPTH)
+
+ if (!sf->nonrd_use_ml_partition)
sf->partition_search_type = VAR_BASED_PARTITION;
-#endif // CONFIG_VP9_HIGHBITDEPTH
-#else
- sf->partition_search_type = VAR_BASED_PARTITION;
-#endif // CONFIG_ML_VAR_PARTITION
+
sf->mv.search_method = NSTEP;
sf->mv.reduce_first_step_size = 1;
sf->skip_encode_sb = 0;
@@ -815,8 +808,8 @@ void vp9_set_speed_features_framesize_dependent(VP9_COMP *cpi) {
// Some speed-up features even for best quality as minimal impact on quality.
sf->partition_search_breakout_thr.dist = (1 << 19);
sf->partition_search_breakout_thr.rate = 80;
- sf->ml_partition_search_early_termination = 0;
- sf->use_ml_partition_search_breakout = 0;
+ sf->rd_ml_partition.search_early_termination = 0;
+ sf->rd_ml_partition.search_breakout = 0;
if (oxcf->mode == REALTIME) {
set_rt_speed_feature_framesize_dependent(cpi, sf, oxcf->speed);
@@ -941,11 +934,11 @@ void vp9_set_speed_features_framesize_independent(VP9_COMP *cpi) {
sf->limit_newmv_early_exit = 0;
sf->bias_golden = 0;
sf->base_mv_aggressive = 0;
- sf->ml_prune_rect_partition_threhold[0] = -1;
- sf->ml_prune_rect_partition_threhold[1] = -1;
- sf->ml_prune_rect_partition_threhold[2] = -1;
- sf->ml_prune_rect_partition_threhold[3] = -1;
- sf->ml_var_partition_pruning = 0;
+ sf->rd_ml_partition.prune_rect_thresh[0] = -1;
+ sf->rd_ml_partition.prune_rect_thresh[1] = -1;
+ sf->rd_ml_partition.prune_rect_thresh[2] = -1;
+ sf->rd_ml_partition.prune_rect_thresh[3] = -1;
+ sf->rd_ml_partition.var_pruning = 0;
sf->use_accurate_subpel_search = USE_8_TAPS;
// Some speed-up features even for best quality as minimal impact on quality.