shithub: libvpx

Download patch

ref: 49b7e8cda4420d9a4ee307c49dfa74e5e978dab3
parent: 6b7848d4c9016efbfbc9529df008ffde0e15b7cc
author: Hui Su <huisu@google.com>
date: Wed Oct 3 05:07:07 EDT 2018

ML_VAR_PARTITION: adjust model threshold

Make decisions more aggressively to improve encoding speed.

Coding gains(avg-psnr) after this change over baseline:
rtc       1.55% for speed 7;  2.89% for speed 8.
ytlivehr  2.20% for speed 6.

Change-Id: If6ac4a942a5b4708bcc6b0a49bd92fbc4d67c3f8

--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -4505,15 +4505,9 @@
                                       int mi_col) {
   VP9_COMMON *const cm = &cpi->common;
   const NN_CONFIG *nn_config = NULL;
-  float thresh_low = -0.2f;
-  float thresh_high = 0.0f;
 
   switch (bsize) {
-    case BLOCK_64X64:
-      nn_config = &vp9_var_part_nnconfig_64;
-      thresh_low = -0.3f;
-      thresh_high = -0.1f;
-      break;
+    case BLOCK_64X64: nn_config = &vp9_var_part_nnconfig_64; break;
     case BLOCK_32X32: nn_config = &vp9_var_part_nnconfig_32; break;
     case BLOCK_16X16: nn_config = &vp9_var_part_nnconfig_16; break;
     case BLOCK_8X8: break;
@@ -4525,6 +4519,7 @@
   vpx_clear_system_state();
 
   {
+    const float thresh = 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;
@@ -4565,8 +4560,8 @@
 
     assert(feature_idx == FEATURES);
     nn_predict(features, nn_config, score);
-    if (score[0] > thresh_high) return 3;
-    if (score[0] < thresh_low) return 0;
+    if (score[0] > thresh) return PARTITION_SPLIT;
+    if (score[0] < thresh) return PARTITION_NONE;
     return -1;
   }
 }
@@ -4644,8 +4639,8 @@
     if (partition_none_allowed && do_split) {
       const int ml_predicted_partition =
           ml_predict_var_paritioning(cpi, x, bsize, mi_row, mi_col);
-      if (ml_predicted_partition == 0) do_split = 0;
-      if (ml_predicted_partition == 3) partition_none_allowed = 0;
+      if (ml_predicted_partition == PARTITION_NONE) do_split = 0;
+      if (ml_predicted_partition == PARTITION_SPLIT) partition_none_allowed = 0;
     }
   }
 #endif  // CONFIG_ML_VAR_PARTITION