mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 11:24:05 +00:00
Makefile now compiles tests. Fixed test files. Removed unused stuff.
This commit is contained in:
parent
50643eeaf8
commit
a64aae7c53
29
src/Makefile
29
src/Makefile
|
@ -61,7 +61,7 @@ endif
|
|||
# Do not use variable length arrays because they don't work in Visual Studio 2013.
|
||||
WARNINGS = -Wall -Wtype-limits -Wvla
|
||||
|
||||
INCLUDEDIRS = -I. -I./strategies -I./extras
|
||||
INCLUDEDIRS = -I. -I./strategies -I./extras -I..
|
||||
|
||||
ifndef CC
|
||||
CC = gcc
|
||||
|
@ -110,6 +110,17 @@ OBJS = interface_main.o \
|
|||
strategies/generic/dct-generic.o \
|
||||
strategies/avx2/dct-avx2.o
|
||||
|
||||
TEST_OBJS = $(filter-out encmain.o interface_main.o, $(OBJS)) \
|
||||
../tests/dct_tests.o \
|
||||
../tests/intra_sad_tests.o \
|
||||
../tests/sad_tests.o \
|
||||
../tests/satd_tests.o \
|
||||
../tests/speed_tests.o \
|
||||
../tests/tests_main.o \
|
||||
../tests/test_strategies.o \
|
||||
|
||||
|
||||
|
||||
ASMFLAGS += $(INCLUDEDIRS)
|
||||
ASMOBJS =
|
||||
|
||||
|
@ -127,10 +138,17 @@ endif
|
|||
PROG = ./kvazaar
|
||||
PROGS = $(PROG)
|
||||
|
||||
DEPS = $(OBJS:.o=.d)
|
||||
TESTS = ./kvazaar_tests
|
||||
|
||||
DEPS = $(OBJS:.o=.d) $(TEST_OBJS:.o=.d)
|
||||
|
||||
all: $(PROGS)
|
||||
.PHONY: all clean
|
||||
.PHONY: all clean build_tests tests
|
||||
|
||||
build_tests: $(TESTS)
|
||||
|
||||
tests: build_tests
|
||||
$(TESTS)
|
||||
|
||||
# Compile files in strategy directories with appropriate flags.
|
||||
EXTRA_FLAGS =
|
||||
|
@ -155,6 +173,9 @@ endif
|
|||
$(PROG): $(OBJS) $(ASMOBJS)
|
||||
$(LD) $^ $(LDFLAGS) -o $@
|
||||
|
||||
$(TESTS): $(TEST_OBJS) $(ASMOBJS)
|
||||
$(LD) $^ $(LDFLAGS) -o $@
|
||||
|
||||
%.o: %.asm Makefile
|
||||
$(AS) $(ASMFLAGS) -o $@ $<
|
||||
|
||||
|
@ -169,6 +190,6 @@ $(PROG): $(OBJS) $(ASMOBJS)
|
|||
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) $(PROGS) $(ASMOBJS) $(DEPS)
|
||||
rm -f $(OBJS) $(PROGS) $(TESTS) $(ASMOBJS) $(TEST_OBJS) $(DEPS) $(TEST_DEPS)
|
||||
|
||||
-include $(DEPS)
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
int16_t * dct_bufs[NUM_TESTS] = { 0 }; // SIMD aligned pointers.
|
||||
int16_t * dct_actual_bufs[NUM_TESTS] = { 0 }; // pointers returned by malloc.
|
||||
|
||||
static int16_t dct_result[NUM_SIZES][LCU_WIDTH*LCU_WIDTH] = { 0 };
|
||||
static int16_t idct_result[NUM_SIZES][LCU_WIDTH*LCU_WIDTH] = { 0 };
|
||||
static int16_t dct_result[NUM_SIZES][LCU_WIDTH*LCU_WIDTH] = { { 0 } };
|
||||
static int16_t idct_result[NUM_SIZES][LCU_WIDTH*LCU_WIDTH] = { { 0 } };
|
||||
|
||||
static struct test_env_t {
|
||||
int log_width; // for selecting dim from bufs
|
||||
|
|
|
@ -90,7 +90,6 @@ TEST satd_test_black_and_white(void)
|
|||
const int const satd_results[5] = {2040, 4080, 16320, 65280, 261120};
|
||||
|
||||
const int test = 0;
|
||||
const int width = 1 << satd_test_env.log_width;
|
||||
|
||||
pixel * buf1 = satd_bufs[test][satd_test_env.log_width][0];
|
||||
pixel * buf2 = satd_bufs[test][satd_test_env.log_width][1];
|
||||
|
@ -98,6 +97,7 @@ TEST satd_test_black_and_white(void)
|
|||
unsigned result1 = satd_test_env.tested_func(buf1, buf2);
|
||||
unsigned result2 = satd_test_env.tested_func(buf2, buf1);
|
||||
|
||||
ASSERT_EQ(result1, result2);
|
||||
ASSERT_EQ(result1, satd_results[satd_test_env.log_width - 2]);
|
||||
|
||||
PASS();
|
||||
|
@ -108,7 +108,6 @@ TEST satd_test_checkers(void)
|
|||
const int const satd_checkers_results[5] = { 2040, 4080, 16320, 65280, 261120 };
|
||||
|
||||
const int test = 1;
|
||||
const int width = 1 << satd_test_env.log_width;
|
||||
|
||||
pixel * buf1 = satd_bufs[test][satd_test_env.log_width][0];
|
||||
pixel * buf2 = satd_bufs[test][satd_test_env.log_width][1];
|
||||
|
@ -116,6 +115,7 @@ TEST satd_test_checkers(void)
|
|||
unsigned result1 = satd_test_env.tested_func(buf1, buf2);
|
||||
unsigned result2 = satd_test_env.tested_func(buf2, buf1);
|
||||
|
||||
ASSERT_EQ(result1, result2);
|
||||
ASSERT_EQ(result1, satd_checkers_results[satd_test_env.log_width - 2]);
|
||||
|
||||
PASS();
|
||||
|
@ -127,7 +127,6 @@ TEST satd_test_gradient(void)
|
|||
const int const satd_gradient_results[5] = {3140,9004,20481,67262,258672};
|
||||
|
||||
const int test = 2;
|
||||
const int width = 1 << satd_test_env.log_width;
|
||||
|
||||
pixel * buf1 = satd_bufs[test][satd_test_env.log_width][0];
|
||||
pixel * buf2 = satd_bufs[test][satd_test_env.log_width][1];
|
||||
|
@ -135,23 +134,12 @@ TEST satd_test_gradient(void)
|
|||
unsigned result1 = satd_test_env.tested_func(buf1, buf2);
|
||||
unsigned result2 = satd_test_env.tested_func(buf2, buf1);
|
||||
|
||||
ASSERT_EQ(result1, result2);
|
||||
ASSERT_EQ(result1, satd_gradient_results[satd_test_env.log_width - 2]);
|
||||
|
||||
PASS();
|
||||
}
|
||||
|
||||
static unsigned satd_test_performance(void)
|
||||
{
|
||||
const int test = 0;
|
||||
const int width = 1 << satd_test_env.log_width;
|
||||
|
||||
pixel * buf1 = satd_bufs[test][satd_test_env.log_width][0];
|
||||
pixel * buf2 = satd_bufs[test][satd_test_env.log_width][1];
|
||||
|
||||
unsigned result = satd_test_env.tested_func(buf1, buf2);
|
||||
|
||||
return;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// TEST FIXTURES
|
||||
SUITE(satd_tests)
|
||||
|
|
|
@ -73,17 +73,6 @@ static void tear_down_tests()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static unsigned test_calc_sad(const pixel * buf1, const pixel * buf2, int dim)
|
||||
{
|
||||
unsigned result = 0;
|
||||
for (int i = 0; i < dim * dim; ++i) {
|
||||
result += abs(buf1[i] - buf2[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// TESTS
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ void init_test_strategies()
|
|||
strategies.strategies = NULL;
|
||||
|
||||
// Init strategyselector because it sets hardware flags.
|
||||
strategyselector_init();
|
||||
strategyselector_init(1);
|
||||
|
||||
// Collect all strategies to be tested.
|
||||
if (!strategy_register_picture(&strategies)) {
|
||||
|
|
|
@ -13,7 +13,7 @@ int main(int argc, char **argv)
|
|||
{
|
||||
GREATEST_MAIN_BEGIN();
|
||||
|
||||
init_test_strategies();
|
||||
init_test_strategies(1);
|
||||
|
||||
RUN_SUITE(sad_tests);
|
||||
RUN_SUITE(intra_sad_tests);
|
||||
|
|
Loading…
Reference in a new issue