From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 96FB54CBB5 for ; Thu, 30 Oct 2025 13:53:43 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'kkQVKwSJ7ohl50Tslo4eq8bKET0iwq2PsqI8V9qO0bo=', expected b'M41zHpHvdJb6sWhriKZmd1DeC6ew9p/ddq1gJc8ovaE=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1761832410; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=kkQVKwSJ7ohl50Tslo4eq8bKET0iwq2PsqI8V9qO0bo=; b=u5EOTvVFXe1qfRW+yUH3VA8lNmn0k81+yqdiEQvuS6Rg4gyPnz39HWbLnpuV8lsE6KNuD kSV9lweYbEP+mwfuEzobFLWH6Cxs7EzGC+jd8QdpneNooksRyisr7egBP4ArohhrmaA18dn KJq92TefYzzkaQie3QJYhSBTzCgHCJd1fz9Usl7Lrd2V4DSM9m6w3j90MRo9HWDYdozvILq RQyK6X0JlBKZlqbvPn/TxqnEXHCPXHhCijoWReGTIzbJyz2yxZnBE2ZFj6E8jn2WBLcHAS+ +e7XZD4fF7mVr6+1ivYiCcA2n1xIK+Zu5c4uC5Xck9j1nokeTPk789b1rYPA== Received: from [172.19.0.2] (unknown [172.19.0.2]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 16E6968F69D; Thu, 30 Oct 2025 15:53:30 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1761832393; b=aKiIZMoFdla+UyOvJn6JUJNC70LFhEWU7GCoYiHpVEy0NkXhgHEumUXK0/eUmdck3qUql s14Sue/Fm6WdtqevpvPB/rOofxyySajbFJcbdQ2QmeWInLGaJ2a1ZVwiOA+nQ+u58jmRWqn 6oz16MIKATOeIPLZRltSNb30GuGJJYwyFk8SCc5V4BLLosGqYRFzORHny0+O/8ViCo0MUuW Qw+qfmR3YGX5T9/diPsHvHeRpq4ZauUNRpIQRcZAUU8OAmLjpMWX3VnIVqqsZf9tTv+ItBl xTIcsl3P5qJtalfpglrfAVMQLu8lw+7pBNX1K4AKRTpNa5sqdp1RKtDMNJEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1761832393; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=vjiaRH5JGuaG/EgdlZ3eXTjAbcgODrq+Y0u5gznVjk4=; b=AH2MKZmWKHNLkwYDSvggReT/VB/xBDzCAUMe+HKcUPibc4pqwmF/oq2ghxroswcEFL3wo KLhP5IPSMSN8U+v6FwepRtU6r0Bq0X8Ujt0ftuWMCmZXLv30RicLS74Ll4KjAygWsyH2OmN T9s8yzygqOfi5rAa4W3JDIu42NvHFFnZVHRKd9WxWhAm3KVw6Ym2XQ8sEdjsRMQ5ml+paSN jCNYout0UphuCxgaXxLVgBeOPTGYfBDs+bX9OLBgVb2wLh1swDA2RLmYnlSFnqxu5lz6hR1 qhTgYUBb+JXSvaU8PxjFdgzOWZv7oOXUETXerCX3S6xzfyVT1CeF+NclVNGQ== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1761832386; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=M41zHpHvdJb6sWhriKZmd1DeC6ew9p/ddq1gJc8ovaE=; b=zrHyYy5Iy3mTLClVogyUK44Wb0FrqZ0qd65nQVBI2yHZRvKYKh4wPshN2v7FbWmkgY4Nz 6Fm4+tI/McJnq6+SDEhuXuPianVjTlm8E2AF+MfG/YA6XLYWl2ibufzOZ04kew47nng9kXA 5qzqvJO1h8wpK6hQ+cAG1uZsrtJzabR/17aKfD/dSYdh9jAykynrvY6u/gfB9+SsDLHzyX5 /ZwUg2dXypqZFcUppSDLk5t4IKBTfohLI+0SXf6Kbq3GUSYGb5RGZo2hZjlwvs9iVZ7N56N hlyf4Ba8odJKeK3BxJm5Oi/fyrQKmtpvNpcQ6huz8AH0D/zpGb3n7dtKT/1g== Received: from 02c22a36bd31 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 42197687B29 for ; Thu, 30 Oct 2025 15:53:06 +0200 (EET) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Thu, 30 Oct 2025 13:53:05 -0000 Message-ID: <176183238643.81.5453188526226957976@7d278768979e> Message-ID-Hash: OB7OB2YD4532L2GHOMMLJ4IK5WJ56LQI X-Message-ID-Hash: OB7OB2YD4532L2GHOMMLJ4IK5WJ56LQI X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] All: Removed reliance on compiler performing dead code elimination, changed various macro constant checks from if() to #if (PR #20794) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: death via ffmpeg-devel Cc: death Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #20794 opened by death URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20794 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20794.patch https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/20763 No-dead-code-elimination patch, try 2 Verified on various MSVC configurations: x86_32, x86_64, ARM64. Most changes deal with x86 code checking for ARCH_X86_64 and failing to link on x86_32. >>From 4d5a97dd54fa9e69d095205bb5a9a3b699c13850 Mon Sep 17 00:00:00 2001 From: Piotr Pawlowski Date: Thu, 30 Oct 2025 14:41:40 +0100 Subject: [PATCH] All: Removed reliance on compiler performing dead code elimination, changed various macro constant checks from if() to #if --- libavcodec/avcodec.c | 5 +- libavcodec/encode.c | 17 +++--- libavcodec/x86/flacdsp_init.c | 16 ++++-- libavcodec/x86/hevc/dsp_init.c | 84 +++++++++++++++------------- libavcodec/x86/idctdsp_init.c | 9 ++- libavcodec/x86/mlpdsp_init.c | 6 +- libavcodec/x86/v210-init.c | 24 +++++--- libavcodec/x86/v210enc_init.c | 3 +- libavfilter/x86/colorspacedsp_init.c | 4 +- libavfilter/x86/f_ebur128_init.c | 4 +- libavfilter/x86/vf_atadenoise_init.c | 6 +- libavfilter/x86/vf_bwdif_init.c | 12 ++-- libavfilter/x86/vf_nlmeans_init.c | 4 +- libavfilter/x86/vf_ssim_init.c | 4 +- libavfilter/x86/vf_w3fdif_init.c | 4 +- 15 files changed, 125 insertions(+), 77 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..728b5a8c0b 100644 --- a/libavcodec/encode.c +++ b/libavcodec/encode.c @@ -316,12 +316,13 @@ 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 +#endif ret = ff_encode_encode_cb(avctx, avpkt, frame, &got_packet); - } if (avci->draining && !got_packet) avci->draining_done = 1; @@ -824,11 +825,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/flacdsp_init.c b/libavcodec/x86/flacdsp_init.c index fa993d3466..386955ba67 100644 --- a/libavcodec/x86/flacdsp_init.c +++ b/libavcodec/x86/flacdsp_init.c @@ -85,8 +85,10 @@ av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int c->decorrelate[0] = ff_flac_decorrelate_indep4_16_ssse3; else if (channels == 6) c->decorrelate[0] = ff_flac_decorrelate_indep6_16_ssse3; - else if (ARCH_X86_64 && channels == 8) +#if ARCH_X86_64 + else if (channels == 8) c->decorrelate[0] = ff_flac_decorrelate_indep8_16_ssse3; +#endif } else if (fmt == AV_SAMPLE_FMT_S32) { if (channels == 2) c->decorrelate[0] = ff_flac_decorrelate_indep2_32_ssse3; @@ -94,8 +96,10 @@ av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int c->decorrelate[0] = ff_flac_decorrelate_indep4_32_ssse3; else if (channels == 6) c->decorrelate[0] = ff_flac_decorrelate_indep6_32_ssse3; - else if (ARCH_X86_64 && channels == 8) +#if ARCH_X86_64 + else if (channels == 8) c->decorrelate[0] = ff_flac_decorrelate_indep8_32_ssse3; +#endif } } if (EXTERNAL_SSE4(cpu_flags)) { @@ -105,15 +109,19 @@ av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int } if (EXTERNAL_AVX(cpu_flags)) { if (fmt == AV_SAMPLE_FMT_S16) { - if (ARCH_X86_64 && channels == 8) +#if ARCH_X86_64 + if (channels == 8) c->decorrelate[0] = ff_flac_decorrelate_indep8_16_avx; +#endif } else if (fmt == AV_SAMPLE_FMT_S32) { if (channels == 4) c->decorrelate[0] = ff_flac_decorrelate_indep4_32_avx; else if (channels == 6) c->decorrelate[0] = ff_flac_decorrelate_indep6_32_avx; - else if (ARCH_X86_64 && channels == 8) +#if ARCH_X86_64 + else if (channels == 8) c->decorrelate[0] = ff_flac_decorrelate_indep8_32_avx; +#endif } } if (EXTERNAL_XOP(cpu_flags)) { diff --git a/libavcodec/x86/hevc/dsp_init.c b/libavcodec/x86/hevc/dsp_init.c index 6966340c42..3d568016e7 100644 --- a/libavcodec/x86/hevc/dsp_init.c +++ b/libavcodec/x86/hevc/dsp_init.c @@ -821,13 +821,13 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth) if (EXTERNAL_SSE2(cpu_flags)) { c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_8_sse2; c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_8_sse2; - if (ARCH_X86_64) { - c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_sse2; - c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_sse2; +#if ARCH_X86_64 + c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_sse2; + c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_sse2; - c->idct[2] = ff_hevc_idct_16x16_8_sse2; - c->idct[3] = ff_hevc_idct_32x32_8_sse2; - } + c->idct[2] = ff_hevc_idct_16x16_8_sse2; + c->idct[3] = ff_hevc_idct_32x32_8_sse2; +#endif SAO_BAND_INIT(8, sse2); c->idct_dc[0] = ff_hevc_idct_4x4_dc_8_sse2; @@ -843,10 +843,10 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth) c->add_residual[3] = ff_hevc_add_residual_32_8_sse2; } if (EXTERNAL_SSSE3(cpu_flags)) { - if(ARCH_X86_64) { - c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_ssse3; - c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_ssse3; - } +#if ARCH_X86_64 + c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_ssse3; + c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_ssse3; +#endif SAO_EDGE_INIT(8, ssse3); } #if HAVE_SSE4_EXTERNAL && ARCH_X86_64 @@ -866,13 +866,13 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth) if (EXTERNAL_AVX(cpu_flags)) { c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_8_avx; c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_8_avx; - if (ARCH_X86_64) { - c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_avx; - c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_avx; +#if ARCH_X86_64 + c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_avx; + c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_avx; - c->idct[2] = ff_hevc_idct_16x16_8_avx; - c->idct[3] = ff_hevc_idct_32x32_8_avx; - } + c->idct[2] = ff_hevc_idct_16x16_8_avx; + c->idct[3] = ff_hevc_idct_32x32_8_avx; +#endif SAO_BAND_INIT(8, avx); c->idct[0] = ff_hevc_idct_4x4_8_avx; @@ -986,7 +986,8 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth) c->add_residual[3] = ff_hevc_add_residual_32_8_avx2; } #endif /* HAVE_AVX2_EXTERNAL */ - if (EXTERNAL_AVX512ICL(cpu_flags) && ARCH_X86_64) { +#if ARCH_X86_64 + if (EXTERNAL_AVX512ICL(cpu_flags)) { c->put_hevc_qpel[1][0][1] = ff_hevc_put_qpel_h4_8_avx512icl; c->put_hevc_qpel[3][0][1] = ff_hevc_put_qpel_h8_8_avx512icl; c->put_hevc_qpel[5][0][1] = ff_hevc_put_qpel_h16_8_avx512icl; @@ -994,6 +995,7 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth) c->put_hevc_qpel[9][0][1] = ff_hevc_put_qpel_h64_8_avx512icl; c->put_hevc_qpel[3][1][1] = ff_hevc_put_qpel_hv8_8_avx512icl; } +#endif } else if (bit_depth == 10) { if (EXTERNAL_MMXEXT(cpu_flags)) { c->add_residual[0] = ff_hevc_add_residual_4_10_mmxext; @@ -1001,13 +1003,13 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth) if (EXTERNAL_SSE2(cpu_flags)) { c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_10_sse2; c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_10_sse2; - if (ARCH_X86_64) { - c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_10_sse2; - c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_10_sse2; +#if ARCH_X86_64 + c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_10_sse2; + c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_10_sse2; - c->idct[2] = ff_hevc_idct_16x16_10_sse2; - c->idct[3] = ff_hevc_idct_32x32_10_sse2; - } + c->idct[2] = ff_hevc_idct_16x16_10_sse2; + c->idct[3] = ff_hevc_idct_32x32_10_sse2; +#endif SAO_BAND_INIT(10, sse2); SAO_EDGE_INIT(10, sse2); @@ -1023,10 +1025,12 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth) c->add_residual[2] = ff_hevc_add_residual_16_10_sse2; c->add_residual[3] = ff_hevc_add_residual_32_10_sse2; } - if (EXTERNAL_SSSE3(cpu_flags) && ARCH_X86_64) { +#if ARCH_X86_64 + if (EXTERNAL_SSSE3(cpu_flags)) { c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_10_ssse3; c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_10_ssse3; } +#endif #if HAVE_SSE4_EXTERNAL && ARCH_X86_64 if (EXTERNAL_SSE4(cpu_flags)) { EPEL_LINKS(c->put_hevc_epel, 0, 0, pel_pixels, 10, sse4); @@ -1043,13 +1047,13 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth) if (EXTERNAL_AVX(cpu_flags)) { c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_10_avx; c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_10_avx; - if (ARCH_X86_64) { - c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_10_avx; - c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_10_avx; +#if ARCH_X86_64 + c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_10_avx; + c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_10_avx; - c->idct[2] = ff_hevc_idct_16x16_10_avx; - c->idct[3] = ff_hevc_idct_32x32_10_avx; - } + c->idct[2] = ff_hevc_idct_16x16_10_avx; + c->idct[3] = ff_hevc_idct_32x32_10_avx; +#endif c->idct[0] = ff_hevc_idct_4x4_10_avx; c->idct[1] = ff_hevc_idct_8x8_10_avx; @@ -1220,10 +1224,10 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth) if (EXTERNAL_SSE2(cpu_flags)) { c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_12_sse2; c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_12_sse2; - if (ARCH_X86_64) { - c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_12_sse2; - c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_12_sse2; - } +#if ARCH_X86_64 + c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_12_sse2; + c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_12_sse2; +#endif SAO_BAND_INIT(12, sse2); SAO_EDGE_INIT(12, sse2); @@ -1232,10 +1236,12 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth) c->idct_dc[2] = ff_hevc_idct_16x16_dc_12_sse2; c->idct_dc[3] = ff_hevc_idct_32x32_dc_12_sse2; } - if (EXTERNAL_SSSE3(cpu_flags) && ARCH_X86_64) { +#if ARCH_X86_64 + if (EXTERNAL_SSSE3(cpu_flags)) { c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_12_ssse3; c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_12_ssse3; } +#endif #if HAVE_SSE4_EXTERNAL && ARCH_X86_64 if (EXTERNAL_SSE4(cpu_flags)) { EPEL_LINKS(c->put_hevc_epel, 0, 0, pel_pixels, 12, sse4); @@ -1252,10 +1258,10 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth) if (EXTERNAL_AVX(cpu_flags)) { c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_12_avx; c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_12_avx; - if (ARCH_X86_64) { - c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_12_avx; - c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_12_avx; - } +#if ARCH_X86_64 + c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_12_avx; + c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_12_avx; +#endif SAO_BAND_INIT(12, avx); } if (EXTERNAL_AVX2(cpu_flags)) { 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 } diff --git a/libavcodec/x86/v210-init.c b/libavcodec/x86/v210-init.c index 8b3677b8aa..895cc8f329 100644 --- a/libavcodec/x86/v210-init.c +++ b/libavcodec/x86/v210-init.c @@ -38,28 +38,38 @@ av_cold void ff_v210_x86_init(V210DecContext *s) if (s->aligned_input) { if (cpu_flags & AV_CPU_FLAG_SSSE3) s->unpack_frame = ff_v210_planar_unpack_aligned_ssse3; - - if (HAVE_AVX_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX) +#if HAVE_AVX_EXTERNAL + if (cpu_flags & AV_CPU_FLAG_AVX) s->unpack_frame = ff_v210_planar_unpack_aligned_avx; +#endif - if (HAVE_AVX2_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX2) +#if HAVE_AVX2_EXTERNAL + if (cpu_flags & AV_CPU_FLAG_AVX2) s->unpack_frame = ff_v210_planar_unpack_aligned_avx2; +#endif +#if HAVE_AVX512ICL_EXTERNAL if (EXTERNAL_AVX512ICL(cpu_flags)) s->unpack_frame = ff_v210_planar_unpack_avx512icl; +#endif } else { if (cpu_flags & AV_CPU_FLAG_SSSE3) s->unpack_frame = ff_v210_planar_unpack_unaligned_ssse3; - - if (HAVE_AVX_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX) +#if HAVE_AVX_EXTERNAL + if (cpu_flags & AV_CPU_FLAG_AVX) s->unpack_frame = ff_v210_planar_unpack_unaligned_avx; +#endif - if (HAVE_AVX2_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX2) +#if HAVE_AVX2_EXTERNAL + if (cpu_flags & AV_CPU_FLAG_AVX2) s->unpack_frame = ff_v210_planar_unpack_unaligned_avx2; +#endif +#if HAVE_AVX512ICL_EXTERNAL if (EXTERNAL_AVX512ICL(cpu_flags)) s->unpack_frame = ff_v210_planar_unpack_avx512icl; - } #endif + } +#endif // HAVE_X86ASM } diff --git a/libavcodec/x86/v210enc_init.c b/libavcodec/x86/v210enc_init.c index 44f22ca7fe..8396ea7a0b 100644 --- a/libavcodec/x86/v210enc_init.c +++ b/libavcodec/x86/v210enc_init.c @@ -71,11 +71,12 @@ av_cold void ff_v210enc_init_x86(V210EncContext *s) s->pack_line_10 = ff_v210_planar_pack_10_avx512; #endif } - +#if HAVE_AVX512ICL_EXTERNAL if (EXTERNAL_AVX512ICL(cpu_flags)) { s->sample_factor_8 = 4; s->pack_line_8 = ff_v210_planar_pack_8_avx512icl; s->sample_factor_10 = 4; s->pack_line_10 = ff_v210_planar_pack_10_avx512icl; } +#endif } diff --git a/libavfilter/x86/colorspacedsp_init.c b/libavfilter/x86/colorspacedsp_init.c index b5006ac295..429cc8bd26 100644 --- a/libavfilter/x86/colorspacedsp_init.c +++ b/libavfilter/x86/colorspacedsp_init.c @@ -78,9 +78,10 @@ void ff_multiply3x3_sse2(int16_t *data[3], ptrdiff_t stride, int w, int h, void ff_colorspacedsp_x86_init(ColorSpaceDSPContext *dsp) { +#if ARCH_X86_64 int cpu_flags = av_get_cpu_flags(); - if (ARCH_X86_64 && EXTERNAL_SSE2(cpu_flags)) { + if (EXTERNAL_SSE2(cpu_flags)) { #define assign_yuv2yuv_fns(ss) \ dsp->yuv2yuv[BPP_8 ][BPP_8 ][SS_##ss] = ff_yuv2yuv_##ss##p8to8_sse2; \ dsp->yuv2yuv[BPP_8 ][BPP_10][SS_##ss] = ff_yuv2yuv_##ss##p8to10_sse2; \ @@ -116,4 +117,5 @@ void ff_colorspacedsp_x86_init(ColorSpaceDSPContext *dsp) dsp->multiply3x3 = ff_multiply3x3_sse2; } +#endif } diff --git a/libavfilter/x86/f_ebur128_init.c b/libavfilter/x86/f_ebur128_init.c index 4a7109746d..ef700e8080 100644 --- a/libavfilter/x86/f_ebur128_init.c +++ b/libavfilter/x86/f_ebur128_init.c @@ -30,11 +30,13 @@ double ff_ebur128_find_peak_2ch_avx(double *, int, const double *, int); av_cold void ff_ebur128_init_x86(EBUR128DSPContext *dsp, int nb_channels) { +#if ARCH_X86_64 int cpu_flags = av_get_cpu_flags(); - if (ARCH_X86_64 && EXTERNAL_AVX(cpu_flags)) { + if (EXTERNAL_AVX(cpu_flags)) { dsp->filter_channels = ff_ebur128_filter_channels_avx; if (nb_channels == 2) dsp->find_peak = ff_ebur128_find_peak_2ch_avx; } +#endif } diff --git a/libavfilter/x86/vf_atadenoise_init.c b/libavfilter/x86/vf_atadenoise_init.c index e7a653f191..3847e53250 100644 --- a/libavfilter/x86/vf_atadenoise_init.c +++ b/libavfilter/x86/vf_atadenoise_init.c @@ -36,15 +36,17 @@ void ff_atadenoise_filter_row8_serial_sse4(const uint8_t *src, uint8_t *dst, av_cold void ff_atadenoise_init_x86(ATADenoiseDSPContext *dsp, int depth, int algorithm, const float *sigma) { +#if ARCH_X86_64 int cpu_flags = av_get_cpu_flags(); for (int p = 0; p < 4; p++) { - if (ARCH_X86_64 && EXTERNAL_SSE4(cpu_flags) && depth <= 8 && algorithm == PARALLEL && sigma[p] == INT16_MAX) { + if (EXTERNAL_SSE4(cpu_flags) && depth <= 8 && algorithm == PARALLEL && sigma[p] == INT16_MAX) { dsp->filter_row[p] = ff_atadenoise_filter_row8_sse4; } - if (ARCH_X86_64 && EXTERNAL_SSE4(cpu_flags) && depth <= 8 && algorithm == SERIAL && sigma[p] == INT16_MAX) { + if (EXTERNAL_SSE4(cpu_flags) && depth <= 8 && algorithm == SERIAL && sigma[p] == INT16_MAX) { dsp->filter_row[p] = ff_atadenoise_filter_row8_serial_sse4; } } +#endif } diff --git a/libavfilter/x86/vf_bwdif_init.c b/libavfilter/x86/vf_bwdif_init.c index 76b574b2a9..51508ee771 100644 --- a/libavfilter/x86/vf_bwdif_init.c +++ b/libavfilter/x86/vf_bwdif_init.c @@ -67,18 +67,22 @@ av_cold void ff_bwdif_init_x86(BWDIFDSPContext *bwdif, int bit_depth) bwdif->filter_line = ff_bwdif_filter_line_sse2; if (EXTERNAL_SSSE3(cpu_flags)) bwdif->filter_line = ff_bwdif_filter_line_ssse3; - if (ARCH_X86_64 && EXTERNAL_AVX2_FAST(cpu_flags)) +#if ARCH_X86_64 + if (EXTERNAL_AVX2_FAST(cpu_flags)) bwdif->filter_line = ff_bwdif_filter_line_avx2; - if (ARCH_X86_64 && EXTERNAL_AVX512ICL(cpu_flags)) + if (EXTERNAL_AVX512ICL(cpu_flags)) bwdif->filter_line = ff_bwdif_filter_line_avx512icl; +#endif } else if (bit_depth <= 12) { if (EXTERNAL_SSE2(cpu_flags)) bwdif->filter_line = ff_bwdif_filter_line_12bit_sse2; if (EXTERNAL_SSSE3(cpu_flags)) bwdif->filter_line = ff_bwdif_filter_line_12bit_ssse3; - if (ARCH_X86_64 && EXTERNAL_AVX2_FAST(cpu_flags)) +#if ARCH_X86_64 + if (EXTERNAL_AVX2_FAST(cpu_flags)) bwdif->filter_line = ff_bwdif_filter_line_12bit_avx2; - if (ARCH_X86_64 && EXTERNAL_AVX512ICL(cpu_flags)) + if (EXTERNAL_AVX512ICL(cpu_flags)) bwdif->filter_line = ff_bwdif_filter_line_12bit_avx512icl; +#endif } } diff --git a/libavfilter/x86/vf_nlmeans_init.c b/libavfilter/x86/vf_nlmeans_init.c index 37764d30ab..5d67090a98 100644 --- a/libavfilter/x86/vf_nlmeans_init.c +++ b/libavfilter/x86/vf_nlmeans_init.c @@ -33,8 +33,10 @@ void ff_compute_weights_line_avx2(const uint32_t *const iia, av_cold void ff_nlmeans_init_x86(NLMeansDSPContext *dsp) { +#if ARCH_X86_64 int cpu_flags = av_get_cpu_flags(); - if (ARCH_X86_64 && EXTERNAL_AVX2_FAST(cpu_flags)) + if (EXTERNAL_AVX2_FAST(cpu_flags)) dsp->compute_weights_line = ff_compute_weights_line_avx2; +#endif } diff --git a/libavfilter/x86/vf_ssim_init.c b/libavfilter/x86/vf_ssim_init.c index cbaa20ef16..6f2305430c 100644 --- a/libavfilter/x86/vf_ssim_init.c +++ b/libavfilter/x86/vf_ssim_init.c @@ -34,8 +34,10 @@ void ff_ssim_init_x86(SSIMDSPContext *dsp) { int cpu_flags = av_get_cpu_flags(); - if (ARCH_X86_64 && EXTERNAL_SSSE3(cpu_flags)) +#if ARCH_X86_64 + if (EXTERNAL_SSSE3(cpu_flags)) dsp->ssim_4x4_line = ff_ssim_4x4_line_ssse3; +#endif if (EXTERNAL_SSE4(cpu_flags)) dsp->ssim_end_line = ff_ssim_end_line_sse4; if (EXTERNAL_XOP(cpu_flags)) diff --git a/libavfilter/x86/vf_w3fdif_init.c b/libavfilter/x86/vf_w3fdif_init.c index 16202fba76..6d677d651d 100644 --- a/libavfilter/x86/vf_w3fdif_init.c +++ b/libavfilter/x86/vf_w3fdif_init.c @@ -56,7 +56,9 @@ av_cold void ff_w3fdif_init_x86(W3FDIFDSPContext *dsp, int depth) dsp->filter_scale = ff_w3fdif_scale_sse2; } - if (ARCH_X86_64 && EXTERNAL_SSE2(cpu_flags) && depth <= 8) { +#if ARCH_X86_64 + if (EXTERNAL_SSE2(cpu_flags) && depth <= 8) { dsp->filter_complex_high = ff_w3fdif_complex_high_sse2; } +#endif } -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org