summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
authorYaowu Xu <yaowu@google.com>2013-10-18 12:39:28 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2013-10-18 12:39:28 -0700
commitea77b03479668d6c9336b582f43b1b58f1ab1e7f (patch)
treec9918a985d7435615f9eb94ac6629d0f7afa9931 /vp9
parentc093b6228c9ddabf989774a7a01d533f90875ae6 (diff)
parent535a1085bccc355cfdee89c98fdf7eaa9ccc315b (diff)
downloadlibvpx-ea77b03479668d6c9336b582f43b1b58f1ab1e7f.tar
libvpx-ea77b03479668d6c9336b582f43b1b58f1ab1e7f.tar.gz
libvpx-ea77b03479668d6c9336b582f43b1b58f1ab1e7f.tar.bz2
libvpx-ea77b03479668d6c9336b582f43b1b58f1ab1e7f.zip
Merge "Converted assert to error checking"
Diffstat (limited to 'vp9')
-rw-r--r--vp9/decoder/vp9_decodemv.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c
index 6cf4f153b..4cb9a67df 100644
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -425,11 +425,12 @@ static void read_intra_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
mbmi->uv_mode = read_intra_mode_uv(cm, r, mbmi->mode);
}
-static INLINE void assign_mv(VP9_COMMON *cm, MB_PREDICTION_MODE mode,
+static INLINE int assign_mv(VP9_COMMON *cm, MB_PREDICTION_MODE mode,
int_mv mv[2], int_mv best_mv[2],
int_mv nearest_mv[2], int_mv near_mv[2],
int is_compound, int allow_hp, vp9_reader *r) {
int i;
+ int ret = 1;
switch (mode) {
case NEWMV:
@@ -438,6 +439,10 @@ static INLINE void assign_mv(VP9_COMMON *cm, MB_PREDICTION_MODE mode,
if (is_compound)
read_mv(r, &mv[1].as_mv, &best_mv[1].as_mv,
&cm->fc.nmvc, &cm->counts.mv, allow_hp);
+ for (i = 0; i < 1 + is_compound; ++i) {
+ ret = ret && mv[i].as_mv.row < MV_UPP && mv[i].as_mv.row > MV_LOW;
+ ret = ret && mv[i].as_mv.col < MV_UPP && mv[i].as_mv.col > MV_LOW;
+ }
break;
case NEARESTMV:
mv[0].as_int = nearest_mv[0].as_int;
@@ -455,13 +460,9 @@ static INLINE void assign_mv(VP9_COMMON *cm, MB_PREDICTION_MODE mode,
mv[1].as_int = 0;
break;
default:
- assert(!"Invalid inter mode value.");
- }
-
- for (i = 0; i < 1 + is_compound; ++i) {
- assert(mv[i].as_mv.row < MV_UPP && mv[i].as_mv.row > MV_LOW);
- assert(mv[i].as_mv.col < MV_UPP && mv[i].as_mv.col > MV_LOW);
+ return 0;
}
+ return ret;
}
static int read_is_inter_block(VP9D_COMP *pbi, int segment_id, vp9_reader *r) {
@@ -557,8 +558,12 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
mi_row, mi_col);
}
- assign_mv(cm, b_mode, block, best, nearest, nearmv,
- is_compound, allow_hp, r);
+ if (!assign_mv(cm, b_mode, block, best, nearest, nearmv,
+ is_compound, allow_hp, r)) {
+ xd->corrupted |= 1;
+ break;
+ };
+
mi->bmi[j].as_mv[0].as_int = block[0].as_int;
if (is_compound)
@@ -576,8 +581,9 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
mbmi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int;
mbmi->mv[1].as_int = mi->bmi[3].as_mv[1].as_int;
} else {
- assign_mv(cm, mbmi->mode, mbmi->mv, best, nearest, nearmv,
- is_compound, allow_hp, r);
+ xd->corrupted |= !assign_mv(cm, mbmi->mode, mbmi->mv,
+ best, nearest, nearmv,
+ is_compound, allow_hp, r);
}
}