Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Niklas Haas via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Niklas Haas <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] avfilter/x86/f_ebur128: only use filter_channels_avx for >= 2 channels (PR #20939)
Date: Mon, 17 Nov 2025 09:53:50 -0000
Message-ID: <176337323108.25.11641862118543033914@2cb04c0e5124> (raw)

PR #20939 opened by Niklas Haas (haasn)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20939
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20939.patch

The approach of this ASM routine is to process two channels at a time using
AVX instructions. Obviously, there is no point in doing this if there is only
a single channel; in which case the scalar loop would be better.

Fixes a performance regression when filtering mono audio on certain CPUs,
notably e.g. the Intel N100.


>From fbfd8dfaa3cd8a09119591f7387925fc3f396fab Mon Sep 17 00:00:00 2001
From: Niklas Haas <git@haasn.dev>
Date: Mon, 17 Nov 2025 10:50:54 +0100
Subject: [PATCH] avfilter/x86/f_ebur128: only use filter_channels_avx for >= 2
 channels

The approach of this ASM routine is to process two channels at a time using
AVX instructions. Obviously, there is no point in doing this if there is only
a single channel; in which case the scalar loop would be better.

Fixes a performance regression when filtering mono audio on certain CPUs,
notably e.g. the Intel N100.
---
 libavfilter/x86/f_ebur128_init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavfilter/x86/f_ebur128_init.c b/libavfilter/x86/f_ebur128_init.c
index 4a7109746d..6d43b4887f 100644
--- a/libavfilter/x86/f_ebur128_init.c
+++ b/libavfilter/x86/f_ebur128_init.c
@@ -33,7 +33,8 @@ av_cold void ff_ebur128_init_x86(EBUR128DSPContext *dsp, int nb_channels)
     int cpu_flags = av_get_cpu_flags();
 
     if (ARCH_X86_64 && EXTERNAL_AVX(cpu_flags)) {
-        dsp->filter_channels = ff_ebur128_filter_channels_avx;
+        if (nb_channels >= 2)
+            dsp->filter_channels = ff_ebur128_filter_channels_avx;
         if (nb_channels == 2)
             dsp->find_peak = ff_ebur128_find_peak_2ch_avx;
     }
-- 
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-11-17  9:54 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=176337323108.25.11641862118543033914@2cb04c0e5124 \
    --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