[FFmpeg-cvslog] mpeg4videodec: move mpeg4-specific bug detection from h263 generic code to mpeg4

Anton Khirnov git at videolan.org
Sat Nov 30 02:29:30 CET 2013


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Tue Nov 26 12:40:13 2013 +0100| [b452d5ae866942cec00aa1432fe29498b38b49fc] | committer: Anton Khirnov

mpeg4videodec: move mpeg4-specific bug detection from h263 generic code to mpeg4

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b452d5ae866942cec00aa1432fe29498b38b49fc
---

 libavcodec/h263dec.c       |   85 -------------------------------------------
 libavcodec/mpeg4videodec.c |   86 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 86 insertions(+), 85 deletions(-)

diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 76a8940..9c8d355 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -461,80 +461,11 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
 
     avctx->has_b_frames = !s->low_delay;
 
-    if (s->xvid_build == -1 && s->divx_version == -1 && s->lavc_build == -1) {
-        if (s->stream_codec_tag == AV_RL32("XVID") ||
-            s->codec_tag        == AV_RL32("XVID") ||
-            s->codec_tag        == AV_RL32("XVIX") ||
-            s->codec_tag        == AV_RL32("RMP4") ||
-            s->codec_tag        == AV_RL32("ZMP4") ||
-            s->codec_tag        == AV_RL32("SIPP"))
-            s->xvid_build = 0;
-    }
-
-    if (s->xvid_build == -1 && s->divx_version == -1 && s->lavc_build == -1)
-        if (s->codec_tag == AV_RL32("DIVX") && s->vo_type == 0 &&
-            s->vol_control_parameters == 0)
-            s->divx_version = 400;  // divx 4
-
-    if (s->xvid_build >= 0 && s->divx_version >= 0) {
-        s->divx_version =
-        s->divx_build   = -1;
-    }
-
-    if (s->workaround_bugs & FF_BUG_AUTODETECT) {
-        if (s->codec_tag == AV_RL32("XVIX"))
-            s->workaround_bugs |= FF_BUG_XVID_ILACE;
-
-        if (s->codec_tag == AV_RL32("UMP4"))
-            s->workaround_bugs |= FF_BUG_UMP4;
-
-        if (s->divx_version >= 500 && s->divx_build < 1814)
-            s->workaround_bugs |= FF_BUG_QPEL_CHROMA;
-
-        if (s->divx_version > 502 && s->divx_build < 1814)
-            s->workaround_bugs |= FF_BUG_QPEL_CHROMA2;
-
-        if (s->xvid_build <= 3U)
-            s->padding_bug_score = 256 * 256 * 256 * 64;
-
-        if (s->xvid_build <= 1U)
-            s->workaround_bugs |= FF_BUG_QPEL_CHROMA;
-
-        if (s->xvid_build <= 12U)
-            s->workaround_bugs |= FF_BUG_EDGE;
-
-        if (s->xvid_build <= 32U)
-            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;    \
     s->dsp.avg_        ## postfix1 = ff_avg_        ## postfix2;
 
-        if (s->lavc_build < 4653U)
-            s->workaround_bugs |= FF_BUG_STD_QPEL;
-
-        if (s->lavc_build < 4655U)
-            s->workaround_bugs |= FF_BUG_DIRECT_BLOCKSIZE;
-
-        if (s->lavc_build < 4670U)
-            s->workaround_bugs |= FF_BUG_EDGE;
-
-        if (s->lavc_build <= 4712U)
-            s->workaround_bugs |= FF_BUG_DC_CLIP;
-
-        if (s->divx_version >= 0)
-            s->workaround_bugs |= FF_BUG_DIRECT_BLOCKSIZE;
-        if (s->divx_version == 501 && s->divx_build == 20020416)
-            s->padding_bug_score = 256 * 256 * 256 * 64;
-
-        if (s->divx_version < 500U)
-            s->workaround_bugs |= FF_BUG_EDGE;
-
-        if (s->divx_version >= 0)
-            s->workaround_bugs |= FF_BUG_HPEL_CHROMA;
-    }
-
     if (s->workaround_bugs & FF_BUG_STD_QPEL) {
         SET_QPEL_FUNC(qpel_pixels_tab[0][5], qpel16_mc11_old_c)
         SET_QPEL_FUNC(qpel_pixels_tab[0][7], qpel16_mc31_old_c)
@@ -551,22 +482,6 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
         SET_QPEL_FUNC(qpel_pixels_tab[1][15], qpel8_mc33_old_c)
     }
 
-    if (avctx->debug & FF_DEBUG_BUGS)
-        av_log(s->avctx, AV_LOG_DEBUG,
-               "bugs: %X lavc_build:%d xvid_build:%d divx_version:%d divx_build:%d %s\n",
-               s->workaround_bugs, s->lavc_build, s->xvid_build,
-               s->divx_version, s->divx_build, s->divx_packed ? "p" : "");
-
-#if HAVE_MMX
-    if (s->codec_id == AV_CODEC_ID_MPEG4 && s->xvid_build >= 0 &&
-        avctx->idct_algo == FF_IDCT_AUTO &&
-        (av_get_cpu_flags() & AV_CPU_FLAG_MMX)) {
-        avctx->idct_algo = FF_IDCT_XVIDMMX;
-        ff_dct_common_init(s);
-        s->picture_number = 0;
-    }
-#endif
-
     /* After H263 & mpeg4 header decode we have the height, width,
      * and other parameters. So then we could init the picture.
      * FIXME: By the way H263 decoder is evolving it should have
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 8511dc3..c42da7f 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -2403,6 +2403,92 @@ end:
         s->low_delay = 1;
     s->avctx->has_b_frames = !s->low_delay;
 
+    if (s->xvid_build == -1 && s->divx_version == -1 && s->lavc_build == -1) {
+        if (s->stream_codec_tag == AV_RL32("XVID") ||
+            s->codec_tag        == AV_RL32("XVID") ||
+            s->codec_tag        == AV_RL32("XVIX") ||
+            s->codec_tag        == AV_RL32("RMP4") ||
+            s->codec_tag        == AV_RL32("ZMP4") ||
+            s->codec_tag        == AV_RL32("SIPP"))
+            s->xvid_build = 0;
+    }
+
+    if (s->xvid_build == -1 && s->divx_version == -1 && s->lavc_build == -1)
+        if (s->codec_tag == AV_RL32("DIVX") && s->vo_type == 0 &&
+            s->vol_control_parameters == 0)
+            s->divx_version = 400;  // divx 4
+
+    if (s->xvid_build >= 0 && s->divx_version >= 0) {
+        s->divx_version =
+        s->divx_build   = -1;
+    }
+
+    if (s->workaround_bugs & FF_BUG_AUTODETECT) {
+        if (s->codec_tag == AV_RL32("XVIX"))
+            s->workaround_bugs |= FF_BUG_XVID_ILACE;
+
+        if (s->codec_tag == AV_RL32("UMP4"))
+            s->workaround_bugs |= FF_BUG_UMP4;
+
+        if (s->divx_version >= 500 && s->divx_build < 1814)
+            s->workaround_bugs |= FF_BUG_QPEL_CHROMA;
+
+        if (s->divx_version > 502 && s->divx_build < 1814)
+            s->workaround_bugs |= FF_BUG_QPEL_CHROMA2;
+
+        if (s->xvid_build <= 3U)
+            s->padding_bug_score = 256 * 256 * 256 * 64;
+
+        if (s->xvid_build <= 1U)
+            s->workaround_bugs |= FF_BUG_QPEL_CHROMA;
+
+        if (s->xvid_build <= 12U)
+            s->workaround_bugs |= FF_BUG_EDGE;
+
+        if (s->xvid_build <= 32U)
+            s->workaround_bugs |= FF_BUG_DC_CLIP;
+
+        if (s->lavc_build < 4653U)
+            s->workaround_bugs |= FF_BUG_STD_QPEL;
+
+        if (s->lavc_build < 4655U)
+            s->workaround_bugs |= FF_BUG_DIRECT_BLOCKSIZE;
+
+        if (s->lavc_build < 4670U)
+            s->workaround_bugs |= FF_BUG_EDGE;
+
+        if (s->lavc_build <= 4712U)
+            s->workaround_bugs |= FF_BUG_DC_CLIP;
+
+        if (s->divx_version >= 0)
+            s->workaround_bugs |= FF_BUG_DIRECT_BLOCKSIZE;
+
+        if (s->divx_version == 501 && s->divx_build == 20020416)
+            s->padding_bug_score = 256 * 256 * 256 * 64;
+
+        if (s->divx_version < 500U)
+            s->workaround_bugs |= FF_BUG_EDGE;
+
+        if (s->divx_version >= 0)
+            s->workaround_bugs |= FF_BUG_HPEL_CHROMA;
+    }
+
+#if HAVE_MMX
+    if (s->codec_id == AV_CODEC_ID_MPEG4 && s->xvid_build >= 0 &&
+        s->avctx->idct_algo == FF_IDCT_AUTO &&
+        (av_get_cpu_flags() & AV_CPU_FLAG_MMX)) {
+        s->avctx->idct_algo = FF_IDCT_XVIDMMX;
+        ff_dct_common_init(s);
+        s->picture_number = 0;
+    }
+#endif
+
+    if (s->avctx->debug & FF_DEBUG_BUGS)
+        av_log(s->avctx, AV_LOG_DEBUG,
+               "bugs: %X lavc_build:%d xvid_build:%d divx_version:%d divx_build:%d %s\n",
+               s->workaround_bugs, s->lavc_build, s->xvid_build,
+               s->divx_version, s->divx_build, s->divx_packed ? "p" : "");
+
     return decode_vop_header(ctx, gb);
 }
 



More information about the ffmpeg-cvslog mailing list