From bd90f8e5d7bb1d323ec35d8326915ded41cce587 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Sat, 7 Apr 2018 13:44:42 +0200 Subject: [PATCH 03/11] Drop AVX when not relevant --- feature/Makefile | 9 +++++++++ wrapper/Makefile | 17 ++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/feature/Makefile b/feature/Makefile index 111d07c..c786a27 100644 --- a/feature/Makefile +++ b/feature/Makefile @@ -10,13 +10,22 @@ LIBVMAF = $(TOP)/../wrapper/libvmaf.a CFLAGS_COMMON = -g -O3 -fPIC -w -Wextra -pedantic # CFLAGS_COMMON = -g -O0 -fPIC -Wall -Wextra -pedantic +UNAME := $(shell uname -m) CFLAGS := -std=c99 $(CFLAGS_COMMON) $(CFLAGS) CXXFLAGS := -std=c++11 $(CFLAGS_COMMON) $(CXXFLAGS) CPPFLAGS := $(CPPFLAGS) LIBS := $(LIBS) -lm LDFLAGS := $(LDFLAGS) +ifeq ($(UNAME), x86_64) + USE_AVX = 1 +endif +ifeq ($(UNAME), i386) + USE_AVX = 1 +endif +ifeq ($(USE_AVX), 1) $(AVX_OBJS): EXTRA_CFLAGS := -mavx +endif $(OBJDIR)/vmaf_main.o: $(SRCDIR)/vmaf_main.c $(CC) $(EXTRA_CFLAGS) -c -o $@ $(CFLAGS) $(CPPFLAGS) $< diff --git a/wrapper/Makefile b/wrapper/Makefile index 985a30f..62bde27 100644 --- a/wrapper/Makefile +++ b/wrapper/Makefile @@ -3,6 +3,7 @@ LIBVMAF = libvmaf.a .PHONY: all all: $(LIBVMAF) vmafossexec +UNAME := $(shell uname -m) TOP = $(shell pwd) SRCDIR = $(TOP)/src OBJDIR = $(TOP)/obj @@ -11,6 +12,18 @@ PTOOLSDIR = $(TOP)/../ptools PREFIX ?= /usr/local LIBDIR ?= $(PREFIX)/lib +ifeq ($(UNAME), x86_64) + USE_AVX = 1 +endif +ifeq ($(UNAME), i386) + USE_AVX = 1 +endif +ifeq ($(USE_AVX), 1) +AVX_OBJS := \ + $(OBJDIR)/convolution_avx.o \ + +endif + OBJS = \ $(OBJDIR)/alloc.o \ $(OBJDIR)/alignment.o \ @@ -44,11 +57,9 @@ OBJS = \ $(OBJDIR)/libvmaf.o \ $(OBJDIR)/blur_array.o \ $(OBJDIR)/cpu_info.o \ + $(AVX_OBJS) \ $(NULL) -AVX_OBJS := \ - $(OBJDIR)/convolution_avx.o \ - CFLAGS_COMMON = -g -O3 -fPIC -w -Wextra -pedantic -D MULTI_THREADING # CFLAGS_COMMON = -g -O3 -fPIC -w -Wextra -pedantic -D MULTI_THREADING -D PRINT_PROGRESS # CFLAGS_COMMON = -g -O3 -fPIC -w -Wextra -pedantic -- 2.17.1