1 /* 2 * Copyright(c) 2019 Netflix, Inc. 3 * 4 * This source code is subject to the terms of the BSD 2 Clause License and 5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License 6 * was not distributed with this source code in the LICENSE file, you can 7 * obtain it at https://www.aomedia.org/license/software-license. If the Alliance for Open 8 * Media Patent License 1.0 was not distributed with this source code in the 9 * PATENTS file, you can obtain it at https://www.aomedia.org/license/patent-license. 10 */ 11 12 /****************************************************************************** 13 * @file util.h 14 * 15 * @brief common utils 16 * 17 * @author Cidana-Edmond 18 * 19 ******************************************************************************/ 20 #ifndef _TEST_UTIL_H_ 21 #define _TEST_UTIL_H_ 22 23 #include <math.h> 24 #include <stdio.h> 25 #include "EbDefinitions.h" 26 #include "gtest/gtest.h" 27 28 // Macros 29 #ifndef PI 30 #define PI 3.141592653589793238462643383279502884f 31 #endif 32 33 #ifndef TEST_GET_PARAM 34 #define TEST_GET_PARAM(k) std::get<k>(GetParam()) 35 #endif 36 37 #define ALIGNED_ADDR(T, alignment, buffer) \ 38 (T*)(((uintptr_t)buffer + (alignment - 1)) & ~(alignment - 1)) 39 40 #define ALIGNMENT (32) 41 42 namespace svt_av1_test_tool { round_shift(int64_t value,int32_t bit)43INLINE int32_t round_shift(int64_t value, int32_t bit) { 44 assert(bit >= 1); 45 return (int32_t)((value + (1ll << (bit - 1))) >> bit); 46 } 47 } // namespace svt_av1_test_tool 48 49 #endif // _TEST_UTIL_H_ 50