shithub: libvpx

Download patch

ref: 1fcbf6ed56266939403e75957a363de633f455b2
parent: 14ee2805a3b2e9c51d677d834326256b1ada1690
author: Yunqing Wang <[email protected]>
date: Wed Sep 24 08:12:25 EDT 2014

Skip the partition search for still frames

This patch re-enabled the feature in Pengchong's patch
(commit 12861260732a4fd5f6b667ce9d5105dc9b606eda). Originally, it
was turned on while use_lastframe_partitioning > 0(not used anymore).
Now it was added as a feature, and turned on while speed >= 2.
As described in the original patch, this feature helps speed up the
slideshows in YouTube.

Change-Id: I1b0f18d65da1ee1c8d1e117dabba910c5207c471

--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -2490,7 +2490,7 @@
                              sf->always_this_block_size);
       rd_use_partition(cpi, tile, mi, tp, mi_row, mi_col, BLOCK_64X64,
                        &dummy_rate, &dummy_dist, 1, cpi->pc_root);
-    } else if ((sf->use_lastframe_partitioning && cpi->skippable_frame) ||
+    } else if (cpi->partition_search_skippable_frame ||
                sf->partition_search_type == VAR_BASED_FIXED_PARTITION) {
       BLOCK_SIZE bsize;
       set_offsets(cpi, tile, mi_row, mi_col, BLOCK_64X64);
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -772,7 +772,7 @@
   vp9_rc_init(&cpi->oxcf, oxcf->pass, &cpi->rc);
 
   cm->current_video_frame = 0;
-  cpi->skippable_frame = 0;
+  cpi->partition_search_skippable_frame = 0;
 
   // Create the encoder segmentation map and set all entries to 0
   CHECK_MEM_ERROR(cm, cpi->segmentation_map,
@@ -2203,9 +2203,9 @@
 
   // Check if the current frame is skippable for the partition search in the
   // second pass according to the first pass stats
-  if (oxcf->pass == 2 &&
+  if (cpi->sf.allow_partition_search_skip && oxcf->pass == 2 &&
       (!cpi->use_svc || is_two_pass_svc(cpi))) {
-    cpi->skippable_frame = is_skippable_frame(cpi);
+    cpi->partition_search_skippable_frame = is_skippable_frame(cpi);
   }
 
   // For 1 pass CBR, check if we are dropping this frame.
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -241,7 +241,8 @@
   YV12_BUFFER_CONFIG *unscaled_last_source;
   YV12_BUFFER_CONFIG scaled_last_source;
 
-  int skippable_frame;
+  // For a still frame, this flag is set to 1 to skip partition search.
+  int partition_search_skippable_frame;
 
   int scaled_ref_idx[3];
   int lst_fb_idx;
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -88,6 +88,8 @@
     else
       sf->partition_search_breakout_dist_thr = (1 << 22);
     sf->partition_search_breakout_rate_thr = 700;
+
+    sf->allow_partition_search_skip = 1;
   }
 
   if (speed >= 3) {
@@ -365,6 +367,7 @@
   sf->max_delta_qindex = 0;
   sf->disable_filter_search_var_thresh = 0;
   sf->adaptive_interp_filter_search = 0;
+  sf->allow_partition_search_skip = 0;
 
   for (i = 0; i < TX_SIZES; i++) {
     sf->intra_y_mode_mask[i] = INTRA_ALL;
--- a/vp9/encoder/vp9_speed_features.h
+++ b/vp9/encoder/vp9_speed_features.h
@@ -435,6 +435,9 @@
   // Partition search early breakout thresholds.
   int64_t partition_search_breakout_dist_thr;
   int partition_search_breakout_rate_thr;
+
+  // Allow skipping partition search for still image frame
+  int allow_partition_search_skip;
 } SPEED_FEATURES;
 
 struct VP9_COMP;