diff --git a/Makefile.am b/Makefile.am index fdfcb6bc..5aaa7ab4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -154,7 +154,6 @@ libzimg_internal_la_SOURCES += \ src/zimg/resize/arm/resize_impl_arm.cpp \ src/zimg/resize/arm/resize_impl_arm.h - libneon_la_SOURCES = \ src/zimg/colorspace/arm/operation_impl_neon.cpp \ src/zimg/depth/arm/depth_convert_neon.cpp \ @@ -169,7 +168,8 @@ libzimg_internal_la_LIBADD += libneon.la endif # ARMSIMD if X86SIMD -noinst_LTLIBRARIES += libsse.la libsse2.la libavx.la libf16c.la libavx2.la +noinst_LTLIBRARIES += libsse.la libsse2.la libavx.la libf16c.la libavx2.la \ + libavx512.la libavx512_vnni.la libzimg_internal_la_SOURCES += \ src/zimg/colorspace/x86/operation_impl_x86.cpp \ @@ -193,7 +193,6 @@ libzimg_internal_la_SOURCES += \ src/zimg/unresize/x86/unresize_impl_x86.cpp \ src/zimg/unresize/x86/unresize_impl_x86.h - libsse_la_SOURCES = \ src/zimg/colorspace/x86/operation_impl_sse.cpp \ src/zimg/resize/x86/resize_impl_sse.cpp \ @@ -235,12 +234,6 @@ libavx2_la_SOURCES = \ libavx2_la_CXXFLAGS = $(AM_CXXFLAGS) -mavx2 -mf16c -mfma $(HSW_CFLAGS) libavx2_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/src/zimg $(graphengineflags) -libzimg_internal_la_LIBADD += libsse.la libsse2.la libavx.la libf16c.la libavx2.la -endif # X86SIMD - -if X86SIMD_AVX512 -noinst_LTLIBRARIES += libavx512.la libavx512_vnni.la - libavx512_la_SOURCES = \ src/zimg/colorspace/x86/gamma_constants_avx512.cpp \ src/zimg/colorspace/x86/gamma_constants_avx512.h \ @@ -257,8 +250,8 @@ libavx512_vnni_la_SOURCES = src/zimg/resize/x86/resize_impl_avx512_vnni.cpp libavx512_vnni_la_CXXFLAGS = $(AM_CXXFLAGS) -mavx512f -mavx512cd -mavx512vl -mavx512bw -mavx512dq -mavx512vnni $(CLX_CFLAGS) libavx512_vnni_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/src/zimg $(graphengineflags) -libzimg_internal_la_LIBADD += libavx512.la libavx512_vnni.la -endif # X86SIMD_AVX512 +libzimg_internal_la_LIBADD += libsse.la libsse2.la libavx.la libf16c.la libavx2.la libavx512.la libavx512_vnni.la +endif # X86SIMD libtestcommon_la_SOURCES = \ @@ -405,11 +398,15 @@ if X86SIMD test_unit_test_SOURCES += \ test/colorspace/x86/colorspace_avx_test.cpp \ test/colorspace/x86/colorspace_avx2_test.cpp \ + test/colorspace/x86/colorspace_avx512_test.cpp \ test/colorspace/x86/colorspace_sse_test.cpp \ test/colorspace/x86/colorspace_sse2_test.cpp \ + test/colorspace/x86/gamma_constants_avx512_test.cpp \ test/depth/x86/depth_convert_avx2_test.cpp \ + test/depth/x86/depth_convert_avx512_test.cpp \ test/depth/x86/depth_convert_sse2_test.cpp \ test/depth/x86/dither_avx2_test.cpp \ + test/depth/x86/dither_avx512_test.cpp \ test/depth/x86/dither_sse2_test.cpp \ test/depth/x86/error_diffusion_avx2_test.cpp \ test/depth/x86/error_diffusion_sse2_test.cpp \ @@ -417,20 +414,12 @@ test_unit_test_SOURCES += \ test/depth/x86/f16c_sse2_test.cpp \ test/resize/x86/resize_impl_avx_test.cpp \ test/resize/x86/resize_impl_avx2_test.cpp \ + test/resize/x86/resize_impl_avx512_test.cpp \ + test/resize/x86/resize_impl_avx512_vnni_test.cpp test/resize/x86/resize_impl_sse_test.cpp \ test/resize/x86/resize_impl_sse2_test.cpp endif # X86SIMD -if X86SIMD_AVX512 -test_unit_test_SOURCES += \ - test/colorspace/x86/colorspace_avx512_test.cpp \ - test/colorspace/x86/gamma_constants_avx512_test.cpp \ - test/depth/x86/depth_convert_avx512_test.cpp \ - test/depth/x86/dither_avx512_test.cpp \ - test/resize/x86/resize_impl_avx512_test.cpp \ - test/resize/x86/resize_impl_avx512_vnni_test.cpp -endif # X86SIMD_AVX512 - test/extra/googletest/build/lib/libgtest.a: .FAKE -$(MAKE) -C test/extra/googletest/build gtest @@ -442,6 +431,7 @@ test_unit_test_LDADD = \ libzimg_internal.la endif # UNIT_TEST + clean-local: -cd test/extra/googletest/build && make clean diff --git a/_msvc/unit_test/unit_test.vcxproj b/_msvc/unit_test/unit_test.vcxproj index 84066cb9..e3080eb4 100644 --- a/_msvc/unit_test/unit_test.vcxproj +++ b/_msvc/unit_test/unit_test.vcxproj @@ -267,7 +267,7 @@ Disabled true $(ProjectDir)..\..\src\zimg;$(ProjectDir)..\..\graphengine\include;$(ProjectDir)..\..\test;$(ProjectDir)..\..\test\extra;$(ProjectDir)..\..\test\extra\googletest\googletest\include - GRAPHENGINE_IMPL_NAMESPACE=zimg;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ZIMG_X86;ZIMG_X86_AVX512;%(PreprocessorDefinitions) + GRAPHENGINE_IMPL_NAMESPACE=zimg;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ZIMG_X86;%(PreprocessorDefinitions) true false Strict @@ -300,7 +300,7 @@ Disabled true $(ProjectDir)..\..\src\zimg;$(ProjectDir)..\..\graphengine\include;$(ProjectDir)..\..\test;$(ProjectDir)..\..\test\extra;$(ProjectDir)..\..\test\extra\googletest\googletest\include - GRAPHENGINE_IMPL_NAMESPACE=zimg;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ZIMG_X86;ZIMG_X86_AVX512;%(PreprocessorDefinitions) + GRAPHENGINE_IMPL_NAMESPACE=zimg;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ZIMG_X86;%(PreprocessorDefinitions) true false stdcpp17 @@ -334,7 +334,7 @@ true true $(ProjectDir)..\..\src\zimg;$(ProjectDir)..\..\graphengine\include;$(ProjectDir)..\..\test;$(ProjectDir)..\..\test\extra;$(ProjectDir)..\..\test\extra\googletest\googletest\include - GRAPHENGINE_IMPL_NAMESPACE=zimg;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ZIMG_X86;ZIMG_X86_AVX512;%(PreprocessorDefinitions) + GRAPHENGINE_IMPL_NAMESPACE=zimg;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ZIMG_X86;%(PreprocessorDefinitions) true Strict stdcpp17 @@ -373,7 +373,7 @@ true true $(ProjectDir)..\..\src\zimg;$(ProjectDir)..\..\graphengine\include;$(ProjectDir)..\..\test;$(ProjectDir)..\..\test\extra;$(ProjectDir)..\..\test\extra\googletest\googletest\include - GRAPHENGINE_IMPL_NAMESPACE=zimg;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ZIMG_X86;ZIMG_X86_AVX512;%(PreprocessorDefinitions) + GRAPHENGINE_IMPL_NAMESPACE=zimg;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ZIMG_X86;%(PreprocessorDefinitions) true stdcpp17 diff --git a/_msvc/zimg/zimg.vcxproj b/_msvc/zimg/zimg.vcxproj index fdb52e77..52a645a1 100644 --- a/_msvc/zimg/zimg.vcxproj +++ b/_msvc/zimg/zimg.vcxproj @@ -153,7 +153,7 @@ Disabled $(ProjectDir)..\..\src\zimg;$(ProjectDir)..\..\graphengine\include AssemblyAndSourceCode - ZIMG_GRAPHENGINE_API;GRAPHENGINE_IMPL_NAMESPACE=zimg;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ZIMG_X86;ZIMG_X86_AVX512;%(PreprocessorDefinitions) + ZIMG_GRAPHENGINE_API;GRAPHENGINE_IMPL_NAMESPACE=zimg;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ZIMG_X86;%(PreprocessorDefinitions) true true false @@ -202,7 +202,7 @@ Disabled $(ProjectDir)..\..\src\zimg;$(ProjectDir)..\..\graphengine\include AssemblyAndSourceCode - ZIMG_GRAPHENGINE_API;GRAPHENGINE_IMPL_NAMESPACE=zimg;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ZIMG_X86;ZIMG_X86_AVX512;%(PreprocessorDefinitions) + ZIMG_GRAPHENGINE_API;GRAPHENGINE_IMPL_NAMESPACE=zimg;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ZIMG_X86;%(PreprocessorDefinitions) true true false @@ -220,7 +220,7 @@ true $(ProjectDir)..\..\src\zimg;$(ProjectDir)..\..\graphengine\include AssemblyAndSourceCode - ZIMG_GRAPHENGINE_API;GRAPHENGINE_IMPL_NAMESPACE=zimg;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ZIMG_X86;ZIMG_X86_AVX512;NDEBUG;%(PreprocessorDefinitions) + ZIMG_GRAPHENGINE_API;GRAPHENGINE_IMPL_NAMESPACE=zimg;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ZIMG_X86;NDEBUG;%(PreprocessorDefinitions) false true Strict @@ -278,7 +278,7 @@ true $(ProjectDir)..\..\src\zimg;$(ProjectDir)..\..\graphengine\include AssemblyAndSourceCode - ZIMG_GRAPHENGINE_API;GRAPHENGINE_IMPL_NAMESPACE=zimg;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ZIMG_X86;ZIMG_X86_AVX512;NDEBUG;%(PreprocessorDefinitions) + ZIMG_GRAPHENGINE_API;GRAPHENGINE_IMPL_NAMESPACE=zimg;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ZIMG_X86;NDEBUG;%(PreprocessorDefinitions) false true stdcpp17 diff --git a/configure.ac b/configure.ac index c082fede..f759e4ce 100644 --- a/configure.ac +++ b/configure.ac @@ -87,25 +87,6 @@ AS_IF([test "x$X86" = "xyes" && test "x$enable_simd" != "xno"], AX_CHECK_COMPILE_FLAG([-mtune=haswell], AC_SUBST([HSW_CFLAGS], [-mtune=haswell])) AX_CHECK_COMPILE_FLAG([-mtune=skylake-avx512], AC_SUBST([SKX_CFLAGS], [-mtune=skylake-avx512])) AX_CHECK_COMPILE_FLAG([-mtune=cascadelake], AC_SUBST([CLX_CFLAGS], [-mtune=cascadelake])) - - AX_CHECK_COMPILE_FLAG( - [-mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -mavx512vbmi2 -mavx512bitalg -mavx512vpopcntdq -mavx512vnni], - [ - AC_DEFINE([ZIMG_X86_AVX512]) - enable_x86_simd_avx512=yes - ], [], [], - [AC_LANG_SOURCE([ -#include -int main() -{ - volatile __m512 x = _mm512_setzero_ps(); - x = _mm512_add_ps(x, x); -#if defined(__GNUC__) && defined(__x86_64__) - asm volatile ("" : : : "zmm16", "zmm17", "zmm18", "zmm19"); -#endif - return 0; -} - ])]) ]) diff --git a/src/zimg/colorspace/x86/gamma_constants_avx512.cpp b/src/zimg/colorspace/x86/gamma_constants_avx512.cpp index 58fe84b3..3f6055c1 100644 --- a/src/zimg/colorspace/x86/gamma_constants_avx512.cpp +++ b/src/zimg/colorspace/x86/gamma_constants_avx512.cpp @@ -1,5 +1,3 @@ -#ifdef ZIMG_X86_AVX512 - #include #include #include @@ -317,5 +315,3 @@ float st_2084_inverse_eotf(float x) } // namespace avx512constants } // namespace zimg::colorspace - -#endif // ZIMG_X86_AVX512 diff --git a/src/zimg/colorspace/x86/gamma_constants_avx512.h b/src/zimg/colorspace/x86/gamma_constants_avx512.h index a7fc6e4c..e7b904d5 100644 --- a/src/zimg/colorspace/x86/gamma_constants_avx512.h +++ b/src/zimg/colorspace/x86/gamma_constants_avx512.h @@ -1,7 +1,5 @@ #pragma once -#ifdef ZIMG_X86_AVX512 - #ifndef ZIMG_COLORSPACE_X86_GAMMA_CONSTANTS_H_ #define ZIMG_COLORSPACE_X86_GAMMA_CONSTANTS_H_ @@ -76,5 +74,3 @@ float st_2084_inverse_eotf(float x); } // namespace zimg::colorspace #endif // ZIMG_COLORSPACE_X86_GAMMA_CONSTANTS_H_ - -#endif // ZIMG_X86_AVX512 diff --git a/src/zimg/colorspace/x86/operation_impl_avx512.cpp b/src/zimg/colorspace/x86/operation_impl_avx512.cpp index 0b0248b5..0dac7d55 100644 --- a/src/zimg/colorspace/x86/operation_impl_avx512.cpp +++ b/src/zimg/colorspace/x86/operation_impl_avx512.cpp @@ -1,5 +1,3 @@ -#ifdef ZIMG_X86_AVX512 - #include #include #include "common/align.h" @@ -351,5 +349,3 @@ std::unique_ptr create_inverse_gamma_operation_avx512(const TransferF } } // namespace zimg::colorspace - -#endif // ZIMG_X86_AVX512 diff --git a/src/zimg/colorspace/x86/operation_impl_x86.cpp b/src/zimg/colorspace/x86/operation_impl_x86.cpp index b756e6d2..bd73b602 100644 --- a/src/zimg/colorspace/x86/operation_impl_x86.cpp +++ b/src/zimg/colorspace/x86/operation_impl_x86.cpp @@ -14,19 +14,15 @@ std::unique_ptr create_matrix_operation_x86(const Matrix3x3 &m, CPUCl std::unique_ptr ret; if (cpu_is_autodetect(cpu)) { -#ifdef ZIMG_X86_AVX512 if (!ret && cpu == CPUClass::AUTO_64B && caps.avx512f) ret = create_matrix_operation_avx512(m); -#endif if (!ret && caps.avx && !cpu_has_slow_avx(caps)) ret = create_matrix_operation_avx(m); if (!ret && caps.sse) ret = create_matrix_operation_sse(m); } else { -#ifdef ZIMG_X86_AVX512 if (!ret && cpu >= CPUClass::X86_AVX512) ret = create_matrix_operation_avx512(m); -#endif if (!ret && cpu >= CPUClass::X86_AVX) ret = create_matrix_operation_avx(m); if (!ret && cpu >= CPUClass::X86_SSE) @@ -42,19 +38,15 @@ std::unique_ptr create_gamma_operation_x86(const TransferFunction &tr std::unique_ptr ret; if (cpu_is_autodetect(cpu)) { -#ifdef ZIMG_X86_AVX512 if (!ret && cpu == CPUClass::AUTO_64B && caps.avx512f && caps.avx512bw && caps.avx512dq) ret = create_gamma_operation_avx512(transfer, params); -#endif if (!ret && caps.avx2 && !cpu_has_slow_gather(caps)) ret = create_gamma_operation_avx2(transfer, params); if (!ret && caps.sse2) ret = create_gamma_operation_sse2(transfer, params); } else { -#ifdef ZIMG_X86_AVX512 if (!ret && cpu >= CPUClass::X86_AVX512) ret = create_gamma_operation_avx512(transfer, params); -#endif if (!ret && cpu >= CPUClass::X86_AVX2) ret = create_gamma_operation_avx2(transfer, params); if (!ret && cpu >= CPUClass::X86_SSE2) @@ -70,19 +62,15 @@ std::unique_ptr create_inverse_gamma_operation_x86(const TransferFunc std::unique_ptr ret; if (cpu_is_autodetect(cpu)) { -#ifdef ZIMG_X86_AVX512 if (!ret && cpu == CPUClass::AUTO_64B && caps.avx512f && caps.avx512bw && caps.avx512dq) ret = create_inverse_gamma_operation_avx512(transfer, params); -#endif if (!ret && caps.avx2 && !cpu_has_slow_gather(caps)) ret = create_inverse_gamma_operation_avx2(transfer, params); if (!ret && caps.sse2) ret = create_inverse_gamma_operation_sse2(transfer, params); } else { -#ifdef ZIMG_X86_AVX512 if (!ret && cpu >= CPUClass::X86_AVX512) ret = create_inverse_gamma_operation_avx512(transfer, params); -#endif if (!ret && cpu >= CPUClass::X86_AVX2) ret = create_inverse_gamma_operation_avx2(transfer, params); if (!ret && cpu >= CPUClass::X86_SSE2) diff --git a/src/zimg/common/x86/avx512_util.h b/src/zimg/common/x86/avx512_util.h index c64f9a5b..6c328c3f 100644 --- a/src/zimg/common/x86/avx512_util.h +++ b/src/zimg/common/x86/avx512_util.h @@ -1,7 +1,5 @@ #pragma once -#ifdef ZIMG_X86_AVX512 - #ifndef ZIMG_X86_AVX512_UTIL_H_ #define ZIMG_X86_AVX512_UTIL_H_ @@ -178,5 +176,3 @@ static inline FORCE_INLINE void mm512_transpose32_epi16( } // namespace zimg #endif // ZIMG_X86_AVX512_UTIL_H_ - -#endif // ZIMG_X86_AVX512 diff --git a/src/zimg/depth/x86/depth_convert_avx512.cpp b/src/zimg/depth/x86/depth_convert_avx512.cpp index 4327fa6e..48b083fe 100644 --- a/src/zimg/depth/x86/depth_convert_avx512.cpp +++ b/src/zimg/depth/x86/depth_convert_avx512.cpp @@ -1,5 +1,3 @@ -#ifdef ZIMG_X86_AVX512 - #include #include #include "common/align.h" @@ -188,5 +186,3 @@ void depth_convert_w2f_avx512(const void *src, void *dst, float scale, float off } } // namespace zimg::depth - -#endif // ZIMG_X86_AVX512 diff --git a/src/zimg/depth/x86/depth_convert_x86.cpp b/src/zimg/depth/x86/depth_convert_x86.cpp index cc0ff795..dc7249c4 100644 --- a/src/zimg/depth/x86/depth_convert_x86.cpp +++ b/src/zimg/depth/x86/depth_convert_x86.cpp @@ -38,7 +38,6 @@ left_shift_func select_left_shift_func_avx2(PixelType pixel_in, PixelType pixel_ return nullptr; } -#ifdef ZIMG_X86_AVX512 left_shift_func select_left_shift_func_avx512(PixelType pixel_in, PixelType pixel_out) { if (pixel_in == PixelType::BYTE && pixel_out == PixelType::BYTE) @@ -52,7 +51,6 @@ left_shift_func select_left_shift_func_avx512(PixelType pixel_in, PixelType pixe else return nullptr; } -#endif depth_convert_func select_depth_convert_func_sse2(PixelType pixel_in, PixelType pixel_out) { @@ -81,7 +79,6 @@ depth_convert_func select_depth_convert_func_avx2(PixelType pixel_in, PixelType return nullptr; } -#ifdef ZIMG_X86_AVX512 depth_convert_func select_depth_convert_func_avx512(PixelType pixel_in, PixelType pixel_out) { if (pixel_in == PixelType::BYTE && pixel_out == PixelType::HALF) @@ -95,7 +92,6 @@ depth_convert_func select_depth_convert_func_avx512(PixelType pixel_in, PixelTyp else return nullptr; } -#endif // ZIMG_X86_AVX512 } // namespace @@ -106,19 +102,15 @@ left_shift_func select_left_shift_func_x86(PixelType pixel_in, PixelType pixel_o left_shift_func func = nullptr; if (cpu_is_autodetect(cpu)) { -#ifdef ZIMG_X86_AVX512 if (!func && cpu == CPUClass::AUTO_64B && caps.avx512f && caps.avx512bw && caps.avx512vl) func = select_left_shift_func_avx512(pixel_in, pixel_out); -#endif if (!func && caps.avx2) func = select_left_shift_func_avx2(pixel_in, pixel_out); if (!func && caps.sse2) func = select_left_shift_func_sse2(pixel_in, pixel_out); } else { -#ifdef ZIMG_X86_AVX512 if (!func && cpu >= CPUClass::X86_AVX512) func = select_left_shift_func_avx512(pixel_in, pixel_out); -#endif if (!func && cpu >= CPUClass::X86_AVX2) func = select_left_shift_func_avx2(pixel_in, pixel_out); if (!func && cpu >= CPUClass::X86_SSE2) @@ -134,19 +126,15 @@ depth_convert_func select_depth_convert_func_x86(const PixelFormat &pixel_in, co depth_convert_func func = nullptr; if (cpu_is_autodetect(cpu)) { -#ifdef ZIMG_X86_AVX512 if (!func && cpu == CPUClass::AUTO_64B && caps.avx512f && caps.avx512bw && caps.avx512vl) func = select_depth_convert_func_avx512(pixel_in.type, pixel_out.type); -#endif if (!func && caps.avx2 && caps.fma) func = select_depth_convert_func_avx2(pixel_in.type, pixel_out.type); if (!func && caps.sse2) func = select_depth_convert_func_sse2(pixel_in.type, pixel_out.type); } else { -#ifdef ZIMG_X86_AVX512 if (!func && cpu >= CPUClass::X86_AVX512) func = select_depth_convert_func_avx512(pixel_in.type, pixel_out.type); -#endif if (!func && cpu >= CPUClass::X86_AVX2) func = select_depth_convert_func_avx2(pixel_in.type, pixel_out.type); if (!func && cpu >= CPUClass::X86_SSE2) diff --git a/src/zimg/depth/x86/dither_avx512.cpp b/src/zimg/depth/x86/dither_avx512.cpp index e6956799..471be416 100644 --- a/src/zimg/depth/x86/dither_avx512.cpp +++ b/src/zimg/depth/x86/dither_avx512.cpp @@ -1,5 +1,3 @@ -#ifdef ZIMG_X86_AVX512 - #include #include #include "common/align.h" @@ -173,5 +171,3 @@ void ordered_dither_f2w_avx512(const float *dither, unsigned dither_offset, unsi } } // namespace zimg::depth - -#endif // ZIMG_X86_AVX512 diff --git a/src/zimg/depth/x86/dither_x86.cpp b/src/zimg/depth/x86/dither_x86.cpp index 92226d2c..4da40c88 100644 --- a/src/zimg/depth/x86/dither_x86.cpp +++ b/src/zimg/depth/x86/dither_x86.cpp @@ -54,7 +54,6 @@ dither_convert_func select_ordered_dither_func_avx2(PixelType pixel_in, PixelTyp return nullptr; } -#ifdef ZIMG_X86_AVX512 dither_convert_func select_ordered_dither_func_avx512(PixelType pixel_in, PixelType pixel_out) { if (pixel_in == PixelType::BYTE && pixel_out == PixelType::BYTE) @@ -76,7 +75,6 @@ dither_convert_func select_ordered_dither_func_avx512(PixelType pixel_in, PixelT else return nullptr; } -#endif } // namespace @@ -87,19 +85,15 @@ dither_convert_func select_ordered_dither_func_x86(const PixelFormat &pixel_in, dither_convert_func func = nullptr; if (cpu_is_autodetect(cpu)) { -#ifdef ZIMG_X86_AVX512 if (!func && cpu == CPUClass::AUTO_64B && caps.avx512f && caps.avx512bw && caps.avx512vl) func = select_ordered_dither_func_avx512(pixel_in.type, pixel_out.type); -#endif if (!func && caps.avx2 && caps.fma) func = select_ordered_dither_func_avx2(pixel_in.type, pixel_out.type); if (!func && caps.sse2) func = select_ordered_dither_func_sse2(pixel_in.type, pixel_out.type); } else { -#ifdef ZIMG_X86_AVX512 if (!func && cpu >= CPUClass::X86_AVX512) func = select_ordered_dither_func_avx512(pixel_in.type, pixel_out.type); -#endif if (!func && cpu >= CPUClass::X86_AVX2) func = select_ordered_dither_func_avx2(pixel_in.type, pixel_out.type); if (!func && cpu >= CPUClass::X86_SSE2) diff --git a/src/zimg/resize/x86/resize_impl_avx512.cpp b/src/zimg/resize/x86/resize_impl_avx512.cpp index 91a29ff5..8166859b 100644 --- a/src/zimg/resize/x86/resize_impl_avx512.cpp +++ b/src/zimg/resize/x86/resize_impl_avx512.cpp @@ -1,5 +1,3 @@ -#ifdef ZIMG_X86_AVX512 - #include #include #include @@ -703,5 +701,3 @@ std::unique_ptr create_resize_impl_v_avx512(const FilterCon } } // namespace zimg::resize - -#endif // ZIMG_X86_AVX512 diff --git a/src/zimg/resize/x86/resize_impl_avx512_vnni.cpp b/src/zimg/resize/x86/resize_impl_avx512_vnni.cpp index 8a9b34ac..8188a2f0 100644 --- a/src/zimg/resize/x86/resize_impl_avx512_vnni.cpp +++ b/src/zimg/resize/x86/resize_impl_avx512_vnni.cpp @@ -1,5 +1,3 @@ -#ifdef ZIMG_X86_AVX512 - #include #include #include "common/pixel.h" @@ -38,5 +36,3 @@ std::unique_ptr create_resize_impl_v_avx512_vnni(const Filt } } // namespace zimg::resize - -#endif // ZIMG_X86_AVX512 diff --git a/src/zimg/resize/x86/resize_impl_x86.cpp b/src/zimg/resize/x86/resize_impl_x86.cpp index ebf501f7..3716cb7e 100644 --- a/src/zimg/resize/x86/resize_impl_x86.cpp +++ b/src/zimg/resize/x86/resize_impl_x86.cpp @@ -13,14 +13,12 @@ std::unique_ptr create_resize_impl_h_x86(const FilterContex std::unique_ptr ret; if (cpu_is_autodetect(cpu)) { -#ifdef ZIMG_X86_AVX512 if (!ret && cpu == CPUClass::AUTO_64B) { if (!ret && cpu_has_avx512_f_dq_bw_vl(caps) && caps.avx512vnni) ret = create_resize_impl_h_avx512_vnni(context, height, type, depth); if (!ret && cpu_has_avx512_f_dq_bw_vl(caps)) ret = create_resize_impl_h_avx512(context, height, type, depth); } -#endif if (!ret && caps.avx2) ret = create_resize_impl_h_avx2(context, height, type, depth); if (!ret && caps.avx && !cpu_has_slow_avx(caps)) @@ -30,12 +28,10 @@ std::unique_ptr create_resize_impl_h_x86(const FilterContex if (!ret && caps.sse) ret = create_resize_impl_h_sse(context, height, type, depth); } else { -#ifdef ZIMG_X86_AVX512 if (!ret && cpu >= CPUClass::X86_AVX512_CLX) ret = create_resize_impl_h_avx512_vnni(context, height, type, depth); if (!ret && cpu >= CPUClass::X86_AVX512) ret = create_resize_impl_h_avx512(context, height, type, depth); -#endif if (!ret && cpu >= CPUClass::X86_AVX2) ret = create_resize_impl_h_avx2(context, height, type, depth); if (!ret && cpu >= CPUClass::X86_AVX) @@ -55,14 +51,12 @@ std::unique_ptr create_resize_impl_v_x86(const FilterContex std::unique_ptr ret; if (cpu_is_autodetect(cpu)) { -#ifdef ZIMG_X86_AVX512 if (!ret && cpu == CPUClass::AUTO_64B) { if (!ret && cpu_has_avx512_f_dq_bw_vl(caps) && caps.avx512vnni) ret = create_resize_impl_v_avx512_vnni(context, width, type, depth); if (!ret && cpu_has_avx512_f_dq_bw_vl(caps)) ret = create_resize_impl_v_avx512(context, width, type, depth); } -#endif if (!ret && caps.avx2) ret = create_resize_impl_v_avx2(context, width, type, depth); if (!ret && caps.avx && !cpu_has_slow_avx(caps)) @@ -72,12 +66,10 @@ std::unique_ptr create_resize_impl_v_x86(const FilterContex if (!ret && caps.sse) ret = create_resize_impl_v_sse(context, width, type, depth); } else { -#ifdef ZIMG_X86_AVX512 if (!ret && cpu >= CPUClass::X86_AVX512_CLX) ret = create_resize_impl_v_avx512_vnni(context, width, type, depth); if (!ret && cpu >= CPUClass::X86_AVX512) ret = create_resize_impl_v_avx512(context, width, type, depth); -#endif if (!ret && cpu >= CPUClass::X86_AVX2) ret = create_resize_impl_v_avx2(context, width, type, depth); if (!ret && cpu >= CPUClass::X86_AVX) diff --git a/test/colorspace/x86/colorspace_avx512_test.cpp b/test/colorspace/x86/colorspace_avx512_test.cpp index 696e6926..0deb716d 100644 --- a/test/colorspace/x86/colorspace_avx512_test.cpp +++ b/test/colorspace/x86/colorspace_avx512_test.cpp @@ -1,5 +1,3 @@ -#ifdef ZIMG_X86_AVX512 - #include #include "colorspace/colorspace.h" #include "common/cpuinfo.h" @@ -153,5 +151,3 @@ TEST(ColorspaceConversionAVX512Test, test_transfer_st_2084) { MatrixCoefficients::RGB, TransferCharacteristics::ST_2084, ColorPrimaries::UNSPECIFIED }, expected_sha1[1], expected_togamma_snr); } - -#endif // ZIMG_X86_AVX512 diff --git a/test/colorspace/x86/gamma_constants_avx512_test.cpp b/test/colorspace/x86/gamma_constants_avx512_test.cpp index 2a005d2f..f93bbcb1 100644 --- a/test/colorspace/x86/gamma_constants_avx512_test.cpp +++ b/test/colorspace/x86/gamma_constants_avx512_test.cpp @@ -1,5 +1,3 @@ -#ifdef ZIMG_X86_AVX512 - #include #include "colorspace/x86/gamma_constants_avx512.h" @@ -102,5 +100,3 @@ TEST(GammaConstantsAVX512Test, test_st_2084) SCOPED_TRACE("reverse"); test_linear_to_gamma(st_2084_inverse_eotf, avx512constants::st_2084_inverse_eotf, -31, 0, 1e-5f, 1e-7f); } - -#endif // ZIMG_X86_AVX512 diff --git a/test/depth/x86/depth_convert_avx512_test.cpp b/test/depth/x86/depth_convert_avx512_test.cpp index 6c293d17..15ed63f8 100644 --- a/test/depth/x86/depth_convert_avx512_test.cpp +++ b/test/depth/x86/depth_convert_avx512_test.cpp @@ -1,5 +1,3 @@ -#ifdef ZIMG_X86_AVX512 - #include #include "common/cpuinfo.h" #include "common/pixel.h" @@ -136,5 +134,3 @@ TEST(DepthConvertAVX512Test, test_depth_convert_w2f) test_case_depth_convert(pixel_in, pixel_out, expected_sha1, INFINITY); } - -#endif // ZIMG_X86_AVX512 diff --git a/test/depth/x86/dither_avx512_test.cpp b/test/depth/x86/dither_avx512_test.cpp index 58000dfa..5d92a62c 100644 --- a/test/depth/x86/dither_avx512_test.cpp +++ b/test/depth/x86/dither_avx512_test.cpp @@ -1,5 +1,3 @@ -#ifdef ZIMG_X86_AVX512 - #include #include "common/cpuinfo.h" #include "common/pixel.h" @@ -120,5 +118,3 @@ TEST(DitherAVX512Test, test_ordered_dither_f2w) // The use of FMA changes the rounding of the result at 16-bits. test_case(pixel_in, pixel_out, expected_sha1, 120.0); } - -#endif // ZIMG_X86_AVX512 diff --git a/test/resize/x86/resize_impl_avx512_test.cpp b/test/resize/x86/resize_impl_avx512_test.cpp index db5a86e9..0fe2a73d 100644 --- a/test/resize/x86/resize_impl_avx512_test.cpp +++ b/test/resize/x86/resize_impl_avx512_test.cpp @@ -1,5 +1,3 @@ -#ifdef ZIMG_X86_AVX512 - #include #include "common/cpuinfo.h" #include "common/pixel.h" @@ -219,5 +217,3 @@ TEST(ResizeImplAVX512Test, test_resize_v_f32) test_case(zimg::resize::LanczosFilter{ 4 }, false, w, src_h, w, dst_h, type, expected_sha1[2], expected_snr); test_case(zimg::resize::LanczosFilter{ 4 }, false, w, dst_h, w, src_h, type, expected_sha1[3], expected_snr); } - -#endif // ZIMG_X86_AVX512 diff --git a/test/resize/x86/resize_impl_avx512_vnni_test.cpp b/test/resize/x86/resize_impl_avx512_vnni_test.cpp index c4e24455..3b5d7604 100644 --- a/test/resize/x86/resize_impl_avx512_vnni_test.cpp +++ b/test/resize/x86/resize_impl_avx512_vnni_test.cpp @@ -1,5 +1,3 @@ -#ifdef ZIMG_X86_AVX512 - #include #include "common/cpuinfo.h" #include "common/pixel.h" @@ -130,5 +128,3 @@ TEST(ResizeImplAVX512VNNITest, test_resize_v_u16) test_case(zimg::resize::LanczosFilter{ 4 }, false, w, src_h, w, dst_h, format, expected_sha1[2], expected_snr); test_case(zimg::resize::LanczosFilter{ 4 }, false, w, dst_h, w, src_h, format, expected_sha1[3], expected_snr); } - -#endif // ZIMG_X86_AVX512