From a8dd55117ec885b06434e54a2475bf02e449fc37 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Mon, 30 Nov 2020 00:28:17 +0000 Subject: multimedia/svt-av1: update to 0.8.6 Rebuild consumers after `EbSvtAv1EncConfiguration` grew in size with `recode_loop` added in the middle of the struct. Changes: https://github.com/AOMediaCodec/SVT-AV1/releases/tag/v0.8.6 Reported by: GitHub (watch releases) --- multimedia/svt-av1/Makefile | 2 +- multimedia/svt-av1/distinfo | 6 +- multimedia/svt-av1/files/patch-revert | 227 ++++++++++++++++++++++++++++++++++ multimedia/svt-av1/pkg-plist | 4 +- 4 files changed, 233 insertions(+), 6 deletions(-) create mode 100644 multimedia/svt-av1/files/patch-revert (limited to 'multimedia/svt-av1') diff --git a/multimedia/svt-av1/Makefile b/multimedia/svt-av1/Makefile index 0e7dafcfc84d..bb523b5a534d 100644 --- a/multimedia/svt-av1/Makefile +++ b/multimedia/svt-av1/Makefile @@ -2,7 +2,7 @@ PORTNAME= svt-av1 DISTVERSIONPREFIX= v -DISTVERSION= 0.8.5 +DISTVERSION= 0.8.6 CATEGORIES= multimedia MAINTAINER= jbeich@FreeBSD.org diff --git a/multimedia/svt-av1/distinfo b/multimedia/svt-av1/distinfo index 5710f98ed5d9..c90be40a8548 100644 --- a/multimedia/svt-av1/distinfo +++ b/multimedia/svt-av1/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1599462575 -SHA256 (AOMediaCodec-SVT-AV1-v0.8.5_GH0.tar.gz) = 8ce94359ea9450745c17c12d4cc054d45f6b2498e63e2ebaa5a5273bb36f6f95 -SIZE (AOMediaCodec-SVT-AV1-v0.8.5_GH0.tar.gz) = 6319601 +TIMESTAMP = 1606633856 +SHA256 (AOMediaCodec-SVT-AV1-v0.8.6_GH0.tar.gz) = 951ffc240ceecd94c6cd94e53c81217c4333219a868cbf477a9eedaf0ed1c388 +SIZE (AOMediaCodec-SVT-AV1-v0.8.6_GH0.tar.gz) = 6416120 diff --git a/multimedia/svt-av1/files/patch-revert b/multimedia/svt-av1/files/patch-revert new file mode 100644 index 000000000000..48c6da4a92a2 --- /dev/null +++ b/multimedia/svt-av1/files/patch-revert @@ -0,0 +1,227 @@ +Revert https://github.com/AOMediaCodec/SVT-AV1/commit/fedc119668a4 +due to https://github.com/AOMediaCodec/SVT-AV1/issues/1613 + +--- CMakeLists.txt.orig 2020-11-29 07:10:56 UTC ++++ CMakeLists.txt +@@ -276,6 +276,5 @@ if(BUILD_TESTING) + endif() + + add_subdirectory(third_party/fastfeat) +-add_subdirectory(third_party/cpuinfo) + + install(DIRECTORY ${PROJECT_SOURCE_DIR}/Source/API/ DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}/svt-av1" FILES_MATCHING PATTERN "*.h") +--- Source/Lib/Common/Codec/CMakeLists.txt.orig 2020-11-29 07:10:56 UTC ++++ Source/Lib/Common/Codec/CMakeLists.txt +@@ -32,16 +32,14 @@ include_directories(${PROJECT_SOURCE_DIR}/Source/API/ + ${PROJECT_SOURCE_DIR}/Source/Lib/Common/ASM_AVX2/ + ${PROJECT_SOURCE_DIR}/Source/Lib/Common/ASM_AVX512/ + ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/Codec/ +- ${PROJECT_SOURCE_DIR}/third_party/fastfeat/ +- ${PROJECT_SOURCE_DIR}/third_party/cpuinfo/include/) ++ ${PROJECT_SOURCE_DIR}/third_party/fastfeat/) + else () + # Include Encoder Subdirectories + include_directories(${PROJECT_SOURCE_DIR}/Source/API/ + ${PROJECT_SOURCE_DIR}/Source/Lib/Common/Codec/ + ${PROJECT_SOURCE_DIR}/Source/Lib/Common/C_DEFAULT/ + ${PROJECT_SOURCE_DIR}/Source/Lib/Encoder/Codec/ +- ${PROJECT_SOURCE_DIR}/third_party/fastfeat/ +- ${PROJECT_SOURCE_DIR}/third_party/cpuinfo/include/) ++ ${PROJECT_SOURCE_DIR}/third_party/fastfeat/) + endif () + file(GLOB all_files + "*.h" +--- Source/Lib/Common/Codec/common_dsp_rtcd.c.orig 2020-11-29 07:10:56 UTC ++++ Source/Lib/Common/Codec/common_dsp_rtcd.c +@@ -17,9 +17,6 @@ + #include "EbPackUnPack_C.h" + #include "EbAvcStyleMcp.h" + +-// for get_cpu_flags +-#include "cpuinfo.h" +- + /* + * DSP deprecated flags + */ +@@ -69,31 +66,121 @@ int64_t svt_av1_block_error_c(const TranLow *coeff, co + /************************************** + * Instruction Set Support + **************************************/ ++#ifdef ARCH_X86_64 ++// Helper Functions ++static INLINE void run_cpuid(int eax, int ecx, int* abcd) { ++#ifdef _WIN32 ++ __cpuidex(abcd, eax, ecx); ++#else ++ int ebx = 0, edx = 0; ++#if defined(__i386__) && defined(__PIC__) ++ /* in case of PIC under 32-bit EBX cannot be clobbered */ ++ __asm__("movl %%ebx, %%edi \n\t cpuid \n\t xchgl %%ebx, %%edi" ++ : "=D"(ebx), ++#else ++ __asm__("cpuid" ++ : "+b"(ebx), ++#endif ++ "+a"(eax), ++ "+c"(ecx), ++ "=d"(edx)); ++ abcd[0] = eax; ++ abcd[1] = ebx; ++ abcd[2] = ecx; ++ abcd[3] = edx; ++#endif ++} + ++static INLINE int32_t check_xcr0_ymm() { ++ uint32_t xcr0; ++#ifdef _WIN32 ++ xcr0 = (uint32_t)_xgetbv(0); /* min VS2010 SP1 compiler is required */ ++#else ++ __asm__("xgetbv" : "=a"(xcr0) : "c"(0) : "%edx"); ++#endif ++ return ((xcr0 & 6) == 6); /* checking if xmm and ymm state are enabled in XCR0 */ ++} ++ ++static int32_t check_4thgen_intel_core_features() { ++ int abcd[4]; ++ const int fma_movbe_osxsave_mask = ((1 << 12) | (1 << 22) | (1 << 27)); ++ const int avx2_bmi12_mask = (1 << 5) | (1 << 3) | (1 << 8); ++ ++ /* CPUID.(EAX=01H, ECX=0H):ECX.FMA[bit 12]==1 && ++ CPUID.(EAX=01H, ECX=0H):ECX.MOVBE[bit 22]==1 && ++ CPUID.(EAX=01H, ECX=0H):ECX.OSXSAVE[bit 27]==1 */ ++ run_cpuid(1, 0, abcd); ++ if ((abcd[2] & fma_movbe_osxsave_mask) != fma_movbe_osxsave_mask) return 0; ++ ++ if (!check_xcr0_ymm()) return 0; ++ ++ /* CPUID.(EAX=07H, ECX=0H):EBX.AVX2[bit 5]==1 && ++ CPUID.(EAX=07H, ECX=0H):EBX.BMI1[bit 3]==1 && ++ CPUID.(EAX=07H, ECX=0H):EBX.BMI2[bit 8]==1 */ ++ run_cpuid(7, 0, abcd); ++ if ((abcd[1] & avx2_bmi12_mask) != avx2_bmi12_mask) return 0; ++ /* CPUID.(EAX=80000001H):ECX.LZCNT[bit 5]==1 */ ++ run_cpuid(0x80000001, 0, abcd); ++ if ((abcd[2] & (1 << 5)) == 0) return 0; ++ return 1; ++} ++ ++static INLINE int check_xcr0_zmm() { ++ uint32_t xcr0; ++ uint32_t zmm_ymm_xmm = (7 << 5) | (1 << 2) | (1 << 1); ++#ifdef _WIN32 ++ xcr0 = (uint32_t)_xgetbv(0); /* min VS2010 SP1 compiler is required */ ++#else ++ __asm__("xgetbv" : "=a"(xcr0) : "c"(0) : "%edx"); ++#endif ++ return ((xcr0 & zmm_ymm_xmm) == ++ zmm_ymm_xmm); /* check if xmm, ymm and zmm state are enabled in XCR0 */ ++} ++ ++static int32_t can_use_intel_avx512() { ++ int abcd[4]; ++ ++ /* CPUID.(EAX=07H, ECX=0):EBX[bit 16]==1 AVX512F ++ CPUID.(EAX=07H, ECX=0):EBX[bit 17] AVX512DQ ++ CPUID.(EAX=07H, ECX=0):EBX[bit 28] AVX512CD ++ CPUID.(EAX=07H, ECX=0):EBX[bit 30] AVX512BW ++ CPUID.(EAX=07H, ECX=0):EBX[bit 31] AVX512VL */ ++ ++ const int avx512_ebx_mask = (1u << 16) // AVX-512F ++ | (1u << 17) // AVX-512DQ ++ | (1u << 28) // AVX-512CD ++ | (1u << 30) // AVX-512BW ++ | (1u << 31); // AVX-512VL ++ ++ if (!check_4thgen_intel_core_features()) return 0; ++ ++ // ensure OS supports ZMM registers (and YMM, and XMM) ++ if (!check_xcr0_zmm()) return 0; ++ ++ run_cpuid(7, 0, abcd); ++ if ((abcd[1] & avx512_ebx_mask) != avx512_ebx_mask) return 0; ++ ++ return 1; ++} ++ + CPU_FLAGS get_cpu_flags() { + CPU_FLAGS flags = 0; + +- // safe to call multiple times, and threadsafe +- // also correctly checks whether the OS saves AVX(2|512) registers +- cpuinfo_initialize(); ++ /* To detail tests CPU features, requires more accurate implementation. ++ Documentation help: ++ https://docs.microsoft.com/en-us/cpp/intrinsics/cpuid-cpuidex?redirectedfrom=MSDN&view=vs-2019 ++ */ + +- flags |= cpuinfo_has_x86_mmx() ? CPU_FLAGS_MMX : 0; +- flags |= cpuinfo_has_x86_sse() ? CPU_FLAGS_SSE : 0; +- flags |= cpuinfo_has_x86_sse2() ? CPU_FLAGS_SSE2 : 0; +- flags |= cpuinfo_has_x86_sse3() ? CPU_FLAGS_SSE3 : 0; +- flags |= cpuinfo_has_x86_ssse3() ? CPU_FLAGS_SSSE3 : 0; +- flags |= cpuinfo_has_x86_sse4_1() ? CPU_FLAGS_SSE4_1 : 0; +- flags |= cpuinfo_has_x86_sse4_2() ? CPU_FLAGS_SSE4_2 : 0; ++ if (check_4thgen_intel_core_features()) { ++ flags |= CPU_FLAGS_MMX | CPU_FLAGS_SSE | CPU_FLAGS_SSE2 | CPU_FLAGS_SSE3 | CPU_FLAGS_SSSE3 | ++ CPU_FLAGS_SSE4_1 | CPU_FLAGS_SSE4_2 | CPU_FLAGS_AVX | CPU_FLAGS_AVX2; ++ } + +- flags |= cpuinfo_has_x86_avx() ? CPU_FLAGS_AVX : 0; +- flags |= cpuinfo_has_x86_avx2() ? CPU_FLAGS_AVX2 : 0; ++ if (can_use_intel_avx512()) { ++ flags |= CPU_FLAGS_AVX512F | CPU_FLAGS_AVX512DQ | CPU_FLAGS_AVX512CD | CPU_FLAGS_AVX512BW | ++ CPU_FLAGS_AVX512VL; ++ } + +- flags |= cpuinfo_has_x86_avx512f() ? CPU_FLAGS_AVX512F : 0; +- flags |= cpuinfo_has_x86_avx512dq() ? CPU_FLAGS_AVX512DQ : 0; +- flags |= cpuinfo_has_x86_avx512cd() ? CPU_FLAGS_AVX512CD : 0; +- flags |= cpuinfo_has_x86_avx512bw() ? CPU_FLAGS_AVX512BW : 0; +- flags |= cpuinfo_has_x86_avx512vl() ? CPU_FLAGS_AVX512VL : 0; +- + return flags; + } + +@@ -105,6 +192,7 @@ CPU_FLAGS get_cpu_flags_to_use() { + #endif + return flags; + } ++#endif + + #ifdef ARCH_X86_64 + #ifndef NON_AVX512_SUPPORT +--- Source/Lib/Decoder/CMakeLists.txt.orig 2020-11-29 07:10:56 UTC ++++ Source/Lib/Decoder/CMakeLists.txt +@@ -98,8 +98,7 @@ endif() + set_target_properties(SvtAv1Dec PROPERTIES VERSION ${DEC_VERSION}) + set_target_properties(SvtAv1Dec PROPERTIES SOVERSION ${DEC_VERSION_MAJOR}) + add_dependencies(SvtAv1Dec EbVersionHeaderGen) +-target_link_libraries(SvtAv1Dec PUBLIC ${PLATFORM_LIBS}) +-target_link_libraries(SvtAv1Dec PRIVATE cpuinfo_public) ++target_link_libraries(SvtAv1Dec ${PLATFORM_LIBS}) + install(TARGETS SvtAv1Dec DESTINATION "${CMAKE_INSTALL_LIBDIR}") + + configure_file(pkg-config.pc.in ${CMAKE_BINARY_DIR}/SvtAv1Dec.pc @ONLY) +--- Source/Lib/Encoder/CMakeLists.txt.orig 2020-11-29 07:10:56 UTC ++++ Source/Lib/Encoder/CMakeLists.txt +@@ -129,8 +129,7 @@ endif() + + set_target_properties(SvtAv1Enc PROPERTIES VERSION ${ENC_VERSION}) + set_target_properties(SvtAv1Enc PROPERTIES SOVERSION ${ENC_VERSION_MAJOR}) +-target_link_libraries(SvtAv1Enc PUBLIC ${PLATFORM_LIBS}) +-target_link_libraries(SvtAv1Enc PRIVATE cpuinfo_public) ++target_link_libraries(SvtAv1Enc ${PLATFORM_LIBS}) + install(TARGETS SvtAv1Enc DESTINATION "${CMAKE_INSTALL_LIBDIR}") + + configure_file(pkg-config.pc.in ${CMAKE_BINARY_DIR}/SvtAv1Enc.pc @ONLY) +--- test/CMakeLists.txt.orig 2020-11-29 07:10:56 UTC ++++ test/CMakeLists.txt +@@ -86,7 +86,6 @@ set(lib_list + $ + $ + $ +- cpuinfo_public + gtest_all) + if(UNIX) + # App Source Files diff --git a/multimedia/svt-av1/pkg-plist b/multimedia/svt-av1/pkg-plist index e619870e22dc..fe2a46c15562 100644 --- a/multimedia/svt-av1/pkg-plist +++ b/multimedia/svt-av1/pkg-plist @@ -9,9 +9,9 @@ include/svt-av1/EbSvtAv1ExtFrameBuf.h include/svt-av1/EbSvtAv1Formats.h lib/libSvtAv1Dec.so lib/libSvtAv1Dec.so.0 -lib/libSvtAv1Dec.so.0.8.5 +lib/libSvtAv1Dec.so.0.8.6 lib/libSvtAv1Enc.so lib/libSvtAv1Enc.so.0 -lib/libSvtAv1Enc.so.0.8.5 +lib/libSvtAv1Enc.so.0.8.6 libdata/pkgconfig/SvtAv1Dec.pc libdata/pkgconfig/SvtAv1Enc.pc -- cgit v1.2.3