]> granicus.if.org Git - libvpx/commitdiff
Rework motion vector precision limit
authorJingning Han <jingning@google.com>
Mon, 25 Apr 2016 21:26:53 +0000 (14:26 -0700)
committerJingning Han <jingning@google.com>
Tue, 26 Apr 2016 17:14:26 +0000 (10:14 -0700)
This commit enables 1/8 luma component motion vector precision
for all motion vector cases. It improves the compression performance
of lowres by 0.13% and hdres by 0.49%.

Change-Id: Iccfc85e8ee1c0154dfbd18f060344f1e3db5dc18

vp10/common/entropymv.c
vp10/encoder/encoder.c
vp10/encoder/mcomp.c

index 6e8c9931b936745491a4566a979b650bcfca7b08..097d693b347ef48d6145a15be718c50095377ee0 100644 (file)
@@ -132,14 +132,11 @@ MV_CLASS_TYPE vp10_get_mv_class(int z, int *offset) {
   return c;
 }
 
+// TODO(jingning): This idle function is intentionally left as is for
+// experimental purpose.
 int vp10_use_mv_hp(const MV *ref) {
-#if CONFIG_MISC_FIXES
   (void) ref;
   return 1;
-#else
-  return (abs(ref->row) >> 3) < COMPANDED_MVREF_THRESH &&
-         (abs(ref->col) >> 3) < COMPANDED_MVREF_THRESH;
-#endif
 }
 
 static void inc_mv_component(int v, nmv_component_counts *comp_counts,
@@ -160,14 +157,16 @@ static void inc_mv_component(int v, nmv_component_counts *comp_counts,
   if (c == MV_CLASS_0) {
     comp_counts->class0[d] += incr;
     comp_counts->class0_fp[d][f] += incr;
-    comp_counts->class0_hp[e] += usehp * incr;
+    if (usehp)
+      comp_counts->class0_hp[e] += incr;
   } else {
     int i;
     int b = c + CLASS0_BITS - 1;  // number of bits
     for (i = 0; i < b; ++i)
       comp_counts->bits[i][((d >> i) & 1)] += incr;
     comp_counts->fp[f] += incr;
-    comp_counts->hp[e] += usehp * incr;
+    if (usehp)
+      comp_counts->hp[e] += incr;
   }
 }
 
@@ -182,15 +181,11 @@ void vp10_inc_mv(const MV *mv, nmv_context_counts *counts, const int usehp) {
 #endif
     ++counts->joints[j];
 
-    if (mv_joint_vertical(j)) {
-      inc_mv_component(mv->row, &counts->comps[0], 1,
-                       !CONFIG_MISC_FIXES || usehp);
-    }
+    if (mv_joint_vertical(j))
+      inc_mv_component(mv->row, &counts->comps[0], 1, usehp);
 
-    if (mv_joint_horizontal(j)) {
-      inc_mv_component(mv->col, &counts->comps[1], 1,
-                       !CONFIG_MISC_FIXES || usehp);
-    }
+    if (mv_joint_horizontal(j))
+      inc_mv_component(mv->col, &counts->comps[1], 1, usehp);
   }
 }
 
index 40d4c366a0846c1b149bdbd78143ad14fb8c32c6..437b36688f3c72313b4fe0de26a6d6111d089bb3 100644 (file)
@@ -243,10 +243,10 @@ void vp10_set_high_precision_mv(VP10_COMP *cpi, int allow_high_precision_mv) {
 #else
   if (cpi->common.allow_high_precision_mv) {
     mb->mvcost = mb->nmvcost_hp;
-    mb->mvsadcost = mb->nmvsadcost_hp;
+    mb->mvsadcost = mb->nmvcost_hp;
   } else {
     mb->mvcost = mb->nmvcost;
-    mb->mvsadcost = mb->nmvsadcost;
+    mb->mvsadcost = mb->nmvcost;
   }
 #endif
 }
index 823095e6febf19ddcff83922da656f9a0946e645..dd0c31115d9d338b2066b69d89391a338df2fc0c 100644 (file)
@@ -98,22 +98,12 @@ static int mv_err_cost(const MV *mv, const MV *ref, const int *mvjcost,
 
 static int mvsad_err_cost(const MACROBLOCK *x, const MV *mv, const MV *ref,
                           int sad_per_bit) {
-#if CONFIG_REF_MV
   const MV diff = { (mv->row - ref->row) * 8,
                     (mv->col - ref->col) * 8 };
   return ROUND_POWER_OF_TWO(
       (unsigned)mv_cost(&diff, x->nmvjointsadcost, x->mvsadcost) *
           sad_per_bit,
       VP9_PROB_COST_SHIFT);
-#else
-  const MV diff = { mv->row - ref->row,
-                    mv->col - ref->col };
-
-  return ROUND_POWER_OF_TWO(
-      (unsigned)mv_cost(&diff, x->nmvjointsadcost, x->nmvsadcost) *
-          sad_per_bit,
-      VP9_PROB_COST_SHIFT);
-#endif
 }
 
 void vp10_init_dsmotion_compensation(search_site_config *cfg, int stride) {