diff --git a/build/kvazaar_lib/kvazaar_lib.vcxproj b/build/kvazaar_lib/kvazaar_lib.vcxproj
index 03a3a194..2bbac907 100644
--- a/build/kvazaar_lib/kvazaar_lib.vcxproj
+++ b/build/kvazaar_lib/kvazaar_lib.vcxproj
@@ -192,6 +192,7 @@
+
diff --git a/build/kvazaar_lib/kvazaar_lib.vcxproj.filters b/build/kvazaar_lib/kvazaar_lib.vcxproj.filters
index 18383c9e..f0188f66 100644
--- a/build/kvazaar_lib/kvazaar_lib.vcxproj.filters
+++ b/build/kvazaar_lib/kvazaar_lib.vcxproj.filters
@@ -275,6 +275,9 @@
Header Files\strategies\x86_avx
+
+ Header Files\strategies\x86_avx
+
diff --git a/src/Makefile b/src/Makefile
index a7223597..dd50d198 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -27,9 +27,11 @@ LDFLAGS += -m$(TARGET_CPU_BITS)
ifneq ( ,$(findstring Windows, $(OS)))
ifeq ($(ARCH), x86_64)
ASMFLAGS += -f win64
+ ASMFLAGS += -DARCH_X86_64=1
else
ASMFLAGS += -f win32
ASMFLAGS += -DPREFIX
+ ASMFLAGS += -DARCH_X86_64=0
endif
DFLAGS += -D__USE_MINGW_ANSI_STDIO=1
# OS X specific flags
@@ -44,8 +46,10 @@ ASMFLAGS += -DPREFIX
else
ifeq ($(ARCH), x86_64)
ASMFLAGS += -f elf64
+ ASMFLAGS += -DARCH_X86_64=1
else
ASMFLAGS += -f elf32
+ ASMFLAGS += -DARCH_X86_64=0
endif
endif
@@ -56,8 +60,19 @@ CC = gcc
CCFLAGS = $(DFLAGS) -std=gnu99 -I. -I./strategies $(WARNINGS)
LDFLAGS += -lm
LD = gcc -pthread -lrt
-OBJS = interface_main.o encmain.o bitstream.o cabac.o checkpoint.o config.o context.o cu.o encoder.o encoderstate.o filter.o inter.o intra.o nal.o imagelist.o rdo.o sao.o scalinglist.o search.o strategyselector.o tables.o threadqueue.o transform.o encoder_state-bitstream.o encoder_state-ctors_dtors.o encoder_state-geometry.o image.o videoframe.o strategies/strategies-picture.o strategies/strategies-nal.o strategies/generic/nal-generic.o strategies/generic/picture-generic.o strategies/sse2/picture-sse2.o strategies/sse41/picture-sse41.o strategies/altivec/picture-altivec.o
-ASMOBJS = picture_x86.o
+OBJS = interface_main.o encmain.o bitstream.o cabac.o checkpoint.o config.o context.o cu.o encoder.o encoderstate.o filter.o inter.o intra.o nal.o imagelist.o rdo.o sao.o scalinglist.o search.o strategyselector.o tables.o threadqueue.o transform.o encoder_state-bitstream.o encoder_state-ctors_dtors.o encoder_state-geometry.o image.o videoframe.o strategies/strategies-picture.o strategies/strategies-nal.o strategies/generic/nal-generic.o strategies/generic/picture-generic.o strategies/sse2/picture-sse2.o strategies/sse41/picture-sse41.o strategies/x86_avx/picture-avx.o strategies/altivec/picture-altivec.o
+ASMOBJS =
+
+ifeq ($(TARGET_CPU_ARCH), x86)
+ ifneq ($(KVAZAAR_DISABLE_YASM), 1)
+ ASMOBJS += strategies/x86_avx/picture_x86.o
+ endif
+endif
+
+ifeq ($(KVAZAAR_DISABLE_YASM), 1)
+ DFLAGS += -DKVAZAAR_DISABLE_YASM
+endif
+
YASM = yasm
PROG = ./kvazaar
PROGS = $(PROG)
@@ -71,8 +86,11 @@ $(PROG): $(OBJS) $(ASMOBJS)
$(LD) $^ $(LDFLAGS) -o $@
%.o: %.asm Makefile
- $(YASM) $(ASMFLAGS) -o $@
-
+ $(YASM) $(ASMFLAGS) -o $@ $<
+
+%.d: %.asm Makefile
+ $(YASM) $(ASMFLAGS) -M -o $@ > $<
+
%.o: %.c Makefile
$(CC) $(CCFLAGS) -c $< -o $@
diff --git a/src/cabac.c b/src/cabac.c
index 265d7dc8..1d06f27e 100644
--- a/src/cabac.c
+++ b/src/cabac.c
@@ -27,7 +27,6 @@
#include
#include
#include
-#include
const uint8_t g_auc_next_state_mps[128] =
diff --git a/src/encoder.c b/src/encoder.c
index b798afab..5a4c2e1b 100644
--- a/src/encoder.c
+++ b/src/encoder.c
@@ -23,7 +23,6 @@
#include "encoder.h"
-#include
#include
#include
#include
diff --git a/src/imagelist.c b/src/imagelist.c
index 66605d50..4eab1add 100644
--- a/src/imagelist.c
+++ b/src/imagelist.c
@@ -28,7 +28,6 @@
#include
#include
#include
-#include
#include
diff --git a/src/strategies/strategies-picture.c b/src/strategies/strategies-picture.c
index 84d19230..8c13d321 100644
--- a/src/strategies/strategies-picture.c
+++ b/src/strategies/strategies-picture.c
@@ -22,7 +22,7 @@ cost_pixel_nxn_func * satd_8bit_64x64 = 0;
#include "sse2/picture-sse2.h"
#include "sse41/picture-sse41.h"
#include "altivec/picture-altivec.h"
-#include "x86_avx/picture-avx.c"
+#include "x86_avx/picture-avx.h"
int strategy_register_picture(void* opaque) {
@@ -32,13 +32,13 @@ int strategy_register_picture(void* opaque) {
if (g_hardware_flags.intel_flags.sse2) {
success &= strategy_register_picture_sse2(opaque);
- if (g_hardware_flags.intel_flags.avx) {
- success &= strategy_register_picture_avx(opaque);
- }
}
if (g_hardware_flags.intel_flags.sse41) {
success &= strategy_register_picture_sse41(opaque);
}
+ if (g_hardware_flags.intel_flags.avx) {
+ success &= strategy_register_picture_avx(opaque);
+ }
if (g_hardware_flags.powerpc_flags.altivec) {
success &= strategy_register_picture_altivec(opaque);
}
diff --git a/src/strategies/x86_avx/picture-avx.c b/src/strategies/x86_avx/picture-avx.c
index bfb92a57..abe52a21 100644
--- a/src/strategies/x86_avx/picture-avx.c
+++ b/src/strategies/x86_avx/picture-avx.c
@@ -20,7 +20,11 @@
/*
* \file
*/
-#include "../../strategyselector.h"
+#include
+#include "strategyselector.h"
+
+#if COMPILE_INTEL_AVX && !defined(KVAZAAR_DISABLE_YASM)
+
#include "picture_x86.h"
#ifdef __GNUC__
@@ -125,10 +129,11 @@ cost_pixel_nxn_func kvz_satd_8bit_16x16_avx;
cost_pixel_nxn_func kvz_satd_8bit_32x32_avx;
cost_pixel_nxn_func kvz_satd_8bit_64x64_avx;
+#endif //COMPILE_INTEL_AVX && !defined(KVAZAAR_DISABLE_YASM)
-static int strategy_register_picture_avx(void* opaque) {
+int strategy_register_picture_avx(void* opaque) {
bool success = true;
-
+#if COMPILE_INTEL_AVX && !defined(KVAZAAR_DISABLE_YASM)
success &= strategyselector_register(opaque, "reg_sad", "avx", 30, ®_sad_avx);
success &= strategyselector_register(opaque, "sad_8bit_4x4", "avx", 30, &kvz_sad_4x4_avx);
@@ -142,6 +147,6 @@ static int strategy_register_picture_avx(void* opaque) {
success &= strategyselector_register(opaque, "satd_8bit_16x16", "avx", 30, &kvz_satd_16x16_avx);
success &= strategyselector_register(opaque, "satd_8bit_32x32", "avx", 30, &kvz_satd_32x32_avx);
success &= strategyselector_register(opaque, "satd_8bit_64x64", "avx", 30, &kvz_satd_64x64_avx);
-
+#endif //COMPILE_INTEL_AVX && !defined(KVAZAAR_DISABLE_YASM)
return success;
}
diff --git a/src/strategies/x86_avx/picture-avx.h b/src/strategies/x86_avx/picture-avx.h
new file mode 100644
index 00000000..c8e48f2c
--- /dev/null
+++ b/src/strategies/x86_avx/picture-avx.h
@@ -0,0 +1,24 @@
+#ifndef STRATEGIES_PICTURE_X86_AVX_H_
+#define STRATEGIES_PICTURE_X86_AVX_H_
+/*****************************************************************************
+ * This file is part of Kvazaar HEVC encoder.
+ *
+ * Copyright (C) 2013-2014 Tampere University of Technology and others (see
+ * COPYING file).
+ *
+ * Kvazaar is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * Kvazaar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Kvazaar. If not, see .
+ ****************************************************************************/
+
+int strategy_register_picture_avx(void* opaque);
+
+#endif //STRATEGIES_PICTURE_X86_AVX_H_
diff --git a/src/transform.h b/src/transform.h
index 7ee30735..9d85e0eb 100644
--- a/src/transform.h
+++ b/src/transform.h
@@ -29,8 +29,6 @@
#include "encoder.h"
#include "encoderstate.h"
-#include
-
extern const uint8_t g_chroma_scale[58];
extern const int16_t g_inv_quant_scales[6];