From d4527097952b7af77af4f5902ee8cf18e277b75e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arttu=20Yl=C3=A4-Outinen?= Date: Wed, 20 Jan 2016 10:59:15 +0200 Subject: [PATCH] Fix compiling AVX2 strategies. Option -mavx2 was omitted when compiling AVX2 strategies. This commit moves strategies to convenience libraries so that their compilation flags can be easily set and adds -mavx2 to CFLAGS of the AVX2 library. --- .gitignore | 15 +++++++------- src/Makefile.am | 55 ++++++++++++++++++++++++++++++------------------- 2 files changed, 41 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index 2a4ceabf..86e51b8f 100644 --- a/.gitignore +++ b/.gitignore @@ -33,21 +33,20 @@ Makefile.in /stamp-h1 # Other files -*.exe -*.o -*.lo +*.a *.d +*.dll +*.dylib +*.exe +*.la +*.lo +*.o *.log .kdev4 configure.scan src/kvazaar -src/libkvazaar.a -src/libkvazaar.la src/libkvazaar.so.* -src/kvazaar.dll -src/libkvazaar.dll.a -src/libkvazaar.*.dylib src/kvazaar.pc tests/kvazaar_tests tests/kvazaar_tests.trs diff --git a/src/Makefile.am b/src/Makefile.am index ab2a6ec4..a91b679e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,3 @@ - bin_PROGRAMS = kvazaar lib_LTLIBRARIES = libkvazaar.la @@ -18,6 +17,11 @@ include_HEADERS = \ noinst_HEADERS = \ extras/x86inc.asm +noinst_LTLIBRARIES = \ + libaltivec.la \ + libavx2.la \ + libsse2.la \ + libsse41.la kvazaar_SOURCES = \ encmain.c \ @@ -91,8 +95,6 @@ libkvazaar_la_SOURCES = \ transform.h \ videoframe.c \ videoframe.h \ - strategies/altivec/picture-altivec.c \ - strategies/altivec/picture-altivec.h \ strategies/generic/dct-generic.c \ strategies/generic/dct-generic.h \ strategies/generic/intra-generic.c \ @@ -105,10 +107,6 @@ libkvazaar_la_SOURCES = \ strategies/generic/picture-generic.h \ strategies/generic/quant-generic.c \ strategies/generic/quant-generic.h \ - strategies/sse2/picture-sse2.c \ - strategies/sse2/picture-sse2.h \ - strategies/sse41/picture-sse41.c \ - strategies/sse41/picture-sse41.h \ strategies/strategies-common.h \ strategies/strategies-dct.c \ strategies/strategies-dct.h \ @@ -127,7 +125,20 @@ libkvazaar_la_SOURCES = \ strategyselector.c \ strategyselector.h -avx2_sources = \ +libkvazaar_la_LIBADD = \ + libaltivec.la \ + libavx2.la \ + libsse2.la \ + libsse41.la + +libkvazaar_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined -version-number $(KVZ_API_VERSION) + + +libaltivec_la_SOURCES = \ + strategies/altivec/picture-altivec.c \ + strategies/altivec/picture-altivec.h + +libavx2_la_SOURCES = \ strategies/avx2/dct-avx2.c \ strategies/avx2/dct-avx2.h \ strategies/avx2/intra-avx2.c \ @@ -139,36 +150,38 @@ avx2_sources = \ strategies/avx2/quant-avx2.c \ strategies/avx2/quant-avx2.h -libkvazaar_la_SOURCES += $(avx2_sources) -libkvazaar_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined -version-number $(KVZ_API_VERSION) +libsse2_la_SOURCES = \ + strategies/sse2/picture-sse2.c \ + strategies/sse2/picture-sse2.h +libsse41_la_SOURCES = \ + strategies/sse41/picture-sse41.c \ + strategies/sse41/picture-sse41.h if HAVE_PPC - -strategies/altivec/picture-altivec.lo: CFLAGS += -maltivec - -else #HAVE_PPC +libaltivec_la_CFLAGS = -maltivec +endif if HAVE_X86 -strategies/sse2/picture-sse2.lo: CFLAGS += -msse2 -strategies/sse41/picture-sse41.lo: CFLAGS += -msse4.1 -$(avx2_sources): CFLAGS += -mavx2 +libavx2_la_CFLAGS = -mavx2 +libsse2_la_CFLAGS = -msse2 +libsse41_la_CFLAGS = -msse4.1 if ENABLE_ASM -libkvazaar_la_SOURCES += \ +noinst_LTLIBRARIES += libasm.la +libkvazaar_la_LIBADD += libasm.la +libasm_la_SOURCES = \ strategies/x86_asm/picture-x86-asm-sad.asm \ strategies/x86_asm/picture-x86-asm-sad.h \ strategies/x86_asm/picture-x86-asm-satd.asm \ strategies/x86_asm/picture-x86-asm-satd.h +libasm_la_CFLAGS = -DKVZ_COMPILE_ASM -strategies/x86_asm/picture-x86-asm.lo: CFLAGS += -DKVZ_COMPILE_ASM strategies/x86_asm/picture-x86-asm-sad.lo: strategies/x86_asm/picture-x86-asm-sad.asm strategies/x86_asm/picture-x86-asm-satd.lo: strategies/x86_asm/picture-x86-asm-satd.asm endif #ENABLE_ASM endif #HAVE_X86 -endif #HAVE_PPC - yasm_verbose = $(yasm_verbose_@AM_V@) yasm_verbose_ = $(yasm_verbose_@AM_DEFAULT_V@)