From 9c685602d0fb69d0996a87cb9a01930c41a68a32 Mon Sep 17 00:00:00 2001 From: Debargha Mukherjee Date: Thu, 27 Aug 2015 12:28:59 -0700 Subject: [PATCH] Make tests work with new configurations Disables some test vector tests when Vp8/Vp9 decoders are disabled in configuration. Also moves some macros to the vpx level in line with recent refactoring on the master branch. Change-Id: Iaac8008992110398ae096c36b9726f723164c207 --- test/sad_test.cc | 1 + test/test_vector_test.cc | 5 +++++ vp9/common/vp9_common.h | 12 ++---------- vpx_ports/mem.h | 11 +++++++++++ 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/test/sad_test.cc b/test/sad_test.cc index 9c2629d49..c6e9ffe93 100644 --- a/test/sad_test.cc +++ b/test/sad_test.cc @@ -22,6 +22,7 @@ #endif #include "vpx/vpx_codec.h" #include "vpx_mem/vpx_mem.h" +#include "vpx_ports/mem.h" #include "test/acm_random.h" #include "test/clear_system_state.h" diff --git a/test/test_vector_test.cc b/test/test_vector_test.cc index 1f294f20b..449e9411c 100644 --- a/test/test_vector_test.cc +++ b/test/test_vector_test.cc @@ -97,13 +97,18 @@ TEST_P(TestVectorTest, MD5Match) { delete video; } +#if CONFIG_VP8_DECODER VP8_INSTANTIATE_TEST_CASE(TestVectorTest, ::testing::ValuesIn(libvpx_test::kVP8TestVectors, libvpx_test::kVP8TestVectors + libvpx_test::kNumVP8TestVectors)); +#endif // CONFIG_VP8_DECODER + +#if CONFIG_VP9_DECODER VP9_INSTANTIATE_TEST_CASE(TestVectorTest, ::testing::ValuesIn(libvpx_test::kVP9TestVectors, libvpx_test::kVP9TestVectors + libvpx_test::kNumVP9TestVectors)); +#endif // CONFIG_VP9_DECODER } // namespace diff --git a/vp9/common/vp9_common.h b/vp9/common/vp9_common.h index cedce068a..d4f6ed3ca 100644 --- a/vp9/common/vp9_common.h +++ b/vp9/common/vp9_common.h @@ -16,8 +16,9 @@ #include #include "./vpx_config.h" -#include "vpx_mem/vpx_mem.h" #include "vpx/vpx_integer.h" +#include "vpx_mem/vpx_mem.h" +#include "vpx_ports/mem.h" #include "vp9/common/vp9_systemdependent.h" #ifdef __cplusplus @@ -27,12 +28,6 @@ extern "C" { #define MIN(x, y) (((x) < (y)) ? (x) : (y)) #define MAX(x, y) (((x) > (y)) ? (x) : (y)) -#define ROUND_POWER_OF_TWO(value, n) \ - (((value) + (1 << ((n) - 1))) >> (n)) - -#define ALIGN_POWER_OF_TWO(value, n) \ - (((value) + ((1 << (n)) - 1)) & ~((1 << (n)) - 1)) - // Only need this for fixed-size arrays, for structs just assign. #define vp9_copy(dest, src) { \ assert(sizeof(dest) == sizeof(src)); \ @@ -83,9 +78,6 @@ static INLINE uint16_t clip_pixel_highbd(int val, int bd) { typedef int64_t tran_high_t; typedef int32_t tran_low_t; -#define CONVERT_TO_SHORTPTR(x) ((uint16_t*)(((uintptr_t)x) << 1)) -#define CONVERT_TO_BYTEPTR(x) ((uint8_t*)(((uintptr_t)x) >> 1 )) - #else // Note: diff --git a/vpx_ports/mem.h b/vpx_ports/mem.h index 1cb8c8cd9..5021729a4 100644 --- a/vpx_ports/mem.h +++ b/vpx_ports/mem.h @@ -49,4 +49,15 @@ #define __builtin_prefetch(x) #endif +/* Shift down with rounding */ +#define ROUND_POWER_OF_TWO(value, n) \ + (((value) + (1 << ((n) - 1))) >> (n)) +#define ALIGN_POWER_OF_TWO(value, n) \ + (((value) + ((1 << (n)) - 1)) & ~((1 << (n)) - 1)) + +#if CONFIG_VP9_HIGHBITDEPTH +#define CONVERT_TO_SHORTPTR(x) ((uint16_t*)(((uintptr_t)x) << 1)) +#define CONVERT_TO_BYTEPTR(x) ((uint8_t*)(((uintptr_t)x) >> 1)) +#endif // CONFIG_VP9_HIGHBITDEPTH + #endif // VPX_PORTS_MEM_H_ -- 2.49.0