shithub: libvpx

Download patch

ref: 4956fcd31b69c9695f3a8b62aa629cdcfc5065ca
parent: 82f8ae4c5bfeac652f9a6c3aeefd66cbcada0cc2
author: Dmitry Kovalev <dkovalev@google.com>
date: Tue Nov 19 15:18:01 EST 2013

Adding MV_FP_SIZE constant.

Change-Id: I98d750ee92ff51fb714980418ea28be3b1d0f3c6

--- a/vp9/common/vp9_entropymv.h
+++ b/vp9/common/vp9_entropymv.h
@@ -62,6 +62,7 @@
 #define CLASS0_BITS    1  /* bits at integer precision for class 0 */
 #define CLASS0_SIZE    (1 << CLASS0_BITS)
 #define MV_OFFSET_BITS (MV_CLASSES + CLASS0_BITS - 2)
+#define MV_FP_SIZE 4
 
 #define MV_MAX_BITS    (MV_CLASSES + CLASS0_BITS + 2)
 #define MV_MAX         ((1 << MV_MAX_BITS) - 1)
@@ -80,7 +81,7 @@
 extern const vp9_tree_index vp9_mv_class0_tree[TREE_SIZE(CLASS0_SIZE)];
 extern struct vp9_token vp9_mv_class0_encodings[CLASS0_SIZE];
 
-extern const vp9_tree_index vp9_mv_fp_tree[TREE_SIZE(4)];
+extern const vp9_tree_index vp9_mv_fp_tree[TREE_SIZE(MV_FP_SIZE)];
 extern struct vp9_token vp9_mv_fp_encodings[4];
 
 typedef struct {
@@ -88,8 +89,8 @@
   vp9_prob classes[MV_CLASSES - 1];
   vp9_prob class0[CLASS0_SIZE - 1];
   vp9_prob bits[MV_OFFSET_BITS];
-  vp9_prob class0_fp[CLASS0_SIZE][4 - 1];
-  vp9_prob fp[4 - 1];
+  vp9_prob class0_fp[CLASS0_SIZE][MV_FP_SIZE - 1];
+  vp9_prob fp[MV_FP_SIZE - 1];
   vp9_prob class0_hp;
   vp9_prob hp;
 } nmv_component;
@@ -116,8 +117,8 @@
   unsigned int classes[MV_CLASSES];
   unsigned int class0[CLASS0_SIZE];
   unsigned int bits[MV_OFFSET_BITS][2];
-  unsigned int class0_fp[CLASS0_SIZE][4];
-  unsigned int fp[4];
+  unsigned int class0_fp[CLASS0_SIZE][MV_FP_SIZE];
+  unsigned int fp[MV_FP_SIZE];
   unsigned int class0_hp[2];
   unsigned int hp[2];
 } nmv_component_counts;
--- a/vp9/decoder/vp9_decodeframe.c
+++ b/vp9/decoder/vp9_decodeframe.c
@@ -159,7 +159,7 @@
   int i;
   for (i = 0; i < n; ++i)
     if (vp9_read(r, NMV_UPDATE_PROB))
-       p[i] = (vp9_read_literal(r, 7) << 1) | 1;
+      p[i] = (vp9_read_literal(r, 7) << 1) | 1;
 }
 
 static void read_mv_probs(nmv_context *ctx, int allow_hp, vp9_reader *r) {
@@ -178,7 +178,7 @@
   for (i = 0; i < 2; ++i) {
     nmv_component *const comp_ctx = &ctx->comps[i];
     for (j = 0; j < CLASS0_SIZE; ++j)
-      update_mv_probs(comp_ctx->class0_fp[j], 3, r);
+      update_mv_probs(comp_ctx->class0_fp[j], MV_FP_SIZE - 1, r);
     update_mv_probs(comp_ctx->fp, 3, r);
   }
 
--- a/vp9/encoder/vp9_encodemv.c
+++ b/vp9/encoder/vp9_encodemv.c
@@ -68,7 +68,7 @@
   int i, v;
   int sign_cost[2], class_cost[MV_CLASSES], class0_cost[CLASS0_SIZE];
   int bits_cost[MV_OFFSET_BITS][2];
-  int class0_fp_cost[CLASS0_SIZE][4], fp_cost[4];
+  int class0_fp_cost[CLASS0_SIZE][MV_FP_SIZE], fp_cost[MV_FP_SIZE];
   int class0_hp_cost[2], hp_cost[2];
 
   sign_cost[0] = vp9_cost_zero(mvcomp->sign);
@@ -145,8 +145,8 @@
     unsigned int (*branch_ct_classes)[MV_CLASSES - 1][2],
     unsigned int (*branch_ct_class0)[CLASS0_SIZE - 1][2],
     unsigned int (*branch_ct_bits)[MV_OFFSET_BITS][2],
-    unsigned int (*branch_ct_class0_fp)[CLASS0_SIZE][4 - 1][2],
-    unsigned int (*branch_ct_fp)[4 - 1][2],
+    unsigned int (*branch_ct_class0_fp)[CLASS0_SIZE][MV_FP_SIZE - 1][2],
+    unsigned int (*branch_ct_fp)[MV_FP_SIZE - 1][2],
     unsigned int (*branch_ct_class0_hp)[2],
     unsigned int (*branch_ct_hp)[2]) {
   int i, j, k;
@@ -205,8 +205,8 @@
   unsigned int branch_ct_classes[2][MV_CLASSES - 1][2];
   unsigned int branch_ct_class0[2][CLASS0_SIZE - 1][2];
   unsigned int branch_ct_bits[2][MV_OFFSET_BITS][2];
-  unsigned int branch_ct_class0_fp[2][CLASS0_SIZE][4 - 1][2];
-  unsigned int branch_ct_fp[2][4 - 1][2];
+  unsigned int branch_ct_class0_fp[2][CLASS0_SIZE][MV_FP_SIZE - 1][2];
+  unsigned int branch_ct_fp[2][MV_FP_SIZE - 1][2];
   unsigned int branch_ct_class0_hp[2][2];
   unsigned int branch_ct_hp[2][2];
   nmv_context *mvc = &cpi->common.fc.nmvc;
@@ -238,12 +238,12 @@
   for (i = 0; i < 2; ++i) {
     for (j = 0; j < CLASS0_SIZE; ++j) {
       int k;
-      for (k = 0; k < 3; ++k)
+      for (k = 0; k < MV_FP_SIZE - 1; ++k)
         update_mv(bc, branch_ct_class0_fp[i][j][k],
                   &mvc->comps[i].class0_fp[j][k], NMV_UPDATE_PROB);
     }
 
-    for (j = 0; j < 3; ++j)
+    for (j = 0; j < MV_FP_SIZE - 1; ++j)
       update_mv(bc, branch_ct_fp[i][j], &mvc->comps[i].fp[j], NMV_UPDATE_PROB);
   }