aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2012-02-14 12:40:19 -0800
committerReinhard Tartler <siretart@tauware.de>2012-02-26 10:03:15 +0100
commit5bcd47cf63cb719e1c650d08cdfb7f4ede351367 (patch)
tree29f6f8c3ce417f81676d58c5567d1710a3b181ba
parent0c60d5c59fe05de80fc45e097c61b6f5487431de (diff)
downloadffmpeg-5bcd47cf63cb719e1c650d08cdfb7f4ede351367.tar.gz
vc1: prevent using last_frame as a reference for I/P first frame.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org (cherry picked from commit ae591aeea58d64399b8281be31dacec0de85ae04) Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r--libavcodec/vc1dec.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 0425a87e41..3869d92518 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -478,7 +478,10 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y;
int off, off_uv;
int v_edge_pos = s->v_edge_pos >> v->field_mode;
- if (!v->field_mode && !v->s.last_picture.f.data[0])
+
+ if ((!v->field_mode ||
+ (v->ref_field_type[dir] == 1 && v->cur_field_type == 1)) &&
+ !v->s.last_picture.f.data[0])
return;
mx = s->mv[dir][0][0];
@@ -690,7 +693,9 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir)
int fieldmv = (v->fcm == ILACE_FRAME) ? v->blk_mv_type[s->block_index[n]] : 0;
int v_edge_pos = s->v_edge_pos >> v->field_mode;
- if (!v->field_mode && !v->s.last_picture.f.data[0])
+ if ((!v->field_mode ||
+ (v->ref_field_type[dir] == 1 && v->cur_field_type == 1)) &&
+ !v->s.last_picture.f.data[0])
return;
mx = s->mv[dir][n][0];
@@ -946,6 +951,8 @@ static void vc1_mc_4mv_chroma(VC1Context *v, int dir)
if (dominant)
chroma_ref_type = !v->cur_field_type;
}
+ if (v->field_mode && chroma_ref_type == 1 && v->cur_field_type == 1 && !v->s.last_picture.f.data[0])
+ return;
s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0] = tx;
s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1] = ty;
uvmx = (tx + ((tx & 3) == 3)) >> 1;