Skip to content

Commit

Permalink
Fix compiling AVX2 strategies.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aryla committed Jan 20, 2016
1 parent 8060e2f commit d452709
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 28 deletions.
13 changes: 6 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,20 @@ Makefile.in
/stamp-h1

# Other files
*.a
*.d
*.dll
*.dylib
*.exe
*.o
*.la
*.lo
*.d
*.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
55 changes: 34 additions & 21 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

bin_PROGRAMS = kvazaar
lib_LTLIBRARIES = libkvazaar.la

Expand All @@ -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 \
Expand Down Expand Up @@ -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 \
Expand All @@ -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 \
Expand All @@ -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 \
Expand All @@ -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@)
Expand Down

0 comments on commit d452709

Please sign in to comment.