Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
| 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 www.aomedia.org/license/software. 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 www.aomedia.org/license/patent. |
Johann | 123e8a6 | 2017-12-28 14:40:49 -0800 | [diff] [blame] | 10 | */ |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 11 | |
| 12 | #include <cstdlib> |
| 13 | #include <string> |
| 14 | |
| 15 | #include "third_party/googletest/src/googletest/include/gtest/gtest.h" |
| 16 | |
| 17 | #include "./aom_config.h" |
| 18 | #include "./av1_rtcd.h" |
| 19 | #include "aom_ports/aom_timer.h" |
| 20 | #include "av1/common/cdef_block.h" |
| 21 | #include "test/acm_random.h" |
| 22 | #include "test/clear_system_state.h" |
| 23 | #include "test/register_state_check.h" |
| 24 | #include "test/util.h" |
| 25 | |
| 26 | using libaom_test::ACMRandom; |
| 27 | |
| 28 | namespace { |
| 29 | |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 30 | typedef std::tr1::tuple<cdef_filter_block_func, cdef_filter_block_func, |
| 31 | BLOCK_SIZE, int, int> |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 32 | cdef_dir_param_t; |
| 33 | |
| 34 | class CDEFBlockTest : public ::testing::TestWithParam<cdef_dir_param_t> { |
| 35 | public: |
| 36 | virtual ~CDEFBlockTest() {} |
| 37 | virtual void SetUp() { |
| 38 | cdef = GET_PARAM(0); |
| 39 | ref_cdef = GET_PARAM(1); |
| 40 | bsize = GET_PARAM(2); |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 41 | boundary = GET_PARAM(3); |
| 42 | depth = GET_PARAM(4); |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | virtual void TearDown() { libaom_test::ClearSystemState(); } |
| 46 | |
| 47 | protected: |
| 48 | int bsize; |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 49 | int boundary; |
| 50 | int depth; |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 51 | cdef_filter_block_func cdef; |
| 52 | cdef_filter_block_func ref_cdef; |
| 53 | }; |
| 54 | |
| 55 | typedef CDEFBlockTest CDEFSpeedTest; |
| 56 | |
| 57 | void test_cdef(int bsize, int iterations, cdef_filter_block_func cdef, |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 58 | cdef_filter_block_func ref_cdef, int boundary, int depth) { |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 59 | const int size = 8; |
| 60 | const int ysize = size + 2 * CDEF_VBORDER; |
| 61 | ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 62 | DECLARE_ALIGNED(16, uint16_t, s[ysize * CDEF_BSTRIDE]); |
| 63 | DECLARE_ALIGNED(16, static uint16_t, d[size * size]); |
| 64 | DECLARE_ALIGNED(16, static uint16_t, ref_d[size * size]); |
| 65 | memset(ref_d, 0, sizeof(ref_d)); |
| 66 | memset(d, 0, sizeof(d)); |
| 67 | |
| 68 | int error = 0, pristrength = 0, secstrength, dir; |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 69 | int pridamping, secdamping, bits, level, count, |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 70 | errdepth = 0, errpristrength = 0, errsecstrength = 0, errboundary = 0, |
| 71 | errpridamping = 0, errsecdamping = 0; |
| 72 | unsigned int pos = 0; |
| 73 | |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 74 | const unsigned int max_pos = size * size >> static_cast<int>(depth == 8); |
| 75 | for (pridamping = 3 + depth - 8; pridamping < 7 - 3 * !!boundary + depth - 8; |
| 76 | pridamping++) { |
| 77 | for (secdamping = 3 + depth - 8; |
| 78 | secdamping < 7 - 3 * !!boundary + depth - 8; secdamping++) { |
| 79 | for (count = 0; count < iterations; count++) { |
| 80 | for (level = 0; level < (1 << depth) && !error; |
| 81 | level += (2 + 6 * !!boundary) << (depth - 8)) { |
| 82 | for (bits = 1; bits <= depth && !error; bits += 1 + 3 * !!boundary) { |
| 83 | for (unsigned int i = 0; i < sizeof(s) / sizeof(*s); i++) |
| 84 | s[i] = clamp((rnd.Rand16() & ((1 << bits) - 1)) + level, 0, |
| 85 | (1 << depth) - 1); |
| 86 | if (boundary) { |
| 87 | if (boundary & 1) { // Left |
| 88 | for (int i = 0; i < ysize; i++) |
| 89 | for (int j = 0; j < CDEF_HBORDER; j++) |
| 90 | s[i * CDEF_BSTRIDE + j] = CDEF_VERY_LARGE; |
| 91 | } |
| 92 | if (boundary & 2) { // Right |
| 93 | for (int i = 0; i < ysize; i++) |
| 94 | for (int j = CDEF_HBORDER + size; j < CDEF_BSTRIDE; j++) |
| 95 | s[i * CDEF_BSTRIDE + j] = CDEF_VERY_LARGE; |
| 96 | } |
| 97 | if (boundary & 4) { // Above |
| 98 | for (int i = 0; i < CDEF_VBORDER; i++) |
| 99 | for (int j = 0; j < CDEF_BSTRIDE; j++) |
| 100 | s[i * CDEF_BSTRIDE + j] = CDEF_VERY_LARGE; |
| 101 | } |
| 102 | if (boundary & 8) { // Below |
| 103 | for (int i = CDEF_VBORDER + size; i < ysize; i++) |
| 104 | for (int j = 0; j < CDEF_BSTRIDE; j++) |
| 105 | s[i * CDEF_BSTRIDE + j] = CDEF_VERY_LARGE; |
| 106 | } |
| 107 | } |
| 108 | for (dir = 0; dir < 8; dir++) { |
| 109 | for (pristrength = 0; pristrength <= 19 << (depth - 8) && !error; |
| 110 | pristrength += (1 + 4 * !!boundary) << (depth - 8)) { |
| 111 | if (pristrength == 16) pristrength = 19; |
| 112 | for (secstrength = 0; secstrength <= 4 << (depth - 8) && !error; |
| 113 | secstrength += 1 << (depth - 8)) { |
| 114 | if (secstrength == 3 << (depth - 8)) continue; |
| 115 | ref_cdef(depth == 8 ? (uint8_t *)ref_d : 0, ref_d, size, |
| 116 | s + CDEF_HBORDER + CDEF_VBORDER * CDEF_BSTRIDE, |
| 117 | pristrength, secstrength, dir, pridamping, |
| 118 | secdamping, bsize, (1 << depth) - 1, depth - 8); |
| 119 | // If cdef and ref_cdef are the same, we're just testing |
| 120 | // speed |
| 121 | if (cdef != ref_cdef) |
| 122 | ASM_REGISTER_STATE_CHECK( |
| 123 | cdef(depth == 8 ? (uint8_t *)d : 0, d, size, |
| 124 | s + CDEF_HBORDER + CDEF_VBORDER * CDEF_BSTRIDE, |
| 125 | pristrength, secstrength, dir, pridamping, |
| 126 | secdamping, bsize, (1 << depth) - 1, depth - 8)); |
| 127 | if (ref_cdef != cdef) { |
| 128 | for (pos = 0; pos < max_pos && !error; pos++) { |
| 129 | error = ref_d[pos] != d[pos]; |
| 130 | errdepth = depth; |
| 131 | errpristrength = pristrength; |
| 132 | errsecstrength = secstrength; |
| 133 | errboundary = boundary; |
| 134 | errpridamping = pridamping; |
| 135 | errsecdamping = secdamping; |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 136 | } |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | } |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 146 | |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 147 | pos--; |
| 148 | EXPECT_EQ(0, error) << "Error: CDEFBlockTest, SIMD and C mismatch." |
| 149 | << std::endl |
| 150 | << "First error at " << pos % size << "," << pos / size |
| 151 | << " (" << (int16_t)ref_d[pos] << " : " << (int16_t)d[pos] |
| 152 | << ") " << std::endl |
| 153 | << "pristrength: " << errpristrength << std::endl |
| 154 | << "pridamping: " << errpridamping << std::endl |
| 155 | << "secstrength: " << errsecstrength << std::endl |
| 156 | << "secdamping: " << errsecdamping << std::endl |
| 157 | << "depth: " << errdepth << std::endl |
| 158 | << "size: " << bsize << std::endl |
| 159 | << "boundary: " << errboundary << std::endl |
| 160 | << std::endl; |
| 161 | } |
| 162 | |
| 163 | void test_cdef_speed(int bsize, int iterations, cdef_filter_block_func cdef, |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 164 | cdef_filter_block_func ref_cdef, int boundary, int depth) { |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 165 | aom_usec_timer ref_timer; |
| 166 | aom_usec_timer timer; |
| 167 | |
| 168 | aom_usec_timer_start(&ref_timer); |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 169 | test_cdef(bsize, iterations, ref_cdef, ref_cdef, boundary, depth); |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 170 | aom_usec_timer_mark(&ref_timer); |
| 171 | int ref_elapsed_time = (int)aom_usec_timer_elapsed(&ref_timer); |
| 172 | |
| 173 | aom_usec_timer_start(&timer); |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 174 | test_cdef(bsize, iterations, cdef, cdef, boundary, depth); |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 175 | aom_usec_timer_mark(&timer); |
| 176 | int elapsed_time = (int)aom_usec_timer_elapsed(&timer); |
| 177 | |
| 178 | #if 0 |
| 179 | std::cout << "[ ] C time = " << ref_elapsed_time / 1000 |
| 180 | << " ms, SIMD time = " << elapsed_time / 1000 << " ms" << std::endl; |
| 181 | #endif |
| 182 | |
| 183 | EXPECT_GT(ref_elapsed_time, elapsed_time) |
| 184 | << "Error: CDEFSpeedTest, SIMD slower than C." << std::endl |
| 185 | << "C time: " << ref_elapsed_time << " us" << std::endl |
| 186 | << "SIMD time: " << elapsed_time << " us" << std::endl; |
| 187 | } |
| 188 | |
| 189 | typedef int (*find_dir_t)(const uint16_t *img, int stride, int32_t *var, |
| 190 | int coeff_shift); |
| 191 | |
| 192 | typedef std::tr1::tuple<find_dir_t, find_dir_t> find_dir_param_t; |
| 193 | |
| 194 | class CDEFFindDirTest : public ::testing::TestWithParam<find_dir_param_t> { |
| 195 | public: |
| 196 | virtual ~CDEFFindDirTest() {} |
| 197 | virtual void SetUp() { |
| 198 | finddir = GET_PARAM(0); |
| 199 | ref_finddir = GET_PARAM(1); |
| 200 | } |
| 201 | |
| 202 | virtual void TearDown() { libaom_test::ClearSystemState(); } |
| 203 | |
| 204 | protected: |
| 205 | find_dir_t finddir; |
| 206 | find_dir_t ref_finddir; |
| 207 | }; |
| 208 | |
| 209 | typedef CDEFFindDirTest CDEFFindDirSpeedTest; |
| 210 | |
| 211 | void test_finddir(int (*finddir)(const uint16_t *img, int stride, int32_t *var, |
| 212 | int coeff_shift), |
| 213 | int (*ref_finddir)(const uint16_t *img, int stride, |
| 214 | int32_t *var, int coeff_shift)) { |
| 215 | const int size = 8; |
| 216 | ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 217 | DECLARE_ALIGNED(16, uint16_t, s[size * size]); |
| 218 | |
| 219 | int error = 0; |
| 220 | int depth, bits, level, count, errdepth = 0; |
| 221 | int ref_res = 0, res = 0; |
| 222 | int32_t ref_var = 0, var = 0; |
| 223 | |
| 224 | for (depth = 8; depth <= 12 && !error; depth += 2) { |
| 225 | for (count = 0; count < 512 && !error; count++) { |
| 226 | for (level = 0; level < (1 << depth) && !error; |
| 227 | level += 1 << (depth - 8)) { |
| 228 | for (bits = 1; bits <= depth && !error; bits++) { |
| 229 | for (unsigned int i = 0; i < sizeof(s) / sizeof(*s); i++) |
| 230 | s[i] = clamp((rnd.Rand16() & ((1 << bits) - 1)) + level, 0, |
| 231 | (1 << depth) - 1); |
| 232 | for (int c = 0; c < 1 + 9 * (finddir == ref_finddir); c++) |
| 233 | ref_res = ref_finddir(s, size, &ref_var, depth - 8); |
| 234 | if (finddir != ref_finddir) |
| 235 | ASM_REGISTER_STATE_CHECK(res = finddir(s, size, &var, depth - 8)); |
| 236 | if (ref_finddir != finddir) { |
| 237 | if (res != ref_res || var != ref_var) error = 1; |
| 238 | errdepth = depth; |
| 239 | } |
| 240 | } |
| 241 | } |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | EXPECT_EQ(0, error) << "Error: CDEFFindDirTest, SIMD and C mismatch." |
| 246 | << std::endl |
| 247 | << "return: " << res << " : " << ref_res << std::endl |
| 248 | << "var: " << var << " : " << ref_var << std::endl |
| 249 | << "depth: " << errdepth << std::endl |
| 250 | << std::endl; |
| 251 | } |
| 252 | |
| 253 | void test_finddir_speed(int (*finddir)(const uint16_t *img, int stride, |
| 254 | int32_t *var, int coeff_shift), |
| 255 | int (*ref_finddir)(const uint16_t *img, int stride, |
| 256 | int32_t *var, int coeff_shift)) { |
| 257 | aom_usec_timer ref_timer; |
| 258 | aom_usec_timer timer; |
| 259 | |
| 260 | aom_usec_timer_start(&ref_timer); |
| 261 | test_finddir(ref_finddir, ref_finddir); |
| 262 | aom_usec_timer_mark(&ref_timer); |
| 263 | int ref_elapsed_time = (int)aom_usec_timer_elapsed(&ref_timer); |
| 264 | |
| 265 | aom_usec_timer_start(&timer); |
| 266 | test_finddir(finddir, finddir); |
| 267 | aom_usec_timer_mark(&timer); |
| 268 | int elapsed_time = (int)aom_usec_timer_elapsed(&timer); |
| 269 | |
| 270 | #if 0 |
| 271 | std::cout << "[ ] C time = " << ref_elapsed_time / 1000 |
| 272 | << " ms, SIMD time = " << elapsed_time / 1000 << " ms" << std::endl; |
| 273 | #endif |
| 274 | |
| 275 | EXPECT_GT(ref_elapsed_time, elapsed_time) |
| 276 | << "Error: CDEFFindDirSpeedTest, SIMD slower than C." << std::endl |
| 277 | << "C time: " << ref_elapsed_time << " us" << std::endl |
| 278 | << "SIMD time: " << elapsed_time << " us" << std::endl; |
| 279 | } |
| 280 | |
| 281 | TEST_P(CDEFBlockTest, TestSIMDNoMismatch) { |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 282 | test_cdef(bsize, 1, cdef, ref_cdef, boundary, depth); |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 283 | } |
| 284 | |
| 285 | TEST_P(CDEFSpeedTest, DISABLED_TestSpeed) { |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 286 | test_cdef_speed(bsize, 4, cdef, ref_cdef, boundary, depth); |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 287 | } |
| 288 | |
| 289 | TEST_P(CDEFFindDirTest, TestSIMDNoMismatch) { |
| 290 | test_finddir(finddir, ref_finddir); |
| 291 | } |
| 292 | |
| 293 | TEST_P(CDEFFindDirSpeedTest, DISABLED_TestSpeed) { |
| 294 | test_finddir_speed(finddir, ref_finddir); |
| 295 | } |
| 296 | |
| 297 | using std::tr1::make_tuple; |
| 298 | |
| 299 | // VS compiling for 32 bit targets does not support vector types in |
| 300 | // structs as arguments, which makes the v256 type of the intrinsics |
| 301 | // hard to support, so optimizations for this target are disabled. |
| 302 | #if defined(_WIN64) || !defined(_MSC_VER) || defined(__clang__) |
| 303 | #if HAVE_SSE2 |
| 304 | INSTANTIATE_TEST_CASE_P( |
| 305 | SSE2, CDEFBlockTest, |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 306 | ::testing::Combine(::testing::Values(&cdef_filter_block_sse2), |
| 307 | ::testing::Values(&cdef_filter_block_c), |
| 308 | ::testing::Range(BLOCK_4X4, BLOCK_8X8), |
| 309 | ::testing::Range(0, 16), ::testing::Range(8, 12, 2))); |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 310 | INSTANTIATE_TEST_CASE_P(SSE2, CDEFFindDirTest, |
| 311 | ::testing::Values(make_tuple(&cdef_find_dir_sse2, |
| 312 | &cdef_find_dir_c))); |
| 313 | #endif |
| 314 | #if HAVE_SSSE3 |
| 315 | INSTANTIATE_TEST_CASE_P( |
| 316 | SSSE3, CDEFBlockTest, |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 317 | ::testing::Combine(::testing::Values(&cdef_filter_block_ssse3), |
| 318 | ::testing::Values(&cdef_filter_block_c), |
| 319 | ::testing::Range(BLOCK_4X4, BLOCK_8X8), |
| 320 | ::testing::Range(0, 16), ::testing::Range(8, 12, 2))); |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 321 | INSTANTIATE_TEST_CASE_P(SSSE3, CDEFFindDirTest, |
| 322 | ::testing::Values(make_tuple(&cdef_find_dir_ssse3, |
| 323 | &cdef_find_dir_c))); |
| 324 | #endif |
| 325 | |
| 326 | #if HAVE_SSE4_1 |
| 327 | INSTANTIATE_TEST_CASE_P( |
| 328 | SSE4_1, CDEFBlockTest, |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 329 | ::testing::Combine(::testing::Values(&cdef_filter_block_sse4_1), |
| 330 | ::testing::Values(&cdef_filter_block_c), |
| 331 | ::testing::Range(BLOCK_4X4, BLOCK_8X8), |
| 332 | ::testing::Range(0, 16), ::testing::Range(8, 12, 2))); |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 333 | INSTANTIATE_TEST_CASE_P(SSE4_1, CDEFFindDirTest, |
| 334 | ::testing::Values(make_tuple(&cdef_find_dir_sse4_1, |
| 335 | &cdef_find_dir_c))); |
| 336 | #endif |
| 337 | |
| 338 | #if HAVE_AVX2 |
| 339 | INSTANTIATE_TEST_CASE_P( |
| 340 | AVX2, CDEFBlockTest, |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 341 | ::testing::Combine(::testing::Values(&cdef_filter_block_avx2), |
| 342 | ::testing::Values(&cdef_filter_block_c), |
| 343 | ::testing::Range(BLOCK_4X4, BLOCK_8X8), |
| 344 | ::testing::Range(0, 16), ::testing::Range(8, 12, 2))); |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 345 | INSTANTIATE_TEST_CASE_P(AVX2, CDEFFindDirTest, |
| 346 | ::testing::Values(make_tuple(&cdef_find_dir_avx2, |
| 347 | &cdef_find_dir_c))); |
| 348 | #endif |
| 349 | |
| 350 | #if HAVE_NEON |
| 351 | INSTANTIATE_TEST_CASE_P( |
| 352 | NEON, CDEFBlockTest, |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 353 | ::testing::Combine(::testing::Values(&cdef_filter_block_neon), |
| 354 | ::testing::Values(&cdef_filter_block_c), |
| 355 | ::testing::Range(BLOCK_4X4, BLOCK_8X8), |
| 356 | ::testing::Range(0, 16), ::testing::Range(8, 12, 2))); |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 357 | INSTANTIATE_TEST_CASE_P(NEON, CDEFFindDirTest, |
| 358 | ::testing::Values(make_tuple(&cdef_find_dir_neon, |
| 359 | &cdef_find_dir_c))); |
| 360 | #endif |
| 361 | |
| 362 | // Test speed for all supported architectures |
| 363 | #if HAVE_SSE2 |
| 364 | INSTANTIATE_TEST_CASE_P( |
| 365 | SSE2, CDEFSpeedTest, |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 366 | ::testing::Combine(::testing::Values(&cdef_filter_block_sse2), |
| 367 | ::testing::Values(&cdef_filter_block_c), |
| 368 | ::testing::Range(BLOCK_4X4, BLOCK_8X8), |
| 369 | ::testing::Range(0, 16), ::testing::Range(8, 12, 2))); |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 370 | INSTANTIATE_TEST_CASE_P(SSE2, CDEFFindDirSpeedTest, |
| 371 | ::testing::Values(make_tuple(&cdef_find_dir_sse2, |
| 372 | &cdef_find_dir_c))); |
| 373 | #endif |
| 374 | |
| 375 | #if HAVE_SSSE3 |
| 376 | INSTANTIATE_TEST_CASE_P( |
| 377 | SSSE3, CDEFSpeedTest, |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 378 | ::testing::Combine(::testing::Values(&cdef_filter_block_ssse3), |
| 379 | ::testing::Values(&cdef_filter_block_c), |
| 380 | ::testing::Range(BLOCK_4X4, BLOCK_8X8), |
| 381 | ::testing::Range(0, 16), ::testing::Range(8, 12, 2))); |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 382 | INSTANTIATE_TEST_CASE_P(SSSE3, CDEFFindDirSpeedTest, |
| 383 | ::testing::Values(make_tuple(&cdef_find_dir_ssse3, |
| 384 | &cdef_find_dir_c))); |
| 385 | #endif |
| 386 | |
| 387 | #if HAVE_SSE4_1 |
| 388 | INSTANTIATE_TEST_CASE_P( |
| 389 | SSE4_1, CDEFSpeedTest, |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 390 | ::testing::Combine(::testing::Values(&cdef_filter_block_sse4_1), |
| 391 | ::testing::Values(&cdef_filter_block_c), |
| 392 | ::testing::Range(BLOCK_4X4, BLOCK_8X8), |
| 393 | ::testing::Range(0, 16), ::testing::Range(8, 12, 2))); |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 394 | INSTANTIATE_TEST_CASE_P(SSE4_1, CDEFFindDirSpeedTest, |
| 395 | ::testing::Values(make_tuple(&cdef_find_dir_sse4_1, |
| 396 | &cdef_find_dir_c))); |
| 397 | #endif |
| 398 | |
| 399 | #if HAVE_AVX2 |
| 400 | INSTANTIATE_TEST_CASE_P( |
| 401 | AVX2, CDEFSpeedTest, |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 402 | ::testing::Combine(::testing::Values(&cdef_filter_block_avx2), |
| 403 | ::testing::Values(&cdef_filter_block_c), |
| 404 | ::testing::Range(BLOCK_4X4, BLOCK_8X8), |
| 405 | ::testing::Range(0, 16), ::testing::Range(8, 12, 2))); |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 406 | INSTANTIATE_TEST_CASE_P(AVX2, CDEFFindDirSpeedTest, |
| 407 | ::testing::Values(make_tuple(&cdef_find_dir_avx2, |
| 408 | &cdef_find_dir_c))); |
| 409 | #endif |
| 410 | |
| 411 | #if HAVE_NEON |
| 412 | INSTANTIATE_TEST_CASE_P( |
| 413 | NEON, CDEFSpeedTest, |
Sarah Parker | f65e5ba | 2018-03-14 18:33:52 -0700 | [diff] [blame] | 414 | ::testing::Combine(::testing::Values(&cdef_filter_block_neon), |
| 415 | ::testing::Values(&cdef_filter_block_c), |
| 416 | ::testing::Range(BLOCK_4X4, BLOCK_8X8), |
| 417 | ::testing::Range(0, 16), ::testing::Range(8, 12, 2))); |
Steinar Midtskogen | 5978212 | 2017-07-20 08:49:43 +0200 | [diff] [blame] | 418 | INSTANTIATE_TEST_CASE_P(NEON, CDEFFindDirSpeedTest, |
| 419 | ::testing::Values(make_tuple(&cdef_find_dir_neon, |
| 420 | &cdef_find_dir_c))); |
| 421 | #endif |
| 422 | |
| 423 | #endif // defined(_WIN64) || !defined(_MSC_VER) |
| 424 | } // namespace |