From 4469b1680f063f8231c0fc50ddf7e98917e81769 Mon Sep 17 00:00:00 2001 From: Ari Koivula Date: Mon, 16 Jun 2014 17:05:29 +0300 Subject: [PATCH] Fix inter sad tests. - Because intra sad functions were added to the same module, they were being called as if they were reg_sad, which of course failed. Conflicts: tests/sad_tests.c --- tests/sad_tests.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/tests/sad_tests.c b/tests/sad_tests.c index 7035e2ba..ce65bb6f 100644 --- a/tests/sad_tests.c +++ b/tests/sad_tests.c @@ -3,23 +3,7 @@ #include "src/image.h" #include "src/strategyselector.h" -static strategy_list strategies; - -void init_strategies() -{ - strategies.allocated = 0; - strategies.count = 0; - strategies.strategies = NULL; - - // Init strategyselector because it sets hardware flags. - strategyselector_init(); - - // Collect all strategies. - if (!strategy_register_picture(&strategies)) { - fprintf(stderr, "strategy_register_picture failed!\n"); - return; - } -} +#include ////////////////////////////////////////////////////////////////////////// @@ -31,6 +15,8 @@ void init_strategies() ////////////////////////////////////////////////////////////////////////// // GLOBALS +static strategy_list strategies; + const uint8_t ref_data[64] = { 1,2,2,2,2,2,2,3, 4,5,5,5,5,5,5,6, @@ -58,6 +44,23 @@ image *g_ref = 0; ////////////////////////////////////////////////////////////////////////// // SETUP, TEARDOWN AND HELPER FUNCTIONS +static void init_strategies() +{ + strategies.allocated = 0; + strategies.count = 0; + strategies.strategies = NULL; + + // Init strategyselector because it sets hardware flags. + strategyselector_init(); + + // Collect all strategies. + if (!strategy_register_picture(&strategies)) { + fprintf(stderr, "strategy_register_picture failed!\n"); + return; + } +} + + static void setup_tests() { init_strategies(); @@ -239,6 +242,10 @@ SUITE(sad_tests) setup_tests(); for (unsigned i = 0; i < strategies.count; ++i) { + if (strcmp(strategies.strategies[i].type, "reg_sad") != 0) { + continue; + } + // Change the global reg_sad function pointer. reg_sad = strategies.strategies[i].fptr;