aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vc1_pred.c
diff options
context:
space:
mode:
authorJerome Borsboom <jerome.borsboom@carpalis.nl>2019-01-11 15:36:47 +0100
committerCarl Eugen Hoyos <ceffmpeg@gmail.com>2019-01-12 16:34:55 +0100
commit96740ec69f272ad2364175656590a908b9e98a6c (patch)
treef95838eda4e0298f30f8b793633079b65c34450b /libavcodec/vc1_pred.c
parentf4fd8ef725a805cfc8fd695f283b8bfe9bef1b5a (diff)
downloadffmpeg-96740ec69f272ad2364175656590a908b9e98a6c.tar.gz
avcodec/vc1: shuffle calculation of MV predictor candidates
The B predictor for 4-MV macroblocks is only out of bounds when the A predictor is also out of bounds. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
Diffstat (limited to 'libavcodec/vc1_pred.c')
-rw-r--r--libavcodec/vc1_pred.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libavcodec/vc1_pred.c b/libavcodec/vc1_pred.c
index de736ec775..75225d2023 100644
--- a/libavcodec/vc1_pred.c
+++ b/libavcodec/vc1_pred.c
@@ -262,13 +262,15 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y,
return;
}
- C = s->current_picture.motion_val[dir][xy - 1 + v->blocks_off];
- A = s->current_picture.motion_val[dir][xy - wrap + v->blocks_off];
+ a_valid = !s->first_slice_line || (n == 2 || n == 3);
+ b_valid = a_valid;
+ c_valid = s->mb_x || (n == 1 || n == 3);
if (mv1) {
if (v->field_mode && mixedmv_pic)
off = (s->mb_x == (s->mb_width - 1)) ? -2 : 2;
else
off = (s->mb_x == (s->mb_width - 1)) ? -1 : 2;
+ b_valid = b_valid && s->mb_width > 1;
} else {
//in 4-MV mode different blocks have different B predictor position
switch (n) {
@@ -285,11 +287,7 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y,
off = -1;
}
}
- B = s->current_picture.motion_val[dir][xy - wrap + off + v->blocks_off];
- a_valid = !s->first_slice_line || (n == 2 || n == 3);
- b_valid = a_valid && (s->mb_width > 1);
- c_valid = s->mb_x || (n == 1 || n == 3);
if (v->field_mode) {
a_valid = a_valid && !is_intra[xy - wrap];
b_valid = b_valid && !is_intra[xy - wrap + off];
@@ -297,6 +295,7 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y,
}
if (a_valid) {
+ A = s->current_picture.motion_val[dir][xy - wrap + v->blocks_off];
a_f = v->mv_f[dir][xy - wrap + v->blocks_off];
num_oppfield += a_f;
num_samefield += 1 - a_f;
@@ -307,6 +306,7 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y,
a_f = 0;
}
if (b_valid) {
+ B = s->current_picture.motion_val[dir][xy - wrap + off + v->blocks_off];
b_f = v->mv_f[dir][xy - wrap + off + v->blocks_off];
num_oppfield += b_f;
num_samefield += 1 - b_f;
@@ -317,6 +317,7 @@ void ff_vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y,
b_f = 0;
}
if (c_valid) {
+ C = s->current_picture.motion_val[dir][xy - 1 + v->blocks_off];
c_f = v->mv_f[dir][xy - 1 + v->blocks_off];
num_oppfield += c_f;
num_samefield += 1 - c_f;