Commit 71434945 authored by Michael Niedermayer's avatar Michael Niedermayer

more checks, fixes assertion failure

Originally committed as revision 4081 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 3e2b6358
......@@ -1080,6 +1080,15 @@ static int mpeg_decode_mb(MpegEncContext *s,
s->mb_skiped = 1;
s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]= MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16;
} else {
int mb_type;
if(s->mb_x)
mb_type= s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride - 1];
else
mb_type= s->current_picture.mb_type[ s->mb_width + (s->mb_y-1)*s->mb_stride - 1]; // FIXME not sure if this is allowed in mpeg at all,
if(IS_INTRA(mb_type))
return -1;
/* if B type, reuse previous vectors and directions */
s->mv[0][0][0] = s->last_mv[0][0][0];
s->mv[0][0][1] = s->last_mv[0][0][1];
......@@ -1087,7 +1096,7 @@ static int mpeg_decode_mb(MpegEncContext *s,
s->mv[1][0][1] = s->last_mv[1][0][1];
s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]=
s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride - 1] | MB_TYPE_SKIP;
mb_type | MB_TYPE_SKIP;
// assert(s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride - 1]&(MB_TYPE_16x16|MB_TYPE_16x8));
if((s->mv[0][0][0]|s->mv[0][0][1]|s->mv[1][0][0]|s->mv[1][0][1])==0)
......@@ -2104,6 +2113,8 @@ static int mpeg1_decode_picture(AVCodecContext *avctx,
ref = get_bits(&s->gb, 10); /* temporal ref */
s->pict_type = get_bits(&s->gb, 3);
if(s->pict_type == 0 || s->pict_type > 3)
return -1;
vbv_delay= get_bits(&s->gb, 16);
if (s->pict_type == P_TYPE || s->pict_type == B_TYPE) {
......@@ -2125,8 +2136,8 @@ static int mpeg1_decode_picture(AVCodecContext *avctx,
s->current_picture.pict_type= s->pict_type;
s->current_picture.key_frame= s->pict_type == I_TYPE;
// if(avctx->debug & FF_DEBUG_PICT_INFO)
// av_log(avctx, AV_LOG_DEBUG, "vbv_delay %d, ref %d\n", vbv_delay, ref);
if(avctx->debug & FF_DEBUG_PICT_INFO)
av_log(avctx, AV_LOG_DEBUG, "vbv_delay %d, ref %d type:%d\n", vbv_delay, ref, s->pict_type);
s->y_dc_scale = 8;
s->c_dc_scale = 8;
......
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