Support +/-2048 motion vector coding

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

Change-Id: Iac2bb015e8934521cef83a19edbe967d9f097436
This commit is contained in:
Jingning Han 2013-03-11 21:51:00 -07:00
parent bd9cd9a185
commit 76c12ab9c9
3 changed files with 24 additions and 21 deletions

View File

@ -42,9 +42,10 @@ const vp9_tree_index vp9_mv_class_tree[2 * MV_CLASSES - 2] = {
-MV_CLASS_2, -MV_CLASS_3, -MV_CLASS_2, -MV_CLASS_3,
10, 12, 10, 12,
-MV_CLASS_4, -MV_CLASS_5, -MV_CLASS_4, -MV_CLASS_5,
14, 16, -MV_CLASS_6, 14,
-MV_CLASS_6, -MV_CLASS_7, 16, 18,
-MV_CLASS_8, -MV_CLASS_9, -MV_CLASS_7, -MV_CLASS_8,
-MV_CLASS_9, -MV_CLASS_10,
}; };
struct vp9_token_struct vp9_mv_class_encodings[MV_CLASSES]; struct vp9_token_struct vp9_mv_class_encodings[MV_CLASSES];
@ -64,24 +65,24 @@ const nmv_context vp9_default_nmv_context = {
{32, 64, 96}, {32, 64, 96},
{ {
{ /* vert component */ { /* vert component */
128, /* sign */ 128, /* sign */
{224, 144, 192, 168, 192, 176, 192, 198, 198}, /* class */ {224, 144, 192, 168, 192, 176, 192, 198, 198, 245}, /* class */
{216}, /* class0 */ {216}, /* class0 */
{136, 140, 148, 160, 176, 192, 224, 234, 234}, /* bits */ {136, 140, 148, 160, 176, 192, 224, 234, 234, 240}, /* bits */
{{128, 128, 64}, {96, 112, 64}}, /* class0_fp */ {{128, 128, 64}, {96, 112, 64}}, /* class0_fp */
{64, 96, 64}, /* fp */ {64, 96, 64}, /* fp */
160, /* class0_hp bit */ 160, /* class0_hp bit */
128, /* hp */ 128, /* hp */
}, },
{ /* hor component */ { /* hor component */
128, /* sign */ 128, /* sign */
{216, 128, 176, 160, 176, 176, 192, 198, 198}, /* class */ {216, 128, 176, 160, 176, 176, 192, 198, 198, 208}, /* class */
{208}, /* class0 */ {208}, /* class0 */
{136, 140, 148, 160, 176, 192, 224, 234, 234}, /* bits */ {136, 140, 148, 160, 176, 192, 224, 234, 234, 240}, /* bits */
{{128, 128, 64}, {96, 112, 64}}, /* class0_fp */ {{128, 128, 64}, {96, 112, 64}}, /* class0_fp */
{64, 96, 64}, /* fp */ {64, 96, 64}, /* fp */
160, /* class0_hp bit */ 160, /* class0_hp bit */
128, /* hp */ 128, /* hp */
} }
}, },
}; };
@ -107,6 +108,7 @@ MV_CLASS_TYPE vp9_get_mv_class(int z, int *offset) {
else if (z < CLASS0_SIZE * 1024) c = MV_CLASS_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 * 2048) c = MV_CLASS_8;
else if (z < CLASS0_SIZE * 4096) c = MV_CLASS_9; else if (z < CLASS0_SIZE * 4096) c = MV_CLASS_9;
else if (z < CLASS0_SIZE * 8192) c = MV_CLASS_10;
else assert(0); else assert(0);
if (offset) if (offset)
*offset = z - mv_class_base(c); *offset = z - mv_class_base(c);

View File

@ -49,7 +49,7 @@ extern const vp9_tree_index vp9_mv_joint_tree[2 * MV_JOINTS - 2];
extern struct vp9_token_struct vp9_mv_joint_encodings [MV_JOINTS]; extern struct vp9_token_struct vp9_mv_joint_encodings [MV_JOINTS];
/* Symbols for coding magnitude class of nonzero components */ /* Symbols for coding magnitude class of nonzero components */
#define MV_CLASSES 10 #define MV_CLASSES 11
typedef enum { typedef enum {
MV_CLASS_0 = 0, /* (0, 2] integer pel */ MV_CLASS_0 = 0, /* (0, 2] integer pel */
MV_CLASS_1 = 1, /* (2, 4] integer pel */ MV_CLASS_1 = 1, /* (2, 4] integer pel */
@ -61,6 +61,7 @@ typedef enum {
MV_CLASS_7 = 7, /* (128, 256] integer pel */ MV_CLASS_7 = 7, /* (128, 256] integer pel */
MV_CLASS_8 = 8, /* (256, 512] integer pel */ MV_CLASS_8 = 8, /* (256, 512] integer pel */
MV_CLASS_9 = 9, /* (512, 1024] integer pel */ MV_CLASS_9 = 9, /* (512, 1024] integer pel */
MV_CLASS_10 = 10, /* (1024,2048] integer pel */
} MV_CLASS_TYPE; } MV_CLASS_TYPE;
extern const vp9_tree_index vp9_mv_class_tree[2 * MV_CLASSES - 2]; extern const vp9_tree_index vp9_mv_class_tree[2 * MV_CLASSES - 2];

View File

@ -21,7 +21,7 @@ void print_mode_context(VP9_COMMON *pc);
// The maximum number of steps in a step search given the largest // The maximum number of steps in a step search given the largest
// allowed initial step // allowed initial step
#define MAX_MVSEARCH_STEPS 10 #define MAX_MVSEARCH_STEPS 11
// Max full pel mv specified in 1 pel units // Max full pel mv specified in 1 pel units
#define MAX_FULL_PEL_VAL ((1 << (MAX_MVSEARCH_STEPS)) - 1) #define MAX_FULL_PEL_VAL ((1 << (MAX_MVSEARCH_STEPS)) - 1)
// Maximum size of the first step in full pel units // Maximum size of the first step in full pel units