From: death via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: death <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] master (PR #20769)
Date: Mon, 27 Oct 2025 18:03:24 -0000
Message-ID: <176158820515.81.5552662637264189436@7d278768979e> (raw)
PR #20769 opened by death
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20769
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20769.patch
Remove dependency on dead code elimination + use correct cflags for debug build in MSVC
See https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/20763
>From 3150ac96e2437164fb3adcdbbc6bf118a6abd5e4 Mon Sep 17 00:00:00 2001
From: Piotr Pawlowski <p@perkele.cc>
Date: Mon, 27 Oct 2025 18:40:20 +0100
Subject: [PATCH 1/2] avcodec: Fix dependency on compiler performing dead code
elimination
---
libavcodec/avcodec.c | 5 +++--
libavcodec/encode.c | 18 +++++++++++-------
libavcodec/x86/idctdsp_init.c | 9 ++++++---
libavcodec/x86/mlpdsp_init.c | 6 ++++--
4 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 0355b7c338..6ef506a4fc 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -438,10 +438,11 @@ av_cold void ff_codec_close(AVCodecContext *avctx)
if (avcodec_is_open(avctx)) {
AVCodecInternal *avci = avctx->internal;
- if (CONFIG_FRAME_THREAD_ENCODER &&
- avci->frame_thread_encoder && avctx->thread_count > 1) {
+#if CONFIG_FRAME_THREAD_ENCODER
+ if (avci->frame_thread_encoder && avctx->thread_count > 1) {
ff_frame_thread_encoder_free(avctx);
}
+#endif
if (HAVE_THREADS && avci->thread_ctx)
ff_thread_free(avctx);
if (avci->needs_close && ffcodec(avctx->codec)->close)
diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 1eca5e38c1..060e63a3d5 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -316,12 +316,16 @@ static int encode_simple_internal(AVCodecContext *avctx, AVPacket *avpkt)
av_assert0(codec->cb_type == FF_CODEC_CB_TYPE_ENCODE);
- if (CONFIG_FRAME_THREAD_ENCODER && avci->frame_thread_encoder)
+#if CONFIG_FRAME_THREAD_ENCODER
+ if (avci->frame_thread_encoder) {
/* This will unref frame. */
ret = ff_thread_video_encode_frame(avctx, avpkt, frame, &got_packet);
- else {
+ } else {
ret = ff_encode_encode_cb(avctx, avpkt, frame, &got_packet);
}
+#else
+ ret = ff_encode_encode_cb(avctx, avpkt, frame, &got_packet);
+#endif
if (avci->draining && !got_packet)
avci->draining_done = 1;
@@ -824,11 +828,11 @@ int ff_encode_preinit(AVCodecContext *avctx)
memcpy(sd_packet->data, sd_frame->data, sd_frame->size);
}
- if (CONFIG_FRAME_THREAD_ENCODER) {
- ret = ff_frame_thread_encoder_init(avctx);
- if (ret < 0)
- return ret;
- }
+#if CONFIG_FRAME_THREAD_ENCODER
+ ret = ff_frame_thread_encoder_init(avctx);
+ if (ret < 0)
+ return ret;
+#endif
return 0;
}
diff --git a/libavcodec/x86/idctdsp_init.c b/libavcodec/x86/idctdsp_init.c
index 2d165b975b..d58056ef29 100644
--- a/libavcodec/x86/idctdsp_init.c
+++ b/libavcodec/x86/idctdsp_init.c
@@ -94,8 +94,8 @@ av_cold void ff_idctdsp_init_x86(IDCTDSPContext *c, AVCodecContext *avctx,
}
#endif
- if (ARCH_X86_64 &&
- !high_bit_depth &&
+#if ARCH_X86_64
+ if (!high_bit_depth &&
avctx->lowres == 0 &&
(avctx->idct_algo == FF_IDCT_AUTO ||
avctx->idct_algo == FF_IDCT_SIMPLEAUTO ||
@@ -106,9 +106,11 @@ av_cold void ff_idctdsp_init_x86(IDCTDSPContext *c, AVCodecContext *avctx,
c->idct_add = ff_simple_idct8_add_sse2;
c->perm_type = FF_IDCT_PERM_TRANSPOSE;
}
+#endif
}
- if (ARCH_X86_64 && avctx->lowres == 0) {
+#if ARCH_X86_64
+ if (avctx->lowres == 0) {
if (EXTERNAL_AVX(cpu_flags) &&
!high_bit_depth &&
(avctx->idct_algo == FF_IDCT_AUTO ||
@@ -158,4 +160,5 @@ av_cold void ff_idctdsp_init_x86(IDCTDSPContext *c, AVCodecContext *avctx,
}
}
}
+#endif
}
diff --git a/libavcodec/x86/mlpdsp_init.c b/libavcodec/x86/mlpdsp_init.c
index 950f996832..21a0e38143 100644
--- a/libavcodec/x86/mlpdsp_init.c
+++ b/libavcodec/x86/mlpdsp_init.c
@@ -200,8 +200,10 @@ av_cold void ff_mlpdsp_init_x86(MLPDSPContext *c)
if (INLINE_MMX(cpu_flags))
c->mlp_filter_channel = mlp_filter_channel_x86;
#endif
- if (ARCH_X86_64 && EXTERNAL_SSE4(cpu_flags))
+#if ARCH_X86_64
+ if (EXTERNAL_SSE4(cpu_flags))
c->mlp_rematrix_channel = ff_mlp_rematrix_channel_sse4;
- if (ARCH_X86_64 && EXTERNAL_AVX2_FAST(cpu_flags) && cpu_flags & AV_CPU_FLAG_BMI2)
+ if (EXTERNAL_AVX2_FAST(cpu_flags) && cpu_flags & AV_CPU_FLAG_BMI2)
c->mlp_rematrix_channel = ff_mlp_rematrix_channel_avx2_bmi2;
+#endif // ARCH_X86_64
}
--
2.49.1
>From 8b38b61a5764f0903cec6db8931dd431b14c3976 Mon Sep 17 00:00:00 2001
From: Piotr Pawlowski <p@perkele.cc>
Date: Mon, 27 Oct 2025 18:40:55 +0100
Subject: [PATCH 2/2] configure: Use -Od for debug build in MSVC
---
configure | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure b/configure
index 3b132d07c9..62bcc30ef8 100755
--- a/configure
+++ b/configure
@@ -5263,7 +5263,7 @@ probe_cc(){
_DEPCXXFLAGS='$(CXXFLAGS)'
_cflags_speed="-O2"
_cflags_size="-O1"
- _cflags_noopt="-O1"
+ _cflags_noopt="-Od"
if $_cc -nologo- 2>&1 | grep -q Linker; then
_ld_o='-out:$@'
_flags_filter=msvc_flags_link
--
2.49.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
reply other threads:[~2025-10-27 18:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=176158820515.81.5552662637264189436@7d278768979e \
--to=ffmpeg-devel@ffmpeg.org \
--cc=code@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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 https://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/ https://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