shithub: libvpx

Download patch

ref: 76c12ab9c9d08a76f79e6b50af278ebf1e5f49ad
parent: bd9cd9a1859aa464b3092f2023b3a4040166572d
author: Jingning Han <jingning@google.com>
date: Mon Mar 11 17:51:00 EDT 2013

Support +/-2048 motion vector coding

Enable entropy coding of motion vectors up to +/-2048. Also
extend the motion search range accordingly.

Change-Id: Iac2bb015e8934521cef83a19edbe967d9f097436

--- a/vp9/common/vp9_entropymv.c
+++ b/vp9/common/vp9_entropymv.c
@@ -42,9 +42,10 @@
   -MV_CLASS_2, -MV_CLASS_3,
   10, 12,
   -MV_CLASS_4, -MV_CLASS_5,
-  14, 16,
-  -MV_CLASS_6, -MV_CLASS_7,
-  -MV_CLASS_8, -MV_CLASS_9,
+  -MV_CLASS_6, 14,
+  16, 18,
+  -MV_CLASS_7, -MV_CLASS_8,
+  -MV_CLASS_9, -MV_CLASS_10,
 };
 struct vp9_token_struct vp9_mv_class_encodings[MV_CLASSES];
 
@@ -64,24 +65,24 @@
   {32, 64, 96},
   {
     { /* vert component */
-      128,                                             /* sign */
-      {224, 144, 192, 168, 192, 176, 192, 198, 198},   /* class */
-      {216},                                           /* class0 */
-      {136, 140, 148, 160, 176, 192, 224, 234, 234},   /* bits */
-      {{128, 128, 64}, {96, 112, 64}},                 /* class0_fp */
-      {64, 96, 64},                                    /* fp */
-      160,                                             /* class0_hp bit */
-      128,                                             /* hp */
+      128,                                                  /* sign */
+      {224, 144, 192, 168, 192, 176, 192, 198, 198, 245},   /* class */
+      {216},                                                /* class0 */
+      {136, 140, 148, 160, 176, 192, 224, 234, 234, 240},   /* bits */
+      {{128, 128, 64}, {96, 112, 64}},                      /* class0_fp */
+      {64, 96, 64},                                         /* fp */
+      160,                                                  /* class0_hp bit */
+      128,                                                  /* hp */
     },
     { /* hor component */
-      128,                                             /* sign */
-      {216, 128, 176, 160, 176, 176, 192, 198, 198},   /* class */
-      {208},                                           /* class0 */
-      {136, 140, 148, 160, 176, 192, 224, 234, 234},   /* bits */
-      {{128, 128, 64}, {96, 112, 64}},                 /* class0_fp */
-      {64, 96, 64},                                    /* fp */
-      160,                                             /* class0_hp bit */
-      128,                                             /* hp */
+      128,                                                  /* sign */
+      {216, 128, 176, 160, 176, 176, 192, 198, 198, 208},   /* class */
+      {208},                                                /* class0 */
+      {136, 140, 148, 160, 176, 192, 224, 234, 234, 240},   /* bits */
+      {{128, 128, 64}, {96, 112, 64}},                      /* class0_fp */
+      {64, 96, 64},                                         /* fp */
+      160,                                                  /* class0_hp bit */
+      128,                                                  /* hp */
     }
   },
 };
@@ -107,6 +108,7 @@
   else if (z < CLASS0_SIZE * 1024) c = MV_CLASS_7;
   else if (z < CLASS0_SIZE * 2048) c = MV_CLASS_8;
   else if (z < CLASS0_SIZE * 4096) c = MV_CLASS_9;
+  else if (z < CLASS0_SIZE * 8192) c = MV_CLASS_10;
   else assert(0);
   if (offset)
     *offset = z - mv_class_base(c);
--- a/vp9/common/vp9_entropymv.h
+++ b/vp9/common/vp9_entropymv.h
@@ -49,7 +49,7 @@
 extern struct vp9_token_struct vp9_mv_joint_encodings [MV_JOINTS];
 
 /* Symbols for coding magnitude class of nonzero components */
-#define MV_CLASSES     10
+#define MV_CLASSES     11
 typedef enum {
   MV_CLASS_0 = 0,      /* (0, 2]     integer pel */
   MV_CLASS_1 = 1,      /* (2, 4]     integer pel */
@@ -61,6 +61,7 @@
   MV_CLASS_7 = 7,      /* (128, 256] integer pel */
   MV_CLASS_8 = 8,      /* (256, 512] integer pel */
   MV_CLASS_9 = 9,      /* (512, 1024] integer pel */
+  MV_CLASS_10 = 10,    /* (1024,2048] integer pel */
 } MV_CLASS_TYPE;
 
 extern const vp9_tree_index vp9_mv_class_tree[2 * MV_CLASSES - 2];
--- a/vp9/encoder/vp9_mcomp.h
+++ b/vp9/encoder/vp9_mcomp.h
@@ -21,7 +21,7 @@
 
 // The maximum number of steps in a step search given the largest
 // allowed initial step
-#define MAX_MVSEARCH_STEPS 10
+#define MAX_MVSEARCH_STEPS 11
 // Max full pel mv specified in 1 pel units
 #define MAX_FULL_PEL_VAL ((1 << (MAX_MVSEARCH_STEPS)) - 1)
 // Maximum size of the first step in full pel units