From 7a1463472215e2903fb973de4d5168fcbddfeeb0 Mon Sep 17 00:00:00 2001 From: Jakub Bogusz Date: Sun, 17 Jan 2021 07:50:51 +0100 Subject: [PATCH] - added x32 patch (fix asm build with x32 ABI) - enable (runtime detected) avx512 code on archs supporting at least sse2 --- vmaf-x32.patch | 15 +++++++++++++++ vmaf.spec | 12 ++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 vmaf-x32.patch diff --git a/vmaf-x32.patch b/vmaf-x32.patch new file mode 100644 index 0000000..026ee0e --- /dev/null +++ b/vmaf-x32.patch @@ -0,0 +1,15 @@ +--- vmaf-2.1.0/libvmaf/src/meson.build.orig 2020-12-30 18:59:40.000000000 +0100 ++++ vmaf-2.1.0/libvmaf/src/meson.build 2021-01-17 07:46:41.998356401 +0100 +@@ -76,7 +76,11 @@ + nasm_format = 'elf' + endif + if host_machine.cpu_family() == 'x86_64' +- nasm_format += '64' ++ if cc.get_define('__ILP32__') == '1' ++ nasm_format += 'x32' ++ else ++ nasm_format += '64' ++ endif + else + nasm_format += '32' + endif diff --git a/vmaf.spec b/vmaf.spec index b98146d..1549691 100644 --- a/vmaf.spec +++ b/vmaf.spec @@ -22,11 +22,12 @@ Group: Libraries #Source0Download: https://github.com/Netflix/vmaf/releases Source0: https://github.com/Netflix/vmaf/archive/v%{version}/%{name}-%{version}.tar.gz # Source0-md5: a65e105a67008796d566e9cc38e8e0fe +Patch0: %{name}-x32.patch URL: https://github.com/Netflix/vmaf BuildRequires: libstdc++-devel >= 6:4.8 BuildRequires: meson >= 0.47.0 %ifarch %{ix86} %{x8664} x32 -BuildRequires: nasm +BuildRequires: nasm >= 2.14 %endif BuildRequires: ninja >= 1.7.1 BuildRequires: python3 >= 1:3.6 @@ -83,6 +84,7 @@ Statyczna biblioteka Netflix VMAF. %prep %setup -q +%patch0 -p1 %{__mv} libvmaf/README.md libvmaf/README.libvmaf.md @@ -92,10 +94,16 @@ Statyczna biblioteka Netflix VMAF. %build %if %{with sse2} +# SSE2 requires global support CFLAGS="%{rpmcflags} -msse2" CXXFLAGS="%{rpmcxxflags} -msse2" %endif -%meson build-libvmaf libvmaf + +# AVX512 is (properly) runtime detected (but SSE2 is probably prerequisite) +%meson build-libvmaf libvmaf \ +%if %{with sse2} + -Denable_avx512=true +%endif %ninja_build -C build-libvmaf -- 2.44.0