[FFmpeg-cvslog] avcodec/vc1: shuffle calculation of MV predictor candidates
Jerome Borsboom
git at videolan.org
Sat Jan 12 17:45:48 EET 2019
ffmpeg | branch: master | Jerome Borsboom <jerome.borsboom at carpalis.nl> | Fri Jan 11 15:36:47 2019 +0100| [96740ec69f272ad2364175656590a908b9e98a6c] | committer: Carl Eugen Hoyos
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 at carpalis.nl>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=96740ec69f272ad2364175656590a908b9e98a6c
---
libavcodec/vc1_pred.c | 13 +++++++------
1 file 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;
More information about the ffmpeg-cvslog
mailing list