changeset 1004:3b9c2ac59ec4 libavcodec

padding bug autodetection improvement 2nd try
author michaelni
date Mon, 13 Jan 2003 13:20:21 +0000
parents c2c116876fd7
children c331a07c0be2
files h263dec.c
diffstat 1 files changed, 8 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/h263dec.c	Mon Jan 13 12:57:39 2003 +0000
+++ b/h263dec.c	Mon Jan 13 13:20:21 2003 +0000
@@ -144,8 +144,6 @@
 }
 
 static int decode_slice(MpegEncContext *s){
-    const int workaround_bugs= s->workaround_bugs;
-
     s->last_resync_gb= s->gb;
     s->first_slice_line= 1;
         
@@ -272,15 +270,10 @@
             else
                 s->padding_bug_score++;            
         }                          
-        
-        if(s->padding_bug_score > -2)
-            s->workaround_bugs |=  FF_BUG_NO_PADDING;
-        else
-            s->workaround_bugs &= ~FF_BUG_NO_PADDING;
     }
 
     // handle formats which dont have unique end markers
-    if(s->msmpeg4_version || (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*8 - get_bits_count(&s->gb);
         int max_extra=7;
         
@@ -289,9 +282,9 @@
             max_extra+= 17;
         
         /* buggy padding but the frame should still end approximately at the bitstream end */
-        if((workaround_bugs&FF_BUG_NO_PADDING) && s->error_resilience>=3)
+        if((s->workaround_bugs&FF_BUG_NO_PADDING) && s->error_resilience>=3)
             max_extra+= 48;
-        else if((workaround_bugs&FF_BUG_NO_PADDING))
+        else if((s->workaround_bugs&FF_BUG_NO_PADDING))
             max_extra+= 256*256*256*64;
         
         if(left>max_extra){
@@ -482,6 +475,11 @@
     avctx->has_b_frames= !s->low_delay;
 
     if(s->workaround_bugs&FF_BUG_AUTODETECT){
+        if(s->padding_bug_score > -2 && !s->data_partitioning)
+            s->workaround_bugs |=  FF_BUG_NO_PADDING;
+        else
+            s->workaround_bugs &= ~FF_BUG_NO_PADDING;
+
         if(s->avctx->fourcc == ff_get_fourcc("XVIX")) 
             s->workaround_bugs|= FF_BUG_XVID_ILACE;
 #if 0