]> granicus.if.org Git - libvpx/commitdiff
Add a partition search breakout model
authorHui Su <huisu@google.com>
Fri, 22 Jun 2018 04:03:37 +0000 (21:03 -0700)
committerHui Su <huisu@google.com>
Sun, 24 Jun 2018 23:04:50 +0000 (16:04 -0700)
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

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

index f6fcd9d3345b12863812a29a2d01734ff9743065..d7faa4be9cd5601220f30088193912843bc6e41a 100644 (file)
@@ -3319,7 +3319,7 @@ static int ml_pruning_partition(VP9_COMMON *const cm, MACROBLOCKD *const xd,
 }
 
 #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 @@ static const float partition_breakout_weights_64[Q_CTX][FEATURES + 1] = {
       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 @@ static const float partition_breakout_weights_32[Q_CTX][FEATURES + 1] = {
       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 @@ static const float partition_breakout_weights_16[Q_CTX][FEATURES + 1] = {
       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 @@ static const float partition_breakout_weights_8[Q_CTX][FEATURES + 1] = {
       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 @@ static int ml_predict_breakout(const VP9_COMP *const cpi, BLOCK_SIZE bsize,
   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 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td,
           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;
index 7a02623dc1bf5e1c71eee4c5b6f6c807b3cef127..b9f8055bc4cd296b77c62bdff43c70f86f4ddab3 100644 (file)
@@ -85,6 +85,7 @@ static void set_good_speed_feature_framesize_dependent(VP9_COMP *cpi,
       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 @@ static void set_good_speed_feature_framesize_dependent(VP9_COMP *cpi,
       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);
 
index 7a9b3a62242a2fdf576d0507977dc3ba1ecf63d0..7a591e491a60cadabb915cd96de81adb258ab238 100644 (file)
@@ -472,7 +472,7 @@ typedef struct SPEED_FEATURES {
 
   // 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;