]> granicus.if.org Git - libvpx/commitdiff
Adding MV_FP_SIZE constant.
authorDmitry Kovalev <dkovalev@google.com>
Wed, 20 Nov 2013 04:18:01 +0000 (20:18 -0800)
committerDmitry Kovalev <dkovalev@google.com>
Wed, 20 Nov 2013 20:07:57 +0000 (12:07 -0800)
Change-Id: I98d750ee92ff51fb714980418ea28be3b1d0f3c6

vp9/common/vp9_entropymv.h
vp9/decoder/vp9_decodeframe.c
vp9/encoder/vp9_encodemv.c

index d843f5bfee16694b7f518c3e35463d16e41b1344..b62f7c42f110a0ce089df04141472d74cd43fd6e 100644 (file)
@@ -62,6 +62,7 @@ typedef enum {
 #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 struct vp9_token vp9_mv_class_encodings[MV_CLASSES];
 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 @@ typedef struct {
   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 @@ typedef struct {
   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;
index dbcae7614caef4df3f15c9714deb4a35ebd1781c..b64d98c37c8e6955aa2d4d97503d7e0fda276fd2 100644 (file)
@@ -159,7 +159,7 @@ static void update_mv_probs(vp9_prob *p, int n, vp9_reader *r) {
   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 @@ static void read_mv_probs(nmv_context *ctx, int allow_hp, vp9_reader *r) {
   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);
   }
 
index 7e838c90109f6ccf53e4d2578045b916ca587787..7dee808a1dbe87e49c9657a2c79e0e8088891c96 100644 (file)
@@ -68,7 +68,7 @@ static void build_nmv_component_cost_table(int *mvcost,
   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 @@ static void counts_to_nmv_context(
     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 @@ void vp9_write_nmv_probs(VP9_COMP* const cpi, int usehp, vp9_writer* const bc) {
   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 @@ void vp9_write_nmv_probs(VP9_COMP* const cpi, int usehp, vp9_writer* const bc) {
   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);
   }