shithub: libvpx

Download patch

ref: 6e086548cbb7c6802b5f0cfacd60600f6ae6e45b
parent: 02b2c167751052de1b3b38115dfe09c86313bcf5
parent: 0daadeb60c14ebb1c1657f2091dc7abc30640970
author: Jingning Han <[email protected]>
date: Wed Aug 13 10:13:19 EDT 2014

Merge "Enable motion field based mode seach skip"

--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -2682,6 +2682,40 @@
       continue;
     second_ref_frame = vp9_mode_order[mode_index].ref_frame[1];
 
+    if (cpi->sf.motion_field_mode_search) {
+      const int mi_width  = MIN(num_8x8_blocks_wide_lookup[bsize],
+                                tile->mi_col_end - mi_col);
+      const int mi_height = MIN(num_8x8_blocks_high_lookup[bsize],
+                                tile->mi_row_end - mi_row);
+      MB_MODE_INFO *ref_mbmi;
+      int const_motion = 1;
+      int_mv ref_mv;
+      ref_mv.as_int = INVALID_MV;
+
+      if ((mi_row - 1) >= tile->mi_row_start) {
+        ref_mv = xd->mi[-xd->mi_stride]->mbmi.mv[0];
+        for (i = 0; i < mi_width; ++i) {
+          ref_mbmi = &xd->mi[-xd->mi_stride + i]->mbmi;
+          const_motion &= (ref_mv.as_int == ref_mbmi->mv[0].as_int) &&
+                          (ref_frame == ref_mbmi->ref_frame[0]);
+        }
+      }
+
+      if ((mi_col - 1) >= tile->mi_col_start) {
+        if (ref_mv.as_int == INVALID_MV)
+          ref_mv = xd->mi[-1]->mbmi.mv[0];
+        for (i = 0; i < mi_height; ++i) {
+          ref_mbmi = &xd->mi[i * xd->mi_stride - 1]->mbmi;
+          const_motion &= (ref_mv.as_int == ref_mbmi->mv[0].as_int) &&
+                          (ref_frame == ref_mbmi->ref_frame[0]);
+        }
+      }
+
+      if (const_motion)
+        if (this_mode == NEARMV || this_mode == ZEROMV)
+          continue;
+    }
+
     comp_pred = second_ref_frame > INTRA_FRAME;
     if (comp_pred) {
       if ((mode_search_skip_flags & FLAG_SKIP_COMP_BESTINTRA) &&
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -119,6 +119,7 @@
 
     sf->adaptive_pred_interp_filter = 0;
     sf->cb_pred_filter_search = 1;
+    sf->motion_field_mode_search = frame_is_boosted(cpi) ? 0 : 1;
 
     sf->lf_motion_threshold = LOW_MOTION_THRESHOLD;
     sf->last_partitioning_redo_frequency = 3;
@@ -343,6 +344,7 @@
   sf->adaptive_pred_interp_filter = 0;
   sf->cb_pred_filter_search = 0;
   sf->cb_partition_search = 0;
+  sf->motion_field_mode_search = 0;
   sf->use_quant_fp = 0;
   sf->reference_masking = 0;
   sf->partition_search_type = SEARCH_PARTITION;
--- a/vp9/encoder/vp9_speed_features.h
+++ b/vp9/encoder/vp9_speed_features.h
@@ -288,6 +288,8 @@
 
   int cb_partition_search;
 
+  int motion_field_mode_search;
+
   // Fast quantization process path
   int use_quant_fp;