shithub: libvpx

Download patch

ref: 4fc3dadb3223d6d68878502b4e80d0a0e1dd3f5a
parent: bd6b274dc04b75289ae3403564f03c2717b878d1
parent: bb226f61ddbea5fad0e192fb6ba259962c1f2617
author: Hui Su <huisu@google.com>
date: Mon Jun 25 13:58:23 EDT 2018

Merge "Add a partition search breakout model"

--- 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;