Commit 4940ed6a authored by Michael Niedermayer's avatar Michael Niedermayer

automatic workaround for another padding bug

Originally committed as revision 3678 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 311c7008
...@@ -255,19 +255,26 @@ static int decode_slice(MpegEncContext *s){ ...@@ -255,19 +255,26 @@ static int decode_slice(MpegEncContext *s){
if(bits_left==0){ if(bits_left==0){
s->padding_bug_score+=16; s->padding_bug_score+=16;
}else if(bits_left>8){
s->padding_bug_score++;
} else if(bits_left != 1){ } else if(bits_left != 1){
int v= show_bits(&s->gb, 8); int v= show_bits(&s->gb, 8);
v|= 0x7F >> (7-(bits_count&7)); v|= 0x7F >> (7-(bits_count&7));
if(v==0x7F) if(v==0x7F && bits_left<=8)
s->padding_bug_score--; s->padding_bug_score--;
else if(v==0x7F && ((get_bits_count(&s->gb)+8)&8) && bits_left<=16)
s->padding_bug_score+= 4;
else else
s->padding_bug_score++; s->padding_bug_score++;
} }
} }
if(s->workaround_bugs&FF_BUG_AUTODETECT){
if(s->padding_bug_score > -2 && !s->data_partitioning && (s->divx_version || !s->resync_marker))
s->workaround_bugs |= FF_BUG_NO_PADDING;
else
s->workaround_bugs &= ~FF_BUG_NO_PADDING;
}
// handle formats which dont have unique end markers // handle formats which dont have unique end markers
if(s->msmpeg4_version || (s->workaround_bugs&FF_BUG_NO_PADDING)){ //FIXME perhaps solve this more cleanly if(s->msmpeg4_version || (s->workaround_bugs&FF_BUG_NO_PADDING)){ //FIXME perhaps solve this more cleanly
int left= s->gb.size_in_bits - get_bits_count(&s->gb); int left= s->gb.size_in_bits - get_bits_count(&s->gb);
...@@ -523,11 +530,6 @@ retry: ...@@ -523,11 +530,6 @@ retry:
} }
if(s->workaround_bugs&FF_BUG_AUTODETECT){ if(s->workaround_bugs&FF_BUG_AUTODETECT){
s->workaround_bugs &= ~FF_BUG_NO_PADDING;
if(s->padding_bug_score > -2 && !s->data_partitioning && (s->divx_version || !s->resync_marker))
s->workaround_bugs |= FF_BUG_NO_PADDING;
if(s->avctx->codec_tag == ff_get_fourcc("XVIX")) if(s->avctx->codec_tag == ff_get_fourcc("XVIX"))
s->workaround_bugs|= FF_BUG_XVID_ILACE; s->workaround_bugs|= FF_BUG_XVID_ILACE;
......
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