shithub: libvpx

Download patch

ref: bb226f61ddbea5fad0e192fb6ba259962c1f2617
parent: 4a42d0918e199233723195ea0c9561a2343df1bd
author: Hui Su <[email protected]>
date: Thu Jun 21 17:03:37 EDT 2018

Add a partition search breakout model

for q-index between 100 and 150.

This only affects speed 1 and 2, resolution under 720p, q-index between
100 and 150, low bit-depth.

Compression performane change is neutral.
Encoding speed gain is up to 16% for speed 1;
                       up to  6% for speed 2.

Results from encoding city_4cif_30fps:
speed 1, QP=36
before:  37.964 dB, 45581b/f, 2.73 fps
after:   37.958 dB, 45510b/f, 3.16 fps

speed 1, QP=28
before:  39.297 dB, 82452b/f, 2.14 fps
after:   39.297 dB, 82310b/f, 2.25 fps

speed 2, QP=36
before:  37.903 dB, 45586b/f, 4.08 fps
after:   37.895 dB, 45492b/f, 4.34 fps

speed 2, QP=28
before:  39.224 dB, 82272b/f, 3.03 fps
after:   39.223 dB, 82152b/f, 3.17 fps

Change-Id: Ieaefedad902df80aa9699545fa06294601955803

--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -3319,7 +3319,7 @@
 }
 
 #define FEATURES 4
-#define Q_CTX 2
+#define Q_CTX 3
 static const float partition_breakout_weights_64[Q_CTX][FEATURES + 1] = {
   {
       -0.016673f,
@@ -3335,6 +3335,13 @@
       0.002448f,
       1.65738142f - 2.5f,
   },
+  {
+      -0.628934f,
+      -0.011459f,
+      -0.000009f,
+      0.013833f,
+      1.47982645f - 1.6f,
+  },
 };
 
 static const float partition_breakout_weights_32[Q_CTX][FEATURES + 1] = {
@@ -3352,6 +3359,13 @@
       0.009792f,
       1.28089404f - 2.5f,
   },
+  {
+      -0.163097f,
+      -0.013081f,
+      0.000022f,
+      0.019006f,
+      1.36129403f - 3.2f,
+  },
 };
 
 static const float partition_breakout_weights_16[Q_CTX][FEATURES + 1] = {
@@ -3369,6 +3383,13 @@
       0.008187f,
       2.15043926f - 2.5f,
   },
+  {
+      -0.075755f,
+      -0.010858f,
+      0.000030f,
+      0.024505f,
+      2.06848121f - 2.5f,
+  },
 };
 
 static const float partition_breakout_weights_8[Q_CTX][FEATURES + 1] = {
@@ -3386,6 +3407,13 @@
       0.013876f,
       1.96755111f - 1.5f,
   },
+  {
+      -0.013522f,
+      -0.008677f,
+      -0.000562f,
+      0.034468f,
+      1.53440356f - 1.5f,
+  },
 };
 
 // ML-based partition search breakout.
@@ -3398,7 +3426,7 @@
   const float *linear_weights = NULL;  // Linear model weights.
   float linear_score = 0.0f;
   const int qindex = cm->base_qindex;
-  const int q_ctx = qindex >= 200 ? 0 : 1;
+  const int q_ctx = qindex >= 200 ? 0 : (qindex >= 150 ? 1 : 2);
 
   switch (bsize) {
     case BLOCK_64X64:
@@ -3641,7 +3669,7 @@
           if (!x->e_mbd.lossless && ctx->skippable) {
             int use_ml_based_breakout =
                 cpi->sf.use_ml_partition_search_breakout &&
-                cm->base_qindex >= 150;
+                cm->base_qindex >= 100;
 #if CONFIG_VP9_HIGHBITDEPTH
             if (x->e_mbd.cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
               use_ml_based_breakout = 0;
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -85,6 +85,7 @@
       sf->use_ml_partition_search_breakout = 1;
       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;
     }
   }
 
@@ -101,6 +102,7 @@
       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_auto_partition_min_limit = set_partition_min_limit(cm);
 
--- a/vp9/encoder/vp9_speed_features.h
+++ b/vp9/encoder/vp9_speed_features.h
@@ -472,7 +472,7 @@
 
   // Use ML-based partition search early breakout.
   int use_ml_partition_search_breakout;
-  float ml_partition_search_breakout_thresh[2];
+  float ml_partition_search_breakout_thresh[3];
 
   // Machine-learning based partition search early termination
   int ml_partition_search_early_termination;