summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-05-05 19:53:40 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-05-05 19:53:40 +0000
commit4ccde216cddac98604a944b4fdc2588deaaa1fe5 (patch)
tree51dc0adae80ad8b5d9ec1c2c710e329fd7bb661d
parenta7137a0452e0c821f4ad1232875c7065097187b0 (diff)
support decoding mpeg4 with buggy dc clipping
Originally committed as revision 3108 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/avcodec.h3
-rw-r--r--libavcodec/h263.c7
-rw-r--r--libavcodec/h263dec.c6
3 files changed, 14 insertions, 2 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 6738293f50..10992f686e 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -17,7 +17,7 @@ extern "C" {
#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 @@ typedef struct AVCodecContext {
#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%
/**
diff --git a/libavcodec/h263.c b/libavcodec/h263.c
index 8cb9d5646c..59d746272c 100644
--- a/libavcodec/h263.c
+++ b/libavcodec/h263.c
@@ -2440,7 +2440,12 @@ static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, int level, int *di
}
}
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;
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 0f45479c8f..ea8badb9dc 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -548,6 +548,9 @@ retry:
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 @@ retry:
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;