changeset 2004:ec6bfd8d92fc libavcodec

support decoding mpeg4 with buggy dc clipping
author michael
date Wed, 05 May 2004 19:53:40 +0000
parents 16ac9630317d
children 28d3f73aa254
files avcodec.h h263.c h263dec.c
diffstat 3 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/avcodec.h	Wed May 05 00:14:22 2004 +0000
+++ b/avcodec.h	Wed May 05 19:53:40 2004 +0000
@@ -17,7 +17,7 @@
 
 #define FFMPEG_VERSION_INT     0x000408
 #define FFMPEG_VERSION         "0.4.8"
-#define LIBAVCODEC_BUILD       4712
+#define LIBAVCODEC_BUILD       4713
 
 #define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
 #define LIBAVCODEC_VERSION     FFMPEG_VERSION
@@ -849,6 +849,7 @@
 #define FF_BUG_DIRECT_BLOCKSIZE 512
 #define FF_BUG_EDGE             1024
 #define FF_BUG_HPEL_CHROMA      2048
+#define FF_BUG_DC_CLIP          4096
 //#define FF_BUG_FAKE_SCALABILITY 16 //autodetection should work 100%
         
     /**
--- a/h263.c	Wed May 05 00:14:22 2004 +0000
+++ b/h263.c	Wed May 05 19:53:40 2004 +0000
@@ -2440,7 +2440,12 @@
         }
     }
     level *=scale;
-    if(level&(~2047)) level= level<0 ? 0 : 2047;
+    if(level&(~2047)){
+        if(level<0) 
+            level=0;
+        else if(!(s->workaround_bugs&FF_BUG_DC_CLIP))
+            level=2047;
+    }
     dc_val[0]= level;
 
     return ret;
--- a/h263dec.c	Wed May 05 00:14:22 2004 +0000
+++ b/h263dec.c	Wed May 05 19:53:40 2004 +0000
@@ -548,6 +548,9 @@
         if(s->xvid_build && s->xvid_build<=12)
             s->workaround_bugs|= FF_BUG_EDGE;
 
+        if(s->xvid_build && s->xvid_build<=32)
+            s->workaround_bugs|= FF_BUG_DC_CLIP;
+
 #define SET_QPEL_FUNC(postfix1, postfix2) \
     s->dsp.put_ ## postfix1 = ff_put_ ## postfix2;\
     s->dsp.put_no_rnd_ ## postfix1 = ff_put_no_rnd_ ## postfix2;\
@@ -562,6 +565,9 @@
         if(s->lavc_build && s->lavc_build<4670){
             s->workaround_bugs|= FF_BUG_EDGE;
         }
+        
+        if(s->lavc_build && s->lavc_build<=4712)
+            s->workaround_bugs|= FF_BUG_DC_CLIP;
 
         if(s->divx_version)
             s->workaround_bugs|= FF_BUG_DIRECT_BLOCKSIZE;