]> granicus.if.org Git - libvpx/commitdiff
ML_VAR_PARTITION: enable at speed 5
authorHui Su <huisu@google.com>
Tue, 16 Oct 2018 03:45:07 +0000 (20:45 -0700)
committerHui Su <huisu@google.com>
Thu, 18 Oct 2018 21:41:25 +0000 (14:41 -0700)
When the ML_VAR_PARTITION experiment is turned on, replace
REFERENCE_PARTITION with ML_BASED_PARTITION at speed 5.

Coding gains(avg_psnr) compared to baseline:
ytlivehr  1.63%
ytlivelr  0.07%

Tested encoding speed with several clips from ytlivehr and ytlivelr
on linux desktop(rt, vbr, 4 threads). Encoder speed is on average
faster than baseline:
360p:   14% faster
720p:    7% faster
1080p: 1.5% faster

Change-Id: I39b00078176ff516f7306818f33ba2b1ea53dfa1

vp9/encoder/vp9_encodeframe.c
vp9/encoder/vp9_speed_features.c

index bdd5b39c1967d6c4444f7b0b2199bd0fbf294a7d..8645963b793f2227c158e7cc1cd707c2bfa8ef9d 100644 (file)
@@ -4539,7 +4539,7 @@ static int ml_predict_var_paritioning(VP9_COMP *cpi, MACROBLOCK *x,
   vpx_clear_system_state();
 
   {
-    const float thresh = 0.0f;
+    const float thresh = cpi->oxcf.speed <= 5 ? 1.25f : 0.0f;
     float features[FEATURES] = { 0.0f };
     const int dc_q = vp9_dc_quant(cm->base_qindex, 0, cm->bit_depth);
     int feature_idx = 0;
@@ -4581,7 +4581,7 @@ static int ml_predict_var_paritioning(VP9_COMP *cpi, MACROBLOCK *x,
     assert(feature_idx == FEATURES);
     nn_predict(features, nn_config, score);
     if (score[0] > thresh) return PARTITION_SPLIT;
-    if (score[0] < thresh) return PARTITION_NONE;
+    if (score[0] < -thresh) return PARTITION_NONE;
     return -1;
   }
 }
index 87b417a4b0bf5ea7c1ca032c4ae121e11794ba56..6f3a97caa8893f401451739a59330ef784447ae6 100644 (file)
@@ -570,6 +570,16 @@ 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 CONFIG_VP9_HIGHBITDEPTH
+    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;
@@ -631,9 +641,7 @@ static void set_rt_speed_feature_framesize_independent(
       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 = ML_BASED_PARTITION;
-    else
+    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)