changeset 761:7f4cc2f6d642 libavcodec

xvid qpel bug autodetect
author michaelni
date Tue, 22 Oct 2002 19:48:52 +0000
parents e858fe220ce0
children 5da504c8c90e
files h263.c h263dec.c mpegvideo.h
diffstat 3 files changed, 22 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/h263.c	Tue Oct 22 18:55:20 2002 +0000
+++ b/h263.c	Tue Oct 22 19:48:52 2002 +0000
@@ -4328,6 +4328,8 @@
         skip_bits(gb, 8);
     }
     buf[255]=0;
+    
+    /* divx detection */
     e=sscanf(buf, "DivX%dBuild%d", &ver, &build);
     if(e!=2)
         e=sscanf(buf, "DivX%db%d", &ver, &build);
@@ -4336,11 +4338,10 @@
         s->divx_build= build;
         if(s->picture_number==0){
             printf("This file was encoded with DivX%d Build%d\n", ver, build);
-            if(ver==500 && build==413){
-                printf("WARNING: this version of DivX is not MPEG4 compatible, trying to workaround these bugs...\n");
-            }
         }
     }
+    
+    /* ffmpeg detection */
     e=sscanf(buf, "FFmpeg%d.%d.%db%d", &ver, &ver2, &ver3, &build);
     if(e!=4)
         e=sscanf(buf, "FFmpeg v%d.%d.%d / libavcodec build: %d", &ver, &ver2, &ver3, &build); 
@@ -4356,6 +4357,15 @@
         if(s->picture_number==0)
             printf("This file was encoded with libavcodec build %d\n", build);
     }
+    
+    /* xvid detection */
+    e=sscanf(buf, "XviD%d", &build);
+    if(e==1){
+        s->xvid_build= build;
+        if(s->picture_number==0)
+            printf("This file was encoded with XviD build %d\n", build);
+    }
+
 //printf("User Data: %s\n", buf);
     return 0;
 }
--- a/h263dec.c	Tue Oct 22 18:55:20 2002 +0000
+++ b/h263dec.c	Tue Oct 22 19:48:52 2002 +0000
@@ -376,6 +376,13 @@
         if(s->divx_version){
             s->workaround_bugs|= FF_BUG_QPEL_CHROMA;
         }
+
+        if(s->avctx->fourcc == ff_get_fourcc("XVID") && s->xvid_build==0)
+            s->workaround_bugs|= FF_BUG_QPEL_CHROMA;
+        
+        if(s->xvid_build && s->xvid_build<=1)
+            s->workaround_bugs|= FF_BUG_QPEL_CHROMA;
+
 //printf("padding_bug_score: %d\n", s->padding_bug_score);
 #if 0
         if(s->divx_version==500)
--- a/mpegvideo.h	Tue Oct 22 18:55:20 2002 +0000
+++ b/mpegvideo.h	Tue Oct 22 19:48:52 2002 +0000
@@ -413,6 +413,8 @@
     UINT8 *bitstream_buffer; //Divx 5.01 puts several frames in a single one, this is used to reorder them
     int bitstream_buffer_size;
     
+    int xvid_build;
+    
     /* lavc specific stuff, used to workaround bugs in libavcodec */
     int ffmpeg_version;
     int lavc_build;