Commit 6d3bd966 authored by Jingning Han's avatar Jingning Han

BITSTREAM - CLARIFICATION OF MV SIZE RANGE

The codec should effectively run with motion vector of range (-2048, 2047)
in full pixels, for sequences of 1080p and below. Add assertions to clarify
this behavior.

Change-Id: Ia0cac28249f587d8f8882205228fa480263ab313
parent 6c2082db
...@@ -73,6 +73,10 @@ extern struct vp9_token vp9_mv_class_encodings[MV_CLASSES]; ...@@ -73,6 +73,10 @@ extern struct vp9_token vp9_mv_class_encodings[MV_CLASSES];
#define MV_MAX ((1 << MV_MAX_BITS) - 1) #define MV_MAX ((1 << MV_MAX_BITS) - 1)
#define MV_VALS ((MV_MAX << 1) + 1) #define MV_VALS ((MV_MAX << 1) + 1)
#define MV_IN_USE_BITS 14
#define MV_UPP ((1 << MV_IN_USE_BITS) - 1)
#define MV_LOW (-(1 << MV_IN_USE_BITS))
extern const vp9_tree_index vp9_mv_class0_tree[2 * CLASS0_SIZE - 2]; extern const vp9_tree_index vp9_mv_class0_tree[2 * CLASS0_SIZE - 2];
extern struct vp9_token vp9_mv_class0_encodings[CLASS0_SIZE]; extern struct vp9_token vp9_mv_class0_encodings[CLASS0_SIZE];
......
...@@ -522,8 +522,14 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi, ...@@ -522,8 +522,14 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
assert(!"Invalid inter mode value"); assert(!"Invalid inter mode value");
} }
mi->bmi[j].as_mv[0].as_int = block[0].as_int; mi->bmi[j].as_mv[0].as_int = block[0].as_int;
if (is_compound) assert(block[0].as_mv.row < MV_UPP && block[0].as_mv.row > MV_LOW);
assert(block[0].as_mv.col < MV_UPP && block[0].as_mv.col > MV_LOW);
if (is_compound) {
mi->bmi[j].as_mv[1].as_int = block[1].as_int; mi->bmi[j].as_mv[1].as_int = block[1].as_int;
assert(block[1].as_mv.row < MV_UPP && block[1].as_mv.row > MV_LOW);
assert(block[1].as_mv.col < MV_UPP && block[1].as_mv.col > MV_LOW);
}
if (num_4x4_h == 2) if (num_4x4_h == 2)
mi->bmi[j + 2] = mi->bmi[j]; mi->bmi[j + 2] = mi->bmi[j];
...@@ -564,6 +570,12 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi, ...@@ -564,6 +570,12 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
default: default:
assert(!"Invalid inter mode value"); assert(!"Invalid inter mode value");
} }
assert(mv0->as_mv.row < MV_UPP && mv0->as_mv.row > MV_LOW);
assert(mv0->as_mv.col < MV_UPP && mv0->as_mv.col > MV_LOW);
if (is_compound) {
assert(mv1->as_mv.row < MV_UPP && mv1->as_mv.row > MV_LOW);
assert(mv1->as_mv.col < MV_UPP && mv1->as_mv.col > MV_LOW);
}
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment