Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avcodec/Makefile: Remove h263 decoder->mpeg4videodec.o dependency (PR #20665)
@ 2025-10-08  2:58 mkver via ffmpeg-devel
  0 siblings, 0 replies; only message in thread
From: mkver via ffmpeg-devel @ 2025-10-08  2:58 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: mkver

PR #20665 opened by mkver
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20665
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20665.patch


>From 1f02b0baca4e92ed3e432c476b16b9d8e140be88 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Wed, 8 Oct 2025 03:45:20 +0200
Subject: [PATCH 1/2] avcodec/h263dec: Avoid redundant branch

Only the MPEG-4 decoder can have partitioned frames here.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/h263dec.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 3821472e91..bacd258d53 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -215,12 +215,15 @@ static int decode_slice(H263DecContext *const h)
         return ret;
     }
 
+#if CONFIG_MPEG4_DECODER
     if (h->partitioned_frame) {
         const int qscale = h->c.qscale;
 
-        if (CONFIG_MPEG4_DECODER && h->c.codec_id == AV_CODEC_ID_MPEG4)
-            if ((ret = ff_mpeg4_decode_partitions(h)) < 0)
-                return ret;
+        av_assert1(h->c.codec_id == AV_CODEC_ID_MPEG4);
+
+        ret = ff_mpeg4_decode_partitions(h);
+        if (ret < 0)
+            return ret;
 
         /* restore variables which were modified */
         h->c.first_slice_line = 1;
@@ -228,6 +231,7 @@ static int decode_slice(H263DecContext *const h)
         h->c.mb_y             = h->c.resync_mb_y;
         ff_set_qscale(&h->c, qscale);
     }
+#endif
 
     for (; h->c.mb_y < h->c.mb_height; h->c.mb_y++) {
         /* per-row end of slice checks */
-- 
2.49.1


>From e9a2898e0b628f029fb83ca8fffd44d5d4e32bf5 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Wed, 8 Oct 2025 04:56:04 +0200
Subject: [PATCH 2/2] avcodec/Makefile: Remove h263 decoder->mpeg4videodec.o
 dependency

Also prefer using #if CONFIG_MPEG4_DECODER checks in order not
to rely on DCE.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/Makefile     |  5 +++--
 libavcodec/h263dec.c    | 10 ++++++++--
 libavcodec/ituh263dec.c |  8 ++++++--
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index d55e899c14..791fd5d5a4 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -158,7 +158,7 @@ OBJS-$(CONFIG_MPEGVIDEOENC)            += mpegvideo_enc.o mpeg12data.o  \
                                           motion_est.o ratecontrol.o
 OBJS-$(CONFIG_MPEGVIDEOENCDSP)         += mpegvideoencdsp.o
 OBJS-$(CONFIG_MSMPEG4DEC)              += msmpeg4dec.o msmpeg4.o msmpeg4data.o \
-                                          msmpeg4_vc1_data.o
+                                          msmpeg4_vc1_data.o mpeg4videodec.o
 OBJS-$(CONFIG_MSMPEG4ENC)              += msmpeg4enc.o msmpeg4.o msmpeg4data.o \
                                           msmpeg4_vc1_data.o
 OBJS-$(CONFIG_MSS34DSP)                += mss34dsp.o jpegquanttables.o
@@ -576,7 +576,8 @@ OBJS-$(CONFIG_MPEG2_CUVID_DECODER)     += cuviddec.o
 OBJS-$(CONFIG_MPEG2_MEDIACODEC_DECODER) += mediacodecdec.o
 OBJS-$(CONFIG_MPEG2_VAAPI_ENCODER)     += vaapi_encode_mpeg2.o
 OBJS-$(CONFIG_MPEG2_V4L2M2M_DECODER)   += v4l2_m2m_dec.o
-OBJS-$(CONFIG_MPEG4_DECODER)           += mpeg4videodsp.o xvididct.o
+OBJS-$(CONFIG_MPEG4_DECODER)           += mpeg4videodec.o mpeg4videodsp.o \
+                                          xvididct.o
 OBJS-$(CONFIG_MPEG4_ENCODER)           += mpeg4videoenc.o
 OBJS-$(CONFIG_MPEG4_CUVID_DECODER)     += cuviddec.o
 OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec.o
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index bacd258d53..697fe7e572 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -201,10 +201,12 @@ static int decode_slice(H263DecContext *const h)
 
     ff_set_qscale(&h->c, h->c.qscale);
 
+#if CONFIG_MPEG4_DECODER
     if (h->c.studio_profile) {
         if ((ret = ff_mpeg4_decode_studio_slice_header(h)) < 0)
             return ret;
     }
+#endif
 
     if (h->c.avctx->hwaccel) {
         const uint8_t *start = h->gb.buffer + get_bits_count(&h->gb) / 8;
@@ -500,13 +502,15 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict,
 
     avctx->has_b_frames = !h->c.low_delay;
 
-    if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) {
+#if CONFIG_MPEG4_DECODER
+    if (avctx->codec_id == AV_CODEC_ID_MPEG4) {
         if (h->c.pict_type != AV_PICTURE_TYPE_B && h->c.mb_num/2 > get_bits_left(&h->gb))
             return AVERROR_INVALIDDATA;
         ff_mpeg4_workaround_bugs(avctx);
         if (h->c.studio_profile != (h->c.idsp.idct == NULL))
             ff_mpv_idct_init(s);
     }
+#endif
 
     /* After H.263 & MPEG-4 header decode we have the height, width,
      * and other parameters. So then we could init the picture. */
@@ -615,8 +619,10 @@ frame_end:
 
     ff_mpv_frame_end(s);
 
-    if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4)
+#if CONFIG_MPEG4_DECODER
+    if (avctx->codec_id == AV_CODEC_ID_MPEG4)
         ff_mpeg4_frame_end(avctx, avpkt);
+#endif
 
     av_assert1(h->c.pict_type == h->c.cur_pic.ptr->f->pict_type);
     if (h->c.pict_type == AV_PICTURE_TYPE_B || h->c.low_delay) {
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index 7a78b95c50..dc8847b53b 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -240,9 +240,11 @@ int ff_h263_resync(H263DecContext *const h)
 
     if (show_bits(&h->gb, 16) ==0) {
         pos = get_bits_count(&h->gb);
-        if(CONFIG_MPEG4_DECODER && h->c.codec_id==AV_CODEC_ID_MPEG4)
+#if CONFIG_MPEG4_DECODER
+        if (h->c.codec_id == AV_CODEC_ID_MPEG4)
             ret = ff_mpeg4_decode_video_packet_header(h);
         else
+#endif
             ret = h263_decode_gob_header(h);
         if(ret>=0)
             return pos;
@@ -257,9 +259,11 @@ int ff_h263_resync(H263DecContext *const h)
             GetBitContext bak = h->gb;
 
             pos = get_bits_count(&h->gb);
-            if(CONFIG_MPEG4_DECODER && h->c.codec_id==AV_CODEC_ID_MPEG4)
+#if CONFIG_MPEG4_DECODER
+            if (h->c.codec_id == AV_CODEC_ID_MPEG4)
                 ret = ff_mpeg4_decode_video_packet_header(h);
             else
+#endif
                 ret = h263_decode_gob_header(h);
             if(ret>=0)
                 return pos;
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-10-08  2:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-08  2:58 [FFmpeg-devel] [PATCH] avcodec/Makefile: Remove h263 decoder->mpeg4videodec.o dependency (PR #20665) mkver via ffmpeg-devel

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ http://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git