History

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.

James Almer committed 1 year ago

Commit c62813a1 parent b9287fd2 files · +13 −13Browse files

Unified · Split

2 files
  1. libavfilter/x86/vf_colordetect.asm +1 −1
  2. libavfilter/x86/vf_colordetect_init.c +12 −12
libavfilter/x86/vf_colordetect.asm+1−1
@@ -141,7 +141,7 @@ detect_alpha_fn w, d, full · 140 unmodified lines
141141 detect_alpha_fn b, w, limited
142142 detect_alpha_fn w, d, limited
143143
144−INIT_ZMM avx512
144+INIT_ZMM avx512icl
145145 detect_range_fn b
146146 detect_range_fn w
147147 detect_alpha_fn b, w, full
libavfilter/x86/vf_colordetect_init.c+12−12
@@ -58,13 +58,13 @@ static int FUNC_NAME(const uint8_t *color, ptrdiff_t color_stride, · 57 unmodified lines
5858 }
5959
6060 #if HAVE_X86ASM
61−#if HAVE_AVX512_EXTERNAL
62−DETECT_RANGE_FUNC(detect_range_avx512, ff_detect_rangeb_avx512, ff_detect_range_c, 0, 64)
63−DETECT_RANGE_FUNC(detect_range16_avx512, ff_detect_rangew_avx512, ff_detect_range16_c, 1, 64)
64−DETECT_ALPHA_FUNC(detect_alpha_full_avx512, ff_detect_alphab_full_avx512, ff_detect_alpha_full_c, 0, 64)
65−DETECT_ALPHA_FUNC(detect_alpha16_full_avx512, ff_detect_alphaw_full_avx512, ff_detect_alpha16_full_c, 1, 64)
66−DETECT_ALPHA_FUNC(detect_alpha_limited_avx512, ff_detect_alphab_limited_avx512, ff_detect_alpha_limited_c, 0, 64)
67−DETECT_ALPHA_FUNC(detect_alpha16_limited_avx512, ff_detect_alphaw_limited_avx512, ff_detect_alpha16_limited_c, 1, 64)
61+#if HAVE_AVX512ICL_EXTERNAL
62+DETECT_RANGE_FUNC(detect_range_avx512icl, ff_detect_rangeb_avx512icl, ff_detect_range_c, 0, 64)
63+DETECT_RANGE_FUNC(detect_range16_avx512icl, ff_detect_rangew_avx512icl, ff_detect_range16_c, 1, 64)
64+DETECT_ALPHA_FUNC(detect_alpha_full_avx512icl, ff_detect_alphab_full_avx512icl, ff_detect_alpha_full_c, 0, 64)
65+DETECT_ALPHA_FUNC(detect_alpha16_full_avx512icl, ff_detect_alphaw_full_avx512icl, ff_detect_alpha16_full_c, 1, 64)
66+DETECT_ALPHA_FUNC(detect_alpha_limited_avx512icl, ff_detect_alphab_limited_avx512icl, ff_detect_alpha_limited_c, 0, 64)
67+DETECT_ALPHA_FUNC(detect_alpha16_limited_avx512icl, ff_detect_alphaw_limited_avx512icl, ff_detect_alpha16_limited_c, 1, 64)
6868 #endif
6969 #if HAVE_AVX2_EXTERNAL
7070 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 · 20 unmodified lines
9191 }
9292 }
9393 #endif
94−#if HAVE_AVX512_EXTERNAL
95− if (EXTERNAL_AVX512(cpu_flags)) {
96− dsp->detect_range = depth > 8 ? detect_range16_avx512 : detect_range_avx512;
94+#if HAVE_AVX512ICL_EXTERNAL
95+ if (EXTERNAL_AVX512ICL(cpu_flags)) {
96+ dsp->detect_range = depth > 8 ? detect_range16_avx512icl : detect_range_avx512icl;
9797 if (color_range == AVCOL_RANGE_JPEG) {
98− dsp->detect_alpha = depth > 8 ? detect_alpha16_full_avx512 : detect_alpha_full_avx512;
98+ dsp->detect_alpha = depth > 8 ? detect_alpha16_full_avx512icl : detect_alpha_full_avx512icl;
9999 } else {
100− dsp->detect_alpha = depth > 8 ? detect_alpha16_limited_avx512 : detect_alpha_limited_avx512;
100+ dsp->detect_alpha = depth > 8 ? detect_alpha16_limited_avx512icl : detect_alpha_limited_avx512icl;
101101 }
102102 }
103103 #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t