PR #26058 opened by DROO AMOR (DROOdotFOO)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26058
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26058.patch

# Summary of changes

Routes 9-14 bit threshold to the existing x86 16-bit SSE4/AVX2 versions, as 
aarch64 and C already do. 

__As usual, more detailed checkasm numbers are in the commit message.__

1080p `threshold`, 1 thread, ms/frame, before -> after:

| | Zen 4 | Zen 3 |
|---|---|---|
| 10-bit | 1.07 -> 0.30 | 1.66 -> 0.45 |
| 12-bit | 1.02 -> 0.27 | 1.64 -> 0.39 |

## Manual testing

- [x] checkasm vf_threshold: Zen 4, Rocket Lake, Zen 3, x86_32
- [x] checkasm fails with 9-16 bit routed to the 8-bit versions


>From 464f403a373b2fda0add3de5f0c5ee7459f9534f Mon Sep 17 00:00:00 2001
From: DROOdotFOO <[email protected]>
Date: Sat, 14 Nov 2026 08:22:59 +0100
Subject: [PATCH] avfilter/x86/vf_threshold: extend 16-bit SIMD to 9-14 bit

Like the C and aarch64 versions, the 16-bit versions do not depend on
the depth, so use them for every depth above 8.

Test Name                  Zen4-gcc-13         Zen3-gcc-12
----------------------------------------------------------
threshold10_sse4         36.9 ( 5.38x)       43.9 ( 4.58x)
threshold10_avx2         25.2 ( 7.88x)       29.9 ( 6.72x)
threshold12_sse4         37.0 ( 5.47x)       43.3 ( 4.54x)
threshold12_avx2         25.3 ( 8.00x)       29.5 ( 6.66x)

Signed-off-by: DROOdotFOO <[email protected]>
---
 libavfilter/x86/vf_threshold_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/x86/vf_threshold_init.c 
b/libavfilter/x86/vf_threshold_init.c
index ce014143324..9410619a844 100644
--- a/libavfilter/x86/vf_threshold_init.c
+++ b/libavfilter/x86/vf_threshold_init.c
@@ -119,7 +119,7 @@ av_cold void ff_threshold_init_x86(ThresholdContext *s)
         if (EXTERNAL_AVX2_FAST(cpu_flags)) {
             s->threshold = threshold8_avx2_x86;
         }
-    } else if (s->depth == 16) {
+    } else if (s->depth > 8) {
         if (EXTERNAL_SSE4(cpu_flags)) {
             s->threshold = threshold16_sse4_x86;
         }
-- 
2.54.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to