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

Showing the changes to libavfilter (2 of 2 files). Show all

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
141detect_alpha_fn b, w, limited141detect_alpha_fn b, w, limited
142detect_alpha_fn w, d, limited142detect_alpha_fn w, d, limited
143 143
144INIT_ZMM avx512144INIT_ZMM avx512icl
145detect_range_fn b145detect_range_fn b
146detect_range_fn w146detect_range_fn w
147detect_alpha_fn b, w, full147detect_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
58}58}
59 59
60#if HAVE_X86ASM60#if HAVE_X86ASM
61#if HAVE_AVX512_EXTERNAL61#if HAVE_AVX512ICL_EXTERNAL
62DETECT_RANGE_FUNC(detect_range_avx512, ff_detect_rangeb_avx512, ff_detect_range_c, 0, 64)62DETECT_RANGE_FUNC(detect_range_avx512icl, ff_detect_rangeb_avx512icl, ff_detect_range_c, 0, 64)
63DETECT_RANGE_FUNC(detect_range16_avx512, ff_detect_rangew_avx512, ff_detect_range16_c, 1, 64)63DETECT_RANGE_FUNC(detect_range16_avx512icl, ff_detect_rangew_avx512icl, ff_detect_range16_c, 1, 64)
64DETECT_ALPHA_FUNC(detect_alpha_full_avx512, ff_detect_alphab_full_avx512, ff_detect_alpha_full_c, 0, 64)64DETECT_ALPHA_FUNC(detect_alpha_full_avx512icl, ff_detect_alphab_full_avx512icl, ff_detect_alpha_full_c, 0, 64)
65DETECT_ALPHA_FUNC(detect_alpha16_full_avx512, ff_detect_alphaw_full_avx512, ff_detect_alpha16_full_c, 1, 64)65DETECT_ALPHA_FUNC(detect_alpha16_full_avx512icl, ff_detect_alphaw_full_avx512icl, ff_detect_alpha16_full_c, 1, 64)
66DETECT_ALPHA_FUNC(detect_alpha_limited_avx512, ff_detect_alphab_limited_avx512, ff_detect_alpha_limited_c, 0, 64)66DETECT_ALPHA_FUNC(detect_alpha_limited_avx512icl, ff_detect_alphab_limited_avx512icl, ff_detect_alpha_limited_c, 0, 64)
67DETECT_ALPHA_FUNC(detect_alpha16_limited_avx512, ff_detect_alphaw_limited_avx512, ff_detect_alpha16_limited_c, 1, 64)67DETECT_ALPHA_FUNC(detect_alpha16_limited_avx512icl, ff_detect_alphaw_limited_avx512icl, ff_detect_alpha16_limited_c, 1, 64)
68#endif68#endif
69#if HAVE_AVX2_EXTERNAL69#if HAVE_AVX2_EXTERNAL
70DETECT_RANGE_FUNC(detect_range_avx2, ff_detect_rangeb_avx2, ff_detect_range_c, 0, 32)70DETECT_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
91 }91 }
92 }92 }
93#endif93#endif
94#if HAVE_AVX512_EXTERNAL94#if HAVE_AVX512ICL_EXTERNAL
95 if (EXTERNAL_AVX512(cpu_flags)) {95 if (EXTERNAL_AVX512ICL(cpu_flags)) {
96 dsp->detect_range = depth > 8 ? detect_range16_avx512 : detect_range_avx512;96 dsp->detect_range = depth > 8 ? detect_range16_avx512icl : detect_range_avx512icl;
97 if (color_range == AVCOL_RANGE_JPEG) {97 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;
99 } else {99 } 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;
101 }101 }
102 }102 }
103#endif103#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