]> granicus.if.org Git - libvpx/commitdiff
Fix an issue in motion vector prediction stage
authorJingning Han <jingning@google.com>
Tue, 7 Jan 2014 17:53:38 +0000 (09:53 -0800)
committerJingning Han <jingning@google.com>
Tue, 7 Jan 2014 18:18:04 +0000 (10:18 -0800)
The previous implementation stops motion vector prediction test when
the zero motion vector appears for the second time. This commit fixes
it by simply skipping the second time check on zero mv and continuing
on to next mv candidate.

It slightly improves stdhd in speed 2 by 0.06% on average. Most static
sequences are not affected. A few hard ones, like jet, ped, and riverbed
were improved by 0.1 - 0.2%.

Change-Id: Ia8d4e2ffb7136669e8ad1fb24ea6e8fdd6b9a3c1

vp9/encoder/vp9_onyx_if.c
vp9/encoder/vp9_rdopt.c

index 6e054bdd044e905ad6a7275566a0b974a055611f..f157aee2025e9c9c7e3a3bcdf0f94d1e13a0a428 100644 (file)
@@ -585,7 +585,6 @@ static void set_rt_speed_feature(VP9_COMMON *cm,
                                  SPEED_FEATURES *sf,
                                  int speed) {
   sf->static_segmentation = 0;
-  sf->use_avoid_tested_higherror = 1;
   sf->adaptive_rd_thresh = 1;
   sf->recode_loop = (speed < 1);
   if (speed >= 1) {
index 9c67652405602d04133c82c3238d745efd58ef62..40d698fc49c215a99d1ccb955241b90ec80b1613 100644 (file)
@@ -2119,16 +2119,20 @@ static void mv_pred(VP9_COMP *cpi, MACROBLOCK *x,
                      cpi->common.show_frame &&
                      block_size < cpi->sf.max_partition_size);
 
+  int_mv pred_mv[3] = {
+      mbmi->ref_mvs[ref_frame][0], mbmi->ref_mvs[ref_frame][1],
+      x->pred_mv[ref_frame]
+  };
+
   // Get the sad for each candidate reference mv
   for (i = 0; i < num_mv_refs; i++) {
-    this_mv.as_int = (i < MAX_MV_REF_CANDIDATES) ?
-        mbmi->ref_mvs[ref_frame][i].as_int : x->pred_mv[ref_frame].as_int;
+    this_mv.as_int = pred_mv[i].as_int;
 
     max_mv = MAX(max_mv,
                  MAX(abs(this_mv.as_mv.row), abs(this_mv.as_mv.col)) >> 3);
-    // The list is at an end if we see 0 for a second time.
+    // only need to check zero mv once
     if (!this_mv.as_int && zero_seen)
-      break;
+      continue;
     zero_seen = zero_seen || !this_mv.as_int;
 
     row_offset = this_mv.as_mv.row >> 3;
@@ -2346,6 +2350,10 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
 
   YV12_BUFFER_CONFIG *scaled_ref_frame = get_scaled_ref_frame(cpi, ref);
 
+  int_mv pred_mv[3] = {
+      mbmi->ref_mvs[ref][0], mbmi->ref_mvs[ref][1], x->pred_mv[ref]
+  };
+
   if (scaled_ref_frame) {
     int i;
     // Swap out the reference frame for a version that's been scaled to
@@ -2410,9 +2418,7 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
     }
   }
 
-  mvp_full = x->mv_best_ref_index[ref] < MAX_MV_REF_CANDIDATES
-      ? mbmi->ref_mvs[ref][x->mv_best_ref_index[ref]].as_mv
-      : x->pred_mv[ref].as_mv;
+  mvp_full = pred_mv[x->mv_best_ref_index[ref]].as_mv;
 
   mvp_full.col >>= 3;
   mvp_full.row >>= 3;