Commit b98202a4 authored by Michael Niedermayer's avatar Michael Niedermayer

mb stuffing in partitioned frames fix

Originally committed as revision 2869 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent b056e73c
...@@ -3336,18 +3336,18 @@ static int mpeg4_decode_partition_a(MpegEncContext *s){ ...@@ -3336,18 +3336,18 @@ static int mpeg4_decode_partition_a(MpegEncContext *s){
if(s->pict_type==I_TYPE){ if(s->pict_type==I_TYPE){
int i; int i;
if(show_bits_long(&s->gb, 19)==DC_MARKER){
return mb_num-1;
}
do{ do{
if(show_bits_long(&s->gb, 19)==DC_MARKER){
return mb_num-1;
}
cbpc = get_vlc2(&s->gb, intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2); cbpc = get_vlc2(&s->gb, intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2);
if (cbpc < 0){ if (cbpc < 0){
av_log(s->avctx, AV_LOG_ERROR, "cbpc corrupted at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "cbpc corrupted at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
}while(cbpc == 8); }while(cbpc == 8);
s->cbp_table[xy]= cbpc & 3; s->cbp_table[xy]= cbpc & 3;
s->current_picture.mb_type[xy]= MB_TYPE_INTRA; s->current_picture.mb_type[xy]= MB_TYPE_INTRA;
s->mb_intra = 1; s->mb_intra = 1;
...@@ -3374,7 +3374,7 @@ static int mpeg4_decode_partition_a(MpegEncContext *s){ ...@@ -3374,7 +3374,7 @@ static int mpeg4_decode_partition_a(MpegEncContext *s){
int16_t * const mot_val= s->current_picture.motion_val[0][s->block_index[0]]; int16_t * const mot_val= s->current_picture.motion_val[0][s->block_index[0]];
const int stride= s->block_wrap[0]*2; const int stride= s->block_wrap[0]*2;
// do{ //FIXME try_again:
bits= show_bits(&s->gb, 17); bits= show_bits(&s->gb, 17);
if(bits==MOTION_MARKER){ if(bits==MOTION_MARKER){
return mb_num-1; return mb_num-1;
...@@ -3405,7 +3405,8 @@ static int mpeg4_decode_partition_a(MpegEncContext *s){ ...@@ -3405,7 +3405,8 @@ static int mpeg4_decode_partition_a(MpegEncContext *s){
av_log(s->avctx, AV_LOG_ERROR, "cbpc corrupted at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "cbpc corrupted at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
// }while(cbpc == 20); if(cbpc == 20)
goto try_again;
s->cbp_table[xy]= cbpc&(8+3); //8 is dquant s->cbp_table[xy]= cbpc&(8+3); //8 is dquant
...@@ -3586,11 +3587,15 @@ int ff_mpeg4_decode_partitions(MpegEncContext *s) ...@@ -3586,11 +3587,15 @@ int ff_mpeg4_decode_partitions(MpegEncContext *s)
s->mb_num_left= mb_num; s->mb_num_left= mb_num;
if(s->pict_type==I_TYPE){ if(s->pict_type==I_TYPE){
while(show_bits(&s->gb, 9) == 1)
skip_bits(&s->gb, 9);
if(get_bits_long(&s->gb, 19)!=DC_MARKER){ if(get_bits_long(&s->gb, 19)!=DC_MARKER){
av_log(s->avctx, AV_LOG_ERROR, "marker missing after first I partition at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "marker missing after first I partition at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
} }
}else{ }else{
while(show_bits(&s->gb, 10) == 1)
skip_bits(&s->gb, 10);
if(get_bits(&s->gb, 17)!=MOTION_MARKER){ if(get_bits(&s->gb, 17)!=MOTION_MARKER){
av_log(s->avctx, AV_LOG_ERROR, "marker missing after first P partition at %d %d\n", s->mb_x, s->mb_y); av_log(s->avctx, AV_LOG_ERROR, "marker missing after first P partition at %d %d\n", s->mb_x, s->mb_y);
return -1; return -1;
......
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