[FFmpeg-cvslog] avfilter/x86/vf_colordetect: make the AVX512 functions run only on ICL targets or newer

James Almer git at videolan.org
Mon Jul 21 23:25:57 EEST 2025


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Mon Jul 21 17:25:15 2025 -0300| [c62813a057ed1d02dbd53733f46daa98ba5844f3] | committer: James Almer

avfilter/x86/vf_colordetect: make the AVX512 functions run only on ICL targets or newer

For detect_range, the usage of vpbroadcast{b,w} requires the AVX512BW extension, and for
detect_alpha we don't want ZMM instructions downclocking old CPUs.

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c62813a057ed1d02dbd53733f46daa98ba5844f3
---

 libavfilter/x86/vf_colordetect.asm    |  2 +-
 libavfilter/x86/vf_colordetect_init.c | 24 ++++++++++++------------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/libavfilter/x86/vf_colordetect.asm b/libavfilter/x86/vf_colordetect.asm
index 9a5c5ad21b..489f91c421 100644
--- a/libavfilter/x86/vf_colordetect.asm
+++ b/libavfilter/x86/vf_colordetect.asm
@@ -141,7 +141,7 @@ detect_alpha_fn w, d, full
 detect_alpha_fn b, w, limited
 detect_alpha_fn w, d, limited
 
-INIT_ZMM avx512
+INIT_ZMM avx512icl
 detect_range_fn b
 detect_range_fn w
 detect_alpha_fn b, w, full
diff --git a/libavfilter/x86/vf_colordetect_init.c b/libavfilter/x86/vf_colordetect_init.c
index 8253dc1d17..828f01937d 100644
--- a/libavfilter/x86/vf_colordetect_init.c
+++ b/libavfilter/x86/vf_colordetect_init.c
@@ -58,13 +58,13 @@ static int FUNC_NAME(const uint8_t *color, ptrdiff_t color_stride,
 }
 
 #if HAVE_X86ASM
-#if HAVE_AVX512_EXTERNAL
-DETECT_RANGE_FUNC(detect_range_avx512,   ff_detect_rangeb_avx512, ff_detect_range_c,   0, 64)
-DETECT_RANGE_FUNC(detect_range16_avx512, ff_detect_rangew_avx512, ff_detect_range16_c, 1, 64)
-DETECT_ALPHA_FUNC(detect_alpha_full_avx512,   ff_detect_alphab_full_avx512, ff_detect_alpha_full_c,   0, 64)
-DETECT_ALPHA_FUNC(detect_alpha16_full_avx512, ff_detect_alphaw_full_avx512, ff_detect_alpha16_full_c, 1, 64)
-DETECT_ALPHA_FUNC(detect_alpha_limited_avx512,   ff_detect_alphab_limited_avx512, ff_detect_alpha_limited_c,   0, 64)
-DETECT_ALPHA_FUNC(detect_alpha16_limited_avx512, ff_detect_alphaw_limited_avx512, ff_detect_alpha16_limited_c, 1, 64)
+#if HAVE_AVX512ICL_EXTERNAL
+DETECT_RANGE_FUNC(detect_range_avx512icl,   ff_detect_rangeb_avx512icl, ff_detect_range_c,   0, 64)
+DETECT_RANGE_FUNC(detect_range16_avx512icl, ff_detect_rangew_avx512icl, ff_detect_range16_c, 1, 64)
+DETECT_ALPHA_FUNC(detect_alpha_full_avx512icl,   ff_detect_alphab_full_avx512icl, ff_detect_alpha_full_c,   0, 64)
+DETECT_ALPHA_FUNC(detect_alpha16_full_avx512icl, ff_detect_alphaw_full_avx512icl, ff_detect_alpha16_full_c, 1, 64)
+DETECT_ALPHA_FUNC(detect_alpha_limited_avx512icl,   ff_detect_alphab_limited_avx512icl, ff_detect_alpha_limited_c,   0, 64)
+DETECT_ALPHA_FUNC(detect_alpha16_limited_avx512icl, ff_detect_alphaw_limited_avx512icl, ff_detect_alpha16_limited_c, 1, 64)
 #endif
 #if HAVE_AVX2_EXTERNAL
 DETECT_RANGE_FUNC(detect_range_avx2,   ff_detect_rangeb_avx2, ff_detect_range_c,   0, 32)
@@ -91,13 +91,13 @@ av_cold void ff_color_detect_dsp_init_x86(FFColorDetectDSPContext *dsp, int dept
         }
     }
 #endif
-#if HAVE_AVX512_EXTERNAL
-    if (EXTERNAL_AVX512(cpu_flags)) {
-        dsp->detect_range = depth > 8 ? detect_range16_avx512 : detect_range_avx512;
+#if HAVE_AVX512ICL_EXTERNAL
+    if (EXTERNAL_AVX512ICL(cpu_flags)) {
+        dsp->detect_range = depth > 8 ? detect_range16_avx512icl : detect_range_avx512icl;
         if (color_range == AVCOL_RANGE_JPEG) {
-            dsp->detect_alpha = depth > 8 ? detect_alpha16_full_avx512 : detect_alpha_full_avx512;
+            dsp->detect_alpha = depth > 8 ? detect_alpha16_full_avx512icl : detect_alpha_full_avx512icl;
         } else {
-            dsp->detect_alpha = depth > 8 ? detect_alpha16_limited_avx512 : detect_alpha_limited_avx512;
+            dsp->detect_alpha = depth > 8 ? detect_alpha16_limited_avx512icl : detect_alpha_limited_avx512icl;
         }
     }
 #endif



More information about the ffmpeg-cvslog mailing list