[FFmpeg-cvslog] avcodec/msmpeg4dec: Move ff_msmpeg4_decode_init() down
Andreas Rheinhardt
git at videolan.org
Thu Jul 3 21:56:23 EEST 2025
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Jun 22 10:43:05 2025 +0200| [3b6d1a6ee129cdc9cb381db6f5347e24c132d507] | committer: Andreas Rheinhardt
avcodec/msmpeg4dec: Move ff_msmpeg4_decode_init() down
Will avoid a forward declaration lateron.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3b6d1a6ee129cdc9cb381db6f5347e24c132d507
---
libavcodec/msmpeg4dec.c | 79 +++++++++++++++++++++++++------------------------
1 file changed, 40 insertions(+), 39 deletions(-)
diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c
index 36243e14c9..59ceb7dac6 100644
--- a/libavcodec/msmpeg4dec.c
+++ b/libavcodec/msmpeg4dec.c
@@ -360,45 +360,6 @@ static av_cold void msmpeg4_decode_init_static(void)
ff_msmp4_vc1_vlcs_init_once();
}
-av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx)
-{
- static AVOnce init_static_once = AV_ONCE_INIT;
- H263DecContext *const h = avctx->priv_data;
- int ret;
-
- if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0)
- return ret;
-
- if (ff_h263_decode_init(avctx) < 0)
- return -1;
-
- // We unquantize inter blocks as we parse them.
- h->c.dct_unquantize_inter = NULL;
-
- ff_msmpeg4_common_init(&h->c);
-
- switch (h->c.msmpeg4_version) {
- case MSMP4_V1:
- case MSMP4_V2:
- h->decode_mb = msmpeg4v12_decode_mb;
- break;
- case MSMP4_V3:
- case MSMP4_WMV1:
- h->decode_mb = msmpeg4v34_decode_mb;
- break;
- case MSMP4_WMV2:
- break;
- default:
- av_unreachable("List contains all cases using ff_msmpeg4_decode_init()");
- }
-
- h->c.slice_height = h->c.mb_height; //to avoid 1/0 if the first frame is not a keyframe
-
- ff_thread_once(&init_static_once, msmpeg4_decode_init_static);
-
- return 0;
-}
-
int ff_msmpeg4_decode_picture_header(H263DecContext *const h)
{
MSMP4DecContext *const ms = mpv_to_msmpeg4(h);
@@ -870,6 +831,46 @@ void ff_msmpeg4_decode_motion(MSMP4DecContext *const ms, int *mx_ptr, int *my_pt
*my_ptr = my;
}
+av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx)
+{
+ static AVOnce init_static_once = AV_ONCE_INIT;
+ H263DecContext *const h = avctx->priv_data;
+ int ret;
+
+ ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
+ if (ret < 0)
+ return ret;
+
+ if (ff_h263_decode_init(avctx) < 0)
+ return -1;
+
+ // We unquantize inter blocks as we parse them.
+ h->c.dct_unquantize_inter = NULL;
+
+ ff_msmpeg4_common_init(&h->c);
+
+ switch (h->c.msmpeg4_version) {
+ case MSMP4_V1:
+ case MSMP4_V2:
+ h->decode_mb = msmpeg4v12_decode_mb;
+ break;
+ case MSMP4_V3:
+ case MSMP4_WMV1:
+ h->decode_mb = msmpeg4v34_decode_mb;
+ break;
+ case MSMP4_WMV2:
+ break;
+ default:
+ av_unreachable("List contains all cases using ff_msmpeg4_decode_init()");
+ }
+
+ h->c.slice_height = h->c.mb_height; //to avoid 1/0 if the first frame is not a keyframe
+
+ ff_thread_once(&init_static_once, msmpeg4_decode_init_static);
+
+ return 0;
+}
+
const FFCodec ff_msmpeg4v1_decoder = {
.p.name = "msmpeg4v1",
CODEC_LONG_NAME("MPEG-4 part 2 Microsoft variant version 1"),
More information about the ffmpeg-cvslog
mailing list