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