Preparing push to master and misc

-Removed unnecessary <math.h> headers
-Updated AVX/asm optimizations to match the new file hierarchy
-Makefile only compiles .asm files if KVAZAAR_DISABLE_YASM is not set to 1 and TARGET_CPU_ARCH is x86
This commit is contained in:
Ari Lemmetti 2014-07-21 10:54:33 +03:00
parent 1e94262f85
commit 1be2c3aae5
10 changed files with 63 additions and 17 deletions

View file

@ -192,6 +192,7 @@
<ClInclude Include="..\..\src\strategies\sse41\picture-sse41.h" />
<ClInclude Include="..\..\src\strategies\strategies-nal.h" />
<ClInclude Include="..\..\src\strategies\strategies-picture.h" />
<ClInclude Include="..\..\src\strategies\x86_avx\picture-avx.h" />
<ClInclude Include="..\..\src\strategies\x86_avx\picture_x86.h" />
<ClInclude Include="..\..\src\strategyselector.h" />
<ClInclude Include="..\..\src\tables.h" />

View file

@ -275,6 +275,9 @@
<ClInclude Include="..\..\src\strategies\x86_avx\picture_x86.h">
<Filter>Header Files\strategies\x86_avx</Filter>
</ClInclude>
<ClInclude Include="..\..\src\strategies\x86_avx\picture-avx.h">
<Filter>Header Files\strategies\x86_avx</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<YASM Include="..\..\src\strategies\x86_avx\picture_x86.asm">

View file

@ -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 $@

View file

@ -27,7 +27,6 @@
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
const uint8_t g_auc_next_state_mps[128] =

View file

@ -23,7 +23,6 @@
#include "encoder.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View file

@ -28,7 +28,6 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>

View file

@ -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);
}

View file

@ -20,7 +20,11 @@
/*
* \file
*/
#include "../../strategyselector.h"
#include <stdlib.h>
#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, &reg_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;
}

View file

@ -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 <http://www.gnu.org/licenses/>.
****************************************************************************/
int strategy_register_picture_avx(void* opaque);
#endif //STRATEGIES_PICTURE_X86_AVX_H_

View file

@ -29,8 +29,6 @@
#include "encoder.h"
#include "encoderstate.h"
#include <math.h>
extern const uint8_t g_chroma_scale[58];
extern const int16_t g_inv_quant_scales[6];