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 <[email protected]>
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 -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to