[FFmpeg-devel] [PATCH 5/7] avcodec/msmpeg4dec: Move setting decode_mb for WMV2 to wmv2dec.c

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Wed Oct 26 05:01:46 EEST 2022


It avoids checks and allows to make ff_wmv2_decode_mb() static;
furthermore, it allows to avoid a config_components.h inclusion.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/msmpeg4dec.c | 6 +-----
 libavcodec/wmv2dec.c    | 4 +++-
 libavcodec/wmv2dec.h    | 1 -
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c
index 8e12e1aab2..bc554ed2eb 100644
--- a/libavcodec/msmpeg4dec.c
+++ b/libavcodec/msmpeg4dec.c
@@ -22,8 +22,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "config_components.h"
-
 #include "libavutil/thread.h"
 
 #include "avcodec.h"
@@ -38,7 +36,6 @@
 #include "h263dec.h"
 #include "mpeg4videodec.h"
 #include "msmpeg4data.h"
-#include "wmv2dec.h"
 
 #define DC_VLC_BITS 9
 #define V2_INTRA_CBPC_VLC_BITS 3
@@ -391,8 +388,7 @@ av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx)
         s->decode_mb= msmpeg4v34_decode_mb;
         break;
     case 5:
-        if (CONFIG_WMV2_DECODER)
-            s->decode_mb= ff_wmv2_decode_mb;
+        break;
     case 6:
         //FIXME + TODO VC1 decode mb
         break;
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index a70913134c..2daf6c70e8 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -445,7 +445,7 @@ static inline int wmv2_decode_inter_block(WMV2DecContext *w, int16_t *block,
     }
 }
 
-int ff_wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64])
+static int wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64])
 {
     /* The following is only allowed because this encoder
      * does not use slice threading. */
@@ -573,6 +573,8 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx)
     if ((ret = ff_msmpeg4_decode_init(avctx)) < 0)
         return ret;
 
+    s->decode_mb = wmv2_decode_mb;
+
     ff_wmv2_common_init(s);
 
     return ff_intrax8_common_init(avctx, &w->x8,
diff --git a/libavcodec/wmv2dec.h b/libavcodec/wmv2dec.h
index cc410afe17..bc8745bf6f 100644
--- a/libavcodec/wmv2dec.h
+++ b/libavcodec/wmv2dec.h
@@ -23,7 +23,6 @@
 
 #include "mpegvideo.h"
 
-int ff_wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64]);
 int ff_wmv2_decode_picture_header(MpegEncContext * s);
 int ff_wmv2_decode_secondary_picture_header(MpegEncContext * s);
 void ff_wmv2_add_mb(MpegEncContext *s, int16_t block[6][64],
-- 
2.34.1



More information about the ffmpeg-devel mailing list