diff --git a/.gitignore b/.gitignore index 47176425..dd647ab8 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,25 @@ /doxygen_html /doxygen +# Autotools generated +.deps +.dirstamp +.libs +/Makefile +/Makefile.in +/aclocal.m4 +/autom4te.cache +/build-aux +/config.h +/config.h.in* +/config.status +/configure +/kvazaar +/libtool +/libkvazaar.la +/m4 +/stamp-h1 + # Other files *.exe *.o @@ -19,6 +38,7 @@ *.log .kdev4 +configure.scan src/kvazaar src/libkvazaar.a src/libkvazaar.so.* diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..014fef21 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,194 @@ +ACLOCAL_AMFLAGS = -I m4 + + +bin_PROGRAMS = kvazaar +lib_LTLIBRARIES = libkvazaar.la + + +dist_doc_DATA = COPYING CREDITS README.md + +EXTRA_DIST = \ + build \ + doc \ + docs.doxy \ + greatest \ + SConstruct \ + tests \ + tools \ + src/Makefile \ + src/SConscript \ + src/extras/getopt.c \ + src/extras/getopt.h + + +pkgconfigdir = $(libdir)/pkgconfig +nodist_pkgconfig_DATA = src/kvazaar.pc + + +include_HEADERS = \ + src/kvazaar.h \ + src/kvazaar_version.h + +noinst_HEADERS = \ + src/extras/x86inc.asm + + +kvazaar_SOURCES = \ + src/encmain.c \ + src/cli.h \ + src/cli.c \ + src/yuv_io.c \ + src/yuv_io.h +kvazaar_LDADD = libkvazaar.la $(LIBS) + + +libkvazaar_la_SOURCES = \ + src/bitstream.c \ + src/bitstream.h \ + src/cabac.c \ + src/cabac.h \ + src/checkpoint.c \ + src/checkpoint.h \ + src/config.c \ + src/config.h \ + src/context.c \ + src/context.h \ + src/cu.c \ + src/cu.h \ + src/encoder.c \ + src/encoder.h \ + src/encoderstate.c \ + src/encoderstate.h \ + src/encoder_state-bitstream.c \ + src/encoder_state-bitstream.h \ + src/encoder_state-ctors_dtors.c \ + src/encoder_state-ctors_dtors.h \ + src/encoder_state-geometry.c \ + src/encoder_state-geometry.h \ + src/filter.c \ + src/filter.h \ + src/global.h \ + src/image.c \ + src/image.h \ + src/imagelist.c \ + src/imagelist.h \ + src/input_frame_buffer.c \ + src/input_frame_buffer.h \ + src/inter.c \ + src/interface_main.c \ + src/inter.h \ + src/intra.c \ + src/intra.h \ + src/kvazaar.c \ + src/kvazaar_internal.h \ + src/nal.c \ + src/nal.h \ + src/rate_control.c \ + src/rate_control.h \ + src/rdo.c \ + src/rdo.h \ + src/sao.c \ + src/sao.h \ + src/scalinglist.c \ + src/scalinglist.h \ + src/search.c \ + src/search.h \ + src/search_inter.c \ + src/search_inter.h \ + src/search_intra.c \ + src/search_intra.h \ + src/tables.c \ + src/tables.h \ + src/threadqueue.c \ + src/threadqueue.h \ + src/threads.h \ + src/transform.c \ + src/transform.h \ + src/videoframe.c \ + src/videoframe.h \ + src/strategies/altivec/picture-altivec.c \ + src/strategies/altivec/picture-altivec.h \ + src/strategies/generic/dct-generic.c \ + src/strategies/generic/dct-generic.h \ + src/strategies/generic/intra-generic.c \ + src/strategies/generic/intra-generic.h \ + src/strategies/generic/ipol-generic.c \ + src/strategies/generic/ipol-generic.h \ + src/strategies/generic/nal-generic.c \ + src/strategies/generic/nal-generic.h \ + src/strategies/generic/picture-generic.c \ + src/strategies/generic/picture-generic.h \ + src/strategies/generic/quant-generic.c \ + src/strategies/generic/quant-generic.h \ + src/strategies/sse2/picture-sse2.c \ + src/strategies/sse2/picture-sse2.h \ + src/strategies/sse41/picture-sse41.c \ + src/strategies/sse41/picture-sse41.h \ + src/strategies/strategies-common.h \ + src/strategies/strategies-dct.c \ + src/strategies/strategies-dct.h \ + src/strategies/strategies-intra.c \ + src/strategies/strategies-intra.h \ + src/strategies/strategies-ipol.c \ + src/strategies/strategies-ipol.h \ + src/strategies/strategies-nal.c \ + src/strategies/strategies-nal.h \ + src/strategies/strategies-picture.c \ + src/strategies/strategies-picture.h \ + src/strategies/strategies-quant.c \ + src/strategies/strategies-quant.h \ + src/strategies/x86_asm/picture-x86-asm.c \ + src/strategies/x86_asm/picture-x86-asm.h \ + src/strategyselector.c \ + src/strategyselector.h + +avx2_sources = \ + src/strategies/avx2/dct-avx2.c \ + src/strategies/avx2/dct-avx2.h \ + src/strategies/avx2/intra-avx2.c \ + src/strategies/avx2/intra-avx2.h \ + src/strategies/avx2/ipol-avx2.c \ + src/strategies/avx2/ipol-avx2.h \ + src/strategies/avx2/picture-avx2.c \ + src/strategies/avx2/picture-avx2.h \ + src/strategies/avx2/quant-avx2.c \ + src/strategies/avx2/quant-avx2.h + +libkvazaar_la_SOURCES += $(avx2_sources) +libkvazaar_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined -version-number $(KVZ_API_VERSION) + + +if HAVE_PPC + +src/strategies/altivec/picture-altivec.lo: CFLAGS += -maltivec + +else #HAVE_PPC + +if HAVE_X86 +src/strategies/sse2/picture-sse2.lo: CFLAGS += -msse2 +src/strategies/sse41/picture-sse41.lo: CFLAGS += -msse4.1 +$(avx2_sources): CFLAGS += -mavx2 + +if ENABLE_ASM +libkvazaar_la_SOURCES += \ + src/strategies/x86_asm/picture-x86-asm-sad.asm \ + src/strategies/x86_asm/picture-x86-asm-sad.h \ + src/strategies/x86_asm/picture-x86-asm-satd.asm \ + src/strategies/x86_asm/picture-x86-asm-satd.h + +src/strategies/x86_asm/picture-x86-asm.lo: CFLAGS += -DKVZ_COMPILE_ASM +src/strategies/x86_asm/picture-x86-asm-sad.lo: src/strategies/x86_asm/picture-x86-asm-sad.asm +src/strategies/x86_asm/picture-x86-asm-satd.lo: src/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@) +yasm_verbose_0 = @echo " YASM " $@; + +.asm.lo: + $(yasm_verbose)$(LIBTOOL) --mode=compile $(YASM) $(ASFLAGS) $< -o $@ -prefer-non-pic 1>/dev/null + diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..11ba73f9 --- /dev/null +++ b/configure.ac @@ -0,0 +1,92 @@ + +AC_INIT([kvazaar], + m4_esyscmd([printf $(awk '/#define KVZ_VERSION/ { print $3 }' src/global.h)]), +) +AC_CONFIG_SRCDIR([src/encmain.c]) +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_AUX_DIR([build-aux]) + +AM_INIT_AUTOMAKE([-Wall -Werror dist-bzip2 dist-xz foreign subdir-objects]) +AM_SILENT_RULES([yes]) + +AC_PROG_CC +AM_PROG_AR + +LT_INIT([win32-dll]) + + +CFLAGS="-Wall -Wtype-limits -Wvla -I$srcdir/src -ftree-vectorize -fvisibility=hidden -std=gnu99 -DKVZ_DLL_EXPORTS $CFLAGS" +ASFLAGS="-I$srcdir/src/extras $ASFLAGS" +LIBS="-lm $LIBS" + + +# --disable-werror +AC_ARG_ENABLE([werror], [AS_HELP_STRING([--disable-werror], [don't treat warnings as errors [no]])], + [], [CFLAGS="-Werror $CFLAGS"] +) + + +# check for getopt +AC_CHECK_HEADER([getopt.h], [], [CFLAGS="$CFLAGS -I$srcdir/src/extras"]) + + +# host and cpu specific settings +AS_CASE([$host_cpu], + [i?86], [BITS="32" ASFLAGS="$ASFLAGS -DARCH_X86_64=0" X86="true"], + [x86_64], [BITS="64" ASFLAGS="$ASFLAGS -DARCH_X86_64=1 -m amd64" X86="true"], + [powerpc*], [PPC="true"], + [arm*], [ARM="true"] +) + +AS_CASE([$host_os], + [darwin*], [ + ASFLAGS="$ASFLAGS -f macho$BITS -DPREFIX" + ], + [cygwin*|msys*|mingw*], [ + CFLAGS="$CFLAGS -D__USE_MINGW_ANSI_STDIO=1" + AS_IF( + [test "x$BITS" = "x32"], [ + ASFLAGS="$ASFLAGS -fwin32 -DPREFIX -DHAVE_ALIGNED_STACK=0" + ], [ + ASFLAGS="$ASFLAGS -fwin64 -DHAVE_ALIGNED_STACK=1" + ] + ) + ], [ + ASFLAGS="$ASFLAGS -f elf$BITS" + CFLAGS="$CFLAGS -pthread" + LDFLAGS="$LDFLAGS -pthread -Wl,-z,noexecstack" + LIBS="$LIBS -lpthread" + ] +) + + +# YASM checks +AS_IF([test "x$X86" = "xtrue"], [ + AC_CHECK_TOOL([YASM], [yasm], [no]) +]) +AS_IF([test "x$YASM" != "xno"], [have_yasm="yes"]) + +AC_ARG_ENABLE([asm], [AS_HELP_STRING([--disable-asm], [disable assembly [no]])], + [], [enable_asm="yes"] +) +AS_IF([test "x$enable_asm" != "xno" -a $have_yasm != "yes"], + [enable_asm="no"] +) + + +AM_CONDITIONAL([HAVE_X86], [test "x$X86" = "xtrue"]) +AM_CONDITIONAL([HAVE_PPC], [test "x$PPC" = "xtrue"]) +AM_CONDITIONAL([HAVE_ARM], [test "x$ARM" = "xtrue"]) +AM_CONDITIONAL([ENABLE_ASM], [test "x$enable_asm" = "xyes" -a "x$have_yasm" = "xyes" ]) + +AC_ARG_VAR([ASFLAGS], [ASFLAGS to use for assembler]) +AC_SUBST([ASFLAGS]) + +KVZ_API_VERSION="$($AWK '/#define KVZ_API_VERSION/ { print $3 }' $srcdir/src/kvazaar_version.h)" +AC_SUBST([KVZ_API_VERSION]) + + +AC_CONFIG_FILES([Makefile src/kvazaar.pc]) +AC_OUTPUT +