Merge commit '792a5a5dd1946a327f22b2daba05c6645dfa8037'

This commit is contained in:
Marko Viitanen 2014-05-30 08:47:01 +03:00
commit 6a72f87028
5 changed files with 44 additions and 19 deletions

View file

@ -9,15 +9,20 @@ DFLAGS = -O2 -g -Werror -march=native
# ARCH related flags # ARCH related flags
ifeq ($(ARCH), x86_64) ifeq ($(ARCH), x86_64)
ASMFLAGS += -DARCH_X86_64=1 TARGET_CPU_BITS := 64
DFLAGS += -m64 TARGET_CPU_ARCH := x86
LDFLAGS += -m64 else ifeq ($(ARCH), ppc64)
TARGET_CPU_BITS := 64
TARGET_CPU_ARCH := ppc
else else
ASMFLAGS += -DARCH_X86_64=0 #safe (?) defaults
DFLAGS += -m32 TARGET_CPU_BITS := 32
LDFLAGS += -m32 TARGET_CPU_ARCH := x86
endif endif
DFLAGS += -m$(TARGET_CPU_BITS)
LDFLAGS += -m$(TARGET_CPU_BITS)
# Windows (cygwin/mingw) specific flags # Windows (cygwin/mingw) specific flags
ifneq ( ,$(findstring Windows, $(OS))) ifneq ( ,$(findstring Windows, $(OS)))
ifeq ($(ARCH), x86_64) ifeq ($(ARCH), x86_64)
@ -48,8 +53,6 @@ CC = gcc
CCFLAGS = $(DFLAGS) -I. -Wall -Wtype-limits CCFLAGS = $(DFLAGS) -I. -Wall -Wtype-limits
LDFLAGS += -lm LDFLAGS += -lm
LD = gcc -pthread -lrt LD = gcc -pthread -lrt
YASM = yasm
ASMOBJS = cpu.o
OBJS = interface_main.o encmain.o bitstream.o cabac.o config.o context.o encoder.o filter.o inter.o intra.o nal.o picture.o rdo.o sao.o scalinglist.o search.o strategyselector.o tables.o threadqueue.o transform.o OBJS = interface_main.o encmain.o bitstream.o cabac.o config.o context.o encoder.o filter.o inter.o intra.o nal.o picture.o rdo.o sao.o scalinglist.o search.o strategyselector.o tables.o threadqueue.o transform.o
PROG = ./kvazaar PROG = ./kvazaar
PROGS = $(PROG) PROGS = $(PROG)
@ -62,9 +65,6 @@ all: $(PROGS)
$(PROG): $(OBJS) $(ASMOBJS) $(PROG): $(OBJS) $(ASMOBJS)
$(LD) $^ $(LDFLAGS) -o $@ $(LD) $^ $(LDFLAGS) -o $@
cpu.o: x86/cpu.asm
$(YASM) $(ASMFLAGS) x86/cpu.asm -o cpu.o
%.o: %.c Makefile %.o: %.c Makefile
$(CC) $(CCFLAGS) -c $< -o $@ $(CC) $(CCFLAGS) -c $< -o $@
@ -73,6 +73,7 @@ cpu.o: x86/cpu.asm
clean: clean:
echo $(ARCH)
rm -f $(OBJS) $(PROGS) $(ASMOBJS) $(DEPS) rm -f $(OBJS) $(PROGS) $(ASMOBJS) $(DEPS)
-include $(DEPS) -include $(DEPS)

View file

@ -135,7 +135,7 @@ typedef int16_t coefficient;
#define SIZE_NxN 3 #define SIZE_NxN 3
#define SIZE_NONE 15 #define SIZE_NONE 15
#define MAX_TILES_PER_DIM 16 #define MAX_TILES_PER_DIM 48
#define MAX_SLICES 16 #define MAX_SLICES 16
/* Inlining functions */ /* Inlining functions */

View file

@ -718,7 +718,6 @@ void intra_recon_lcu_chroma(encoder_state * const encoder_state, int x, int y, i
cu_info *cur_cu = &lcu->cu[LCU_CU_OFFSET + (lcu_px.x>>3) + (lcu_px.y>>3)*LCU_T_CU_WIDTH]; cu_info *cur_cu = &lcu->cu[LCU_CU_OFFSET + (lcu_px.x>>3) + (lcu_px.y>>3)*LCU_T_CU_WIDTH];
const int8_t width = LCU_WIDTH >> depth; const int8_t width = LCU_WIDTH >> depth;
const int8_t width_c = (depth == MAX_PU_DEPTH ? width : width / 2); const int8_t width_c = (depth == MAX_PU_DEPTH ? width : width / 2);
const int pu_index = PU_INDEX(x >> 2, y >> 2);
if (depth == 0 || cur_cu->tr_depth > depth) { if (depth == 0 || cur_cu->tr_depth > depth) {
int offset = width / 2; int offset = width / 2;

View file

@ -155,7 +155,28 @@ static void* strategyselector_choose_for(const strategy_list * const strategies,
} }
#if COMPILE_INTEL #if COMPILE_INTEL
#include "x86/cpu.h"
#if defined(__GNUC__)
#include <cpuid.h>
#else
#include <intrin.h>
//Adapter from __cpuid (VS) to __get_cpuid (GNU C).
__inline int __get_cpuid(unsigned int __level, unsigned int *__eax, unsigned int *__ebx, unsigned int *__ecx, unsigned int *__edx) {
int CPUInfo[4] = {*__eax, *__ebx, *__ecx, *__edx};
__cpuid(CPUInfo, 0);
// check if the CPU supports the cpuid instruction.
if (CPUInfo[0] != 0) {
__cpuid(CPUInfo, __level);
*__eax = CPUInfo[0];
*__ebx = CPUInfo[1];
*__ecx = CPUInfo[2];
*__edx = CPUInfo[3];
return 1;
}
return 0;
}
#endif //defined(__GNUC__)
#endif #endif
static void set_hardware_flags() { static void set_hardware_flags() {
@ -167,12 +188,12 @@ static void set_hardware_flags() {
#if COMPILE_INTEL #if COMPILE_INTEL
{ {
int ecx = 0,edx =0; unsigned int eax = 0, ebx = 0, ecx = 0, edx =0;
/* CPU feature bits */ /* CPU feature bits */
enum { BIT_SSE3 = 0,BIT_SSSE3 = 9, BIT_SSE41 = 19, BIT_SSE42 = 20, BIT_MMX = 24, BIT_SSE = 25, BIT_SSE2 = 26, BIT_AVX = 28}; enum { BIT_SSE3 = 0,BIT_SSSE3 = 9, BIT_SSE41 = 19, BIT_SSE42 = 20, BIT_MMX = 24, BIT_SSE = 25, BIT_SSE2 = 26, BIT_AVX = 28};
// Dig CPU features with cpuid // Dig CPU features with cpuid
kvz_cpu_cpuid(&ecx,&edx); __get_cpuid(1, &eax, &ebx, &ecx, &edx);
// EDX // EDX
if (edx & (1<<BIT_MMX)) g_hardware_flags.intel_flags.mmx = 1; if (edx & (1<<BIT_MMX)) g_hardware_flags.intel_flags.mmx = 1;

View file

@ -106,7 +106,7 @@ class LogParser:
else: else:
return float(value) return float(value)
def __init__(self): def __init__(self, filename):
re_thread = re.compile(r'^\t([0-9]+)\t-\t([0-9\.]+)\t(\+?)([0-9\.]+)\t-\tthread$') re_thread = re.compile(r'^\t([0-9]+)\t-\t([0-9\.]+)\t(\+?)([0-9\.]+)\t-\tthread$')
re_job = re.compile(r'^([^\t]+)\t([0-9]+)\t([0-9\.]+)\t(\+?)([0-9\.]+)\t(\+?)([0-9\.]+)\t(\+?)([0-9\.]+)\t(.*)$') re_job = re.compile(r'^([^\t]+)\t([0-9]+)\t([0-9\.]+)\t(\+?)([0-9\.]+)\t(\+?)([0-9\.]+)\t(\+?)([0-9\.]+)\t(.*)$')
re_dep = re.compile(r'^(.+)->(.+)$') re_dep = re.compile(r'^(.+)->(.+)$')
@ -118,7 +118,7 @@ class LogParser:
objects = [] objects = []
threads = {} threads = {}
for line in open('threadqueue.log','r').readlines(): for line in open(filename,'r').readlines():
m = re_thread.match(line) m = re_thread.match(line)
if m: if m:
g = m.groups() g = m.groups()
@ -281,6 +281,10 @@ class LogParser:
if __name__ == '__main__': if __name__ == '__main__':
l = LogParser() import sys
if len(sys.argv) > 1:
l = LogParser(sys.argv[1])
else:
l = LogParser('threadqueue.log')
l.plot_picture_wise_wpp() l.plot_picture_wise_wpp()
#l.plot_threads() #l.plot_threads()