shithub: libvpx

Download patch

ref: 18bdf708e7f5bc473d8000ba4d17806ecaaa2ba5
parent: 476d73d2949777f105a346d7141dc1e2b04f6a97
author: Jim Bankoski <jimbankoski@google.com>
date: Thu Jun 20 03:46:51 EDT 2013

adds a set partitioning to speed features

this feature lets you set a partitioning size to be used by the entire
frame.

Change-Id: I208a4c8c701375cbb054418266f677768b6f8f06

--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -857,22 +857,14 @@
   }
 }
 
-static void set_partitioning(VP9_COMP *cpi, MODE_INFO *m, BLOCK_SIZE_TYPE bsize) {
-  VP9_COMMON * const cm = &cpi->common;
+static void set_partitioning(VP9_COMP *cpi, MODE_INFO *m,
+                             BLOCK_SIZE_TYPE bsize) {
+  VP9_COMMON *const cm = &cpi->common;
   const int mis = cm->mode_info_stride;
-  int bsl = b_width_log2(bsize);
-  int bs = (1 << bsl) / 2;  //
   int block_row, block_col;
-  int row, col;
-
-  // this test function sets the entire macroblock to the same bsize
-  for (block_row = 0; block_row < 8; block_row += bs) {
-    for (block_col = 0; block_col < 8; block_col += bs) {
-      for (row = 0; row < bs; row++) {
-        for (col = 0; col < bs; col++) {
-          m[(block_row + row) * mis + block_col + col].mbmi.sb_type = bsize;
-        }
-      }
+  for (block_row = 0; block_row < 8; ++block_row) {
+    for (block_col = 0; block_col < 8; ++block_col) {
+      m[block_row * mis + block_col].mbmi.sb_type = bsize;
     }
   }
 }
@@ -1500,12 +1492,18 @@
   for (mi_col = cm->cur_tile_mi_col_start; mi_col < cm->cur_tile_mi_col_end;
       mi_col += 64 / MI_SIZE) {
     int dummy_rate, dummy_dist;
-    if (cpi->sf.partition_by_variance || cpi->sf.use_lastframe_partitioning) {
+    if (cpi->sf.partition_by_variance || cpi->sf.use_lastframe_partitioning ||
+        cpi->sf.use_one_partition_size_always ) {
       const int idx_str = cm->mode_info_stride * mi_row + mi_col;
       MODE_INFO *m = cm->mi + idx_str;
       MODE_INFO *p = cm->prev_mi + idx_str;
 
-      if (cpi->sf.partition_by_variance) {
+      if (cpi->sf.use_one_partition_size_always) {
+        set_offsets(cpi, mi_row, mi_col, BLOCK_SIZE_SB64X64);
+        set_partitioning(cpi, m, cpi->sf.always_this_block_size);
+        rd_use_partition(cpi, m, tp, mi_row, mi_col, BLOCK_SIZE_SB64X64,
+                         &dummy_rate, &dummy_dist);
+      } else if (cpi->sf.partition_by_variance) {
         choose_partitioning(cpi, cm->mi, mi_row, mi_col);
         rd_use_partition(cpi, m, tp, mi_row, mi_col, BLOCK_SIZE_SB64X64,
                          &dummy_rate, &dummy_dist);
@@ -1517,8 +1515,6 @@
           rd_pick_partition(cpi, tp, mi_row, mi_col, BLOCK_SIZE_SB64X64,
                             &dummy_rate, &dummy_dist);
         } else {
-          // set_partitioning(cpi, m, BLOCK_SIZE_SB64X64);
-
           copy_partitioning(cpi, m, p);
           rd_use_partition(cpi, m, tp, mi_row, mi_col, BLOCK_SIZE_SB64X64,
                            &dummy_rate, &dummy_dist);
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -691,6 +691,7 @@
   sf->skip_lots_of_modes = 0;
   sf->adjust_thresholds_by_speed = 0;
   sf->partition_by_variance = 0;
+  sf->use_one_partition_size_always = 0;
 
 #if CONFIG_MULTIPLE_ARF
   // Switch segmentation off.
@@ -727,6 +728,12 @@
         sf->comp_inter_joint_search_thresh = BLOCK_SIZE_SB8X8;
         sf->partition_by_variance = 1;
         sf->first_step = 0;
+      }
+      if (speed == 4) {
+        sf->first_step = 0;
+        sf->comp_inter_joint_search_thresh = BLOCK_SIZE_SB8X8;
+        sf->use_one_partition_size_always = 1;
+        sf->always_this_block_size = BLOCK_SIZE_MB16X16;
       }
      break;
 
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -223,6 +223,8 @@
   int skip_lots_of_modes;
   int adjust_thresholds_by_speed;
   int partition_by_variance;
+  int use_one_partition_size_always;
+  BLOCK_SIZE_TYPE always_this_block_size;
 } SPEED_FEATURES;
 
 enum BlockSize {