Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 1 | /* |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 3 | * |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 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. |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 10 | */ |
| 11 | |
Tom Finegan | 7a07ece | 2017-02-07 17:14:05 -0800 | [diff] [blame] | 12 | #include "third_party/googletest/src/googletest/include/gtest/gtest.h" |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 13 | |
| 14 | #include "test/function_equivalence_test.h" |
Geza Lore | a3f7ddc | 2016-07-12 15:26:36 +0100 | [diff] [blame] | 15 | #include "test/register_state_check.h" |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 16 | |
Tom Finegan | 60e653d | 2018-05-22 11:34:58 -0700 | [diff] [blame] | 17 | #include "config/aom_config.h" |
Tom Finegan | 44702c8 | 2018-05-22 13:00:39 -0700 | [diff] [blame] | 18 | #include "config/aom_dsp_rtcd.h" |
Tom Finegan | 60e653d | 2018-05-22 11:34:58 -0700 | [diff] [blame] | 19 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 20 | #include "aom/aom_integer.h" |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 21 | |
| 22 | #define MAX_SB_SQUARE (MAX_SB_SIZE * MAX_SB_SIZE) |
| 23 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 24 | using libaom_test::FunctionEquivalenceTest; |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 25 | |
| 26 | namespace { |
| 27 | |
| 28 | static const int kIterations = 1000; |
| 29 | static const int kMaskMax = 64; |
| 30 | |
Geza Lore | c804e0d | 2016-07-12 13:20:04 +0100 | [diff] [blame] | 31 | typedef unsigned int (*ObmcSadF)(const uint8_t *pre, int pre_stride, |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 32 | const int32_t *wsrc, const int32_t *mask); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 33 | typedef libaom_test::FuncParam<ObmcSadF> TestFuncs; |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 34 | |
| 35 | //////////////////////////////////////////////////////////////////////////////// |
| 36 | // 8 bit |
| 37 | //////////////////////////////////////////////////////////////////////////////// |
| 38 | |
Geza Lore | a3f7ddc | 2016-07-12 15:26:36 +0100 | [diff] [blame] | 39 | class ObmcSadTest : public FunctionEquivalenceTest<ObmcSadF> {}; |
chiyotsai | 9dfac72 | 2020-07-07 17:43:02 -0700 | [diff] [blame] | 40 | GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ObmcSadTest); |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 41 | |
| 42 | TEST_P(ObmcSadTest, RandomValues) { |
Geza Lore | c804e0d | 2016-07-12 13:20:04 +0100 | [diff] [blame] | 43 | DECLARE_ALIGNED(32, uint8_t, pre[MAX_SB_SQUARE]); |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 44 | DECLARE_ALIGNED(32, int32_t, wsrc[MAX_SB_SQUARE]); |
| 45 | DECLARE_ALIGNED(32, int32_t, mask[MAX_SB_SQUARE]); |
| 46 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 47 | for (int iter = 0; iter < kIterations && !HasFatalFailure(); ++iter) { |
Geza Lore | c804e0d | 2016-07-12 13:20:04 +0100 | [diff] [blame] | 48 | const int pre_stride = rng_(MAX_SB_SIZE + 1); |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 49 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 50 | for (int i = 0; i < MAX_SB_SQUARE; ++i) { |
Geza Lore | c804e0d | 2016-07-12 13:20:04 +0100 | [diff] [blame] | 51 | pre[i] = rng_.Rand8(); |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 52 | wsrc[i] = rng_.Rand8() * rng_(kMaskMax * kMaskMax + 1); |
| 53 | mask[i] = rng_(kMaskMax * kMaskMax + 1); |
| 54 | } |
| 55 | |
Geza Lore | a3f7ddc | 2016-07-12 15:26:36 +0100 | [diff] [blame] | 56 | const unsigned int ref_res = params_.ref_func(pre, pre_stride, wsrc, mask); |
| 57 | unsigned int tst_res; |
chiyotsai | ef26106 | 2021-07-01 14:01:45 -0700 | [diff] [blame] | 58 | API_REGISTER_STATE_CHECK(tst_res = |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 59 | params_.tst_func(pre, pre_stride, wsrc, mask)); |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 60 | |
| 61 | ASSERT_EQ(ref_res, tst_res); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | TEST_P(ObmcSadTest, ExtremeValues) { |
Geza Lore | c804e0d | 2016-07-12 13:20:04 +0100 | [diff] [blame] | 66 | DECLARE_ALIGNED(32, uint8_t, pre[MAX_SB_SQUARE]); |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 67 | DECLARE_ALIGNED(32, int32_t, wsrc[MAX_SB_SQUARE]); |
| 68 | DECLARE_ALIGNED(32, int32_t, mask[MAX_SB_SQUARE]); |
| 69 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 70 | for (int iter = 0; iter < MAX_SB_SIZE && !HasFatalFailure(); ++iter) { |
Geza Lore | c804e0d | 2016-07-12 13:20:04 +0100 | [diff] [blame] | 71 | const int pre_stride = iter; |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 72 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 73 | for (int i = 0; i < MAX_SB_SQUARE; ++i) { |
Geza Lore | c804e0d | 2016-07-12 13:20:04 +0100 | [diff] [blame] | 74 | pre[i] = UINT8_MAX; |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 75 | wsrc[i] = UINT8_MAX * kMaskMax * kMaskMax; |
| 76 | mask[i] = kMaskMax * kMaskMax; |
| 77 | } |
| 78 | |
Geza Lore | a3f7ddc | 2016-07-12 15:26:36 +0100 | [diff] [blame] | 79 | const unsigned int ref_res = params_.ref_func(pre, pre_stride, wsrc, mask); |
| 80 | unsigned int tst_res; |
chiyotsai | ef26106 | 2021-07-01 14:01:45 -0700 | [diff] [blame] | 81 | API_REGISTER_STATE_CHECK(tst_res = |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 82 | params_.tst_func(pre, pre_stride, wsrc, mask)); |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 83 | |
| 84 | ASSERT_EQ(ref_res, tst_res); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | #if HAVE_SSE4_1 |
| 89 | const ObmcSadTest::ParamType sse4_functions[] = { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 90 | TestFuncs(aom_obmc_sad128x128_c, aom_obmc_sad128x128_sse4_1), |
| 91 | TestFuncs(aom_obmc_sad128x64_c, aom_obmc_sad128x64_sse4_1), |
| 92 | TestFuncs(aom_obmc_sad64x128_c, aom_obmc_sad64x128_sse4_1), |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 93 | TestFuncs(aom_obmc_sad64x64_c, aom_obmc_sad64x64_sse4_1), |
| 94 | TestFuncs(aom_obmc_sad64x32_c, aom_obmc_sad64x32_sse4_1), |
| 95 | TestFuncs(aom_obmc_sad32x64_c, aom_obmc_sad32x64_sse4_1), |
| 96 | TestFuncs(aom_obmc_sad32x32_c, aom_obmc_sad32x32_sse4_1), |
| 97 | TestFuncs(aom_obmc_sad32x16_c, aom_obmc_sad32x16_sse4_1), |
| 98 | TestFuncs(aom_obmc_sad16x32_c, aom_obmc_sad16x32_sse4_1), |
| 99 | TestFuncs(aom_obmc_sad16x16_c, aom_obmc_sad16x16_sse4_1), |
| 100 | TestFuncs(aom_obmc_sad16x8_c, aom_obmc_sad16x8_sse4_1), |
| 101 | TestFuncs(aom_obmc_sad8x16_c, aom_obmc_sad8x16_sse4_1), |
| 102 | TestFuncs(aom_obmc_sad8x8_c, aom_obmc_sad8x8_sse4_1), |
| 103 | TestFuncs(aom_obmc_sad8x4_c, aom_obmc_sad8x4_sse4_1), |
| 104 | TestFuncs(aom_obmc_sad4x8_c, aom_obmc_sad4x8_sse4_1), |
Debargha Mukherjee | 79787fd | 2019-07-16 09:56:15 -0700 | [diff] [blame] | 105 | TestFuncs(aom_obmc_sad4x4_c, aom_obmc_sad4x4_sse4_1), |
| 106 | |
| 107 | TestFuncs(aom_obmc_sad64x16_c, aom_obmc_sad64x16_sse4_1), |
| 108 | TestFuncs(aom_obmc_sad16x64_c, aom_obmc_sad16x64_sse4_1), |
| 109 | TestFuncs(aom_obmc_sad32x8_c, aom_obmc_sad32x8_sse4_1), |
| 110 | TestFuncs(aom_obmc_sad8x32_c, aom_obmc_sad8x32_sse4_1), |
| 111 | TestFuncs(aom_obmc_sad16x4_c, aom_obmc_sad16x4_sse4_1), |
| 112 | TestFuncs(aom_obmc_sad4x16_c, aom_obmc_sad4x16_sse4_1), |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 113 | }; |
| 114 | |
Cheng Chen | 96786fe | 2020-02-14 17:28:25 -0800 | [diff] [blame] | 115 | INSTANTIATE_TEST_SUITE_P(SSE4_1, ObmcSadTest, |
| 116 | ::testing::ValuesIn(sse4_functions)); |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 117 | #endif // HAVE_SSE4_1 |
| 118 | |
Xing Jin | 6eecfe9 | 2018-07-09 14:54:38 +0800 | [diff] [blame] | 119 | #if HAVE_AVX2 |
| 120 | const ObmcSadTest::ParamType avx2_functions[] = { |
| 121 | TestFuncs(aom_obmc_sad128x128_c, aom_obmc_sad128x128_avx2), |
| 122 | TestFuncs(aom_obmc_sad128x64_c, aom_obmc_sad128x64_avx2), |
| 123 | TestFuncs(aom_obmc_sad64x128_c, aom_obmc_sad64x128_avx2), |
| 124 | TestFuncs(aom_obmc_sad64x64_c, aom_obmc_sad64x64_avx2), |
| 125 | TestFuncs(aom_obmc_sad64x32_c, aom_obmc_sad64x32_avx2), |
| 126 | TestFuncs(aom_obmc_sad32x64_c, aom_obmc_sad32x64_avx2), |
| 127 | TestFuncs(aom_obmc_sad32x32_c, aom_obmc_sad32x32_avx2), |
| 128 | TestFuncs(aom_obmc_sad32x16_c, aom_obmc_sad32x16_avx2), |
| 129 | TestFuncs(aom_obmc_sad16x32_c, aom_obmc_sad16x32_avx2), |
| 130 | TestFuncs(aom_obmc_sad16x16_c, aom_obmc_sad16x16_avx2), |
| 131 | TestFuncs(aom_obmc_sad16x8_c, aom_obmc_sad16x8_avx2), |
| 132 | TestFuncs(aom_obmc_sad8x16_c, aom_obmc_sad8x16_avx2), |
| 133 | TestFuncs(aom_obmc_sad8x8_c, aom_obmc_sad8x8_avx2), |
| 134 | TestFuncs(aom_obmc_sad8x4_c, aom_obmc_sad8x4_avx2), |
| 135 | TestFuncs(aom_obmc_sad4x8_c, aom_obmc_sad4x8_avx2), |
Debargha Mukherjee | 79787fd | 2019-07-16 09:56:15 -0700 | [diff] [blame] | 136 | TestFuncs(aom_obmc_sad4x4_c, aom_obmc_sad4x4_avx2), |
| 137 | |
| 138 | TestFuncs(aom_obmc_sad64x16_c, aom_obmc_sad64x16_avx2), |
| 139 | TestFuncs(aom_obmc_sad16x64_c, aom_obmc_sad16x64_avx2), |
| 140 | TestFuncs(aom_obmc_sad32x8_c, aom_obmc_sad32x8_avx2), |
| 141 | TestFuncs(aom_obmc_sad8x32_c, aom_obmc_sad8x32_avx2), |
| 142 | TestFuncs(aom_obmc_sad16x4_c, aom_obmc_sad16x4_avx2), |
| 143 | TestFuncs(aom_obmc_sad4x16_c, aom_obmc_sad4x16_avx2), |
Xing Jin | 6eecfe9 | 2018-07-09 14:54:38 +0800 | [diff] [blame] | 144 | }; |
| 145 | |
Cheng Chen | 96786fe | 2020-02-14 17:28:25 -0800 | [diff] [blame] | 146 | INSTANTIATE_TEST_SUITE_P(AVX2, ObmcSadTest, |
| 147 | ::testing::ValuesIn(avx2_functions)); |
Xing Jin | 6eecfe9 | 2018-07-09 14:54:38 +0800 | [diff] [blame] | 148 | #endif // HAVE_AVX2 |
| 149 | |
Salome Thirot | 22fba5b | 2023-05-05 15:54:13 +0100 | [diff] [blame] | 150 | #if HAVE_NEON |
| 151 | const ObmcSadTest::ParamType neon_functions[] = { |
| 152 | TestFuncs(aom_obmc_sad128x128_c, aom_obmc_sad128x128_neon), |
| 153 | TestFuncs(aom_obmc_sad128x64_c, aom_obmc_sad128x64_neon), |
| 154 | TestFuncs(aom_obmc_sad64x128_c, aom_obmc_sad64x128_neon), |
| 155 | TestFuncs(aom_obmc_sad64x64_c, aom_obmc_sad64x64_neon), |
| 156 | TestFuncs(aom_obmc_sad64x32_c, aom_obmc_sad64x32_neon), |
| 157 | TestFuncs(aom_obmc_sad32x64_c, aom_obmc_sad32x64_neon), |
| 158 | TestFuncs(aom_obmc_sad32x32_c, aom_obmc_sad32x32_neon), |
| 159 | TestFuncs(aom_obmc_sad32x16_c, aom_obmc_sad32x16_neon), |
| 160 | TestFuncs(aom_obmc_sad16x32_c, aom_obmc_sad16x32_neon), |
| 161 | TestFuncs(aom_obmc_sad16x16_c, aom_obmc_sad16x16_neon), |
| 162 | TestFuncs(aom_obmc_sad16x8_c, aom_obmc_sad16x8_neon), |
| 163 | TestFuncs(aom_obmc_sad8x16_c, aom_obmc_sad8x16_neon), |
| 164 | TestFuncs(aom_obmc_sad8x8_c, aom_obmc_sad8x8_neon), |
| 165 | TestFuncs(aom_obmc_sad8x4_c, aom_obmc_sad8x4_neon), |
| 166 | TestFuncs(aom_obmc_sad4x8_c, aom_obmc_sad4x8_neon), |
| 167 | TestFuncs(aom_obmc_sad4x4_c, aom_obmc_sad4x4_neon), |
| 168 | |
| 169 | TestFuncs(aom_obmc_sad64x16_c, aom_obmc_sad64x16_neon), |
| 170 | TestFuncs(aom_obmc_sad16x64_c, aom_obmc_sad16x64_neon), |
| 171 | TestFuncs(aom_obmc_sad32x8_c, aom_obmc_sad32x8_neon), |
| 172 | TestFuncs(aom_obmc_sad8x32_c, aom_obmc_sad8x32_neon), |
| 173 | TestFuncs(aom_obmc_sad16x4_c, aom_obmc_sad16x4_neon), |
| 174 | TestFuncs(aom_obmc_sad4x16_c, aom_obmc_sad4x16_neon), |
| 175 | }; |
| 176 | |
| 177 | INSTANTIATE_TEST_SUITE_P(NEON, ObmcSadTest, |
| 178 | ::testing::ValuesIn(neon_functions)); |
| 179 | #endif // HAVE_NEON |
| 180 | |
Jerome Jiang | 1cb298c | 2019-09-17 11:04:04 -0700 | [diff] [blame] | 181 | #if CONFIG_AV1_HIGHBITDEPTH |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 182 | //////////////////////////////////////////////////////////////////////////////// |
| 183 | // High bit-depth |
| 184 | //////////////////////////////////////////////////////////////////////////////// |
| 185 | |
Geza Lore | a3f7ddc | 2016-07-12 15:26:36 +0100 | [diff] [blame] | 186 | class ObmcSadHBDTest : public FunctionEquivalenceTest<ObmcSadF> {}; |
chiyotsai | 9dfac72 | 2020-07-07 17:43:02 -0700 | [diff] [blame] | 187 | GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ObmcSadHBDTest); |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 188 | |
| 189 | TEST_P(ObmcSadHBDTest, RandomValues) { |
Geza Lore | c804e0d | 2016-07-12 13:20:04 +0100 | [diff] [blame] | 190 | DECLARE_ALIGNED(32, uint16_t, pre[MAX_SB_SQUARE]); |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 191 | DECLARE_ALIGNED(32, int32_t, wsrc[MAX_SB_SQUARE]); |
| 192 | DECLARE_ALIGNED(32, int32_t, mask[MAX_SB_SQUARE]); |
| 193 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 194 | for (int iter = 0; iter < kIterations && !HasFatalFailure(); ++iter) { |
Geza Lore | c804e0d | 2016-07-12 13:20:04 +0100 | [diff] [blame] | 195 | const int pre_stride = rng_(MAX_SB_SIZE + 1); |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 196 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 197 | for (int i = 0; i < MAX_SB_SQUARE; ++i) { |
| 198 | pre[i] = rng_(1 << 12); |
| 199 | wsrc[i] = rng_(1 << 12) * rng_(kMaskMax * kMaskMax + 1); |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 200 | mask[i] = rng_(kMaskMax * kMaskMax + 1); |
| 201 | } |
| 202 | |
Geza Lore | a3f7ddc | 2016-07-12 15:26:36 +0100 | [diff] [blame] | 203 | const unsigned int ref_res = |
| 204 | params_.ref_func(CONVERT_TO_BYTEPTR(pre), pre_stride, wsrc, mask); |
| 205 | unsigned int tst_res; |
chiyotsai | ef26106 | 2021-07-01 14:01:45 -0700 | [diff] [blame] | 206 | API_REGISTER_STATE_CHECK( |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 207 | tst_res = |
| 208 | params_.tst_func(CONVERT_TO_BYTEPTR(pre), pre_stride, wsrc, mask)); |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 209 | |
| 210 | ASSERT_EQ(ref_res, tst_res); |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | TEST_P(ObmcSadHBDTest, ExtremeValues) { |
Geza Lore | c804e0d | 2016-07-12 13:20:04 +0100 | [diff] [blame] | 215 | DECLARE_ALIGNED(32, uint16_t, pre[MAX_SB_SQUARE]); |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 216 | DECLARE_ALIGNED(32, int32_t, wsrc[MAX_SB_SQUARE]); |
| 217 | DECLARE_ALIGNED(32, int32_t, mask[MAX_SB_SQUARE]); |
| 218 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 219 | for (int iter = 0; iter < MAX_SB_SIZE && !HasFatalFailure(); ++iter) { |
Geza Lore | c804e0d | 2016-07-12 13:20:04 +0100 | [diff] [blame] | 220 | const int pre_stride = iter; |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 221 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 222 | for (int i = 0; i < MAX_SB_SQUARE; ++i) { |
Geza Lore | c804e0d | 2016-07-12 13:20:04 +0100 | [diff] [blame] | 223 | pre[i] = (1 << 12) - 1; |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 224 | wsrc[i] = ((1 << 12) - 1) * kMaskMax * kMaskMax; |
| 225 | mask[i] = kMaskMax * kMaskMax; |
| 226 | } |
| 227 | |
Geza Lore | a3f7ddc | 2016-07-12 15:26:36 +0100 | [diff] [blame] | 228 | const unsigned int ref_res = |
| 229 | params_.ref_func(CONVERT_TO_BYTEPTR(pre), pre_stride, wsrc, mask); |
| 230 | unsigned int tst_res; |
chiyotsai | ef26106 | 2021-07-01 14:01:45 -0700 | [diff] [blame] | 231 | API_REGISTER_STATE_CHECK( |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 232 | tst_res = |
| 233 | params_.tst_func(CONVERT_TO_BYTEPTR(pre), pre_stride, wsrc, mask)); |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 234 | |
| 235 | ASSERT_EQ(ref_res, tst_res); |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | #if HAVE_SSE4_1 |
| 240 | ObmcSadHBDTest::ParamType sse4_functions_hbd[] = { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 241 | TestFuncs(aom_highbd_obmc_sad128x128_c, aom_highbd_obmc_sad128x128_sse4_1), |
| 242 | TestFuncs(aom_highbd_obmc_sad128x64_c, aom_highbd_obmc_sad128x64_sse4_1), |
| 243 | TestFuncs(aom_highbd_obmc_sad64x128_c, aom_highbd_obmc_sad64x128_sse4_1), |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 244 | TestFuncs(aom_highbd_obmc_sad64x64_c, aom_highbd_obmc_sad64x64_sse4_1), |
| 245 | TestFuncs(aom_highbd_obmc_sad64x32_c, aom_highbd_obmc_sad64x32_sse4_1), |
| 246 | TestFuncs(aom_highbd_obmc_sad32x64_c, aom_highbd_obmc_sad32x64_sse4_1), |
| 247 | TestFuncs(aom_highbd_obmc_sad32x32_c, aom_highbd_obmc_sad32x32_sse4_1), |
| 248 | TestFuncs(aom_highbd_obmc_sad32x16_c, aom_highbd_obmc_sad32x16_sse4_1), |
| 249 | TestFuncs(aom_highbd_obmc_sad16x32_c, aom_highbd_obmc_sad16x32_sse4_1), |
| 250 | TestFuncs(aom_highbd_obmc_sad16x16_c, aom_highbd_obmc_sad16x16_sse4_1), |
| 251 | TestFuncs(aom_highbd_obmc_sad16x8_c, aom_highbd_obmc_sad16x8_sse4_1), |
| 252 | TestFuncs(aom_highbd_obmc_sad8x16_c, aom_highbd_obmc_sad8x16_sse4_1), |
| 253 | TestFuncs(aom_highbd_obmc_sad8x8_c, aom_highbd_obmc_sad8x8_sse4_1), |
| 254 | TestFuncs(aom_highbd_obmc_sad8x4_c, aom_highbd_obmc_sad8x4_sse4_1), |
| 255 | TestFuncs(aom_highbd_obmc_sad4x8_c, aom_highbd_obmc_sad4x8_sse4_1), |
Debargha Mukherjee | 79787fd | 2019-07-16 09:56:15 -0700 | [diff] [blame] | 256 | TestFuncs(aom_highbd_obmc_sad4x4_c, aom_highbd_obmc_sad4x4_sse4_1), |
| 257 | |
| 258 | TestFuncs(aom_highbd_obmc_sad64x16_c, aom_highbd_obmc_sad64x16_sse4_1), |
| 259 | TestFuncs(aom_highbd_obmc_sad16x64_c, aom_highbd_obmc_sad16x64_sse4_1), |
| 260 | TestFuncs(aom_highbd_obmc_sad32x8_c, aom_highbd_obmc_sad32x8_sse4_1), |
| 261 | TestFuncs(aom_highbd_obmc_sad8x32_c, aom_highbd_obmc_sad8x32_sse4_1), |
| 262 | TestFuncs(aom_highbd_obmc_sad16x4_c, aom_highbd_obmc_sad16x4_sse4_1), |
| 263 | TestFuncs(aom_highbd_obmc_sad4x16_c, aom_highbd_obmc_sad4x16_sse4_1), |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 264 | }; |
| 265 | |
Cheng Chen | 96786fe | 2020-02-14 17:28:25 -0800 | [diff] [blame] | 266 | INSTANTIATE_TEST_SUITE_P(SSE4_1, ObmcSadHBDTest, |
| 267 | ::testing::ValuesIn(sse4_functions_hbd)); |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 268 | #endif // HAVE_SSE4_1 |
Xing Jin | 6eecfe9 | 2018-07-09 14:54:38 +0800 | [diff] [blame] | 269 | |
| 270 | #if HAVE_AVX2 |
| 271 | ObmcSadHBDTest::ParamType avx2_functions_hbd[] = { |
| 272 | TestFuncs(aom_highbd_obmc_sad128x128_c, aom_highbd_obmc_sad128x128_avx2), |
| 273 | TestFuncs(aom_highbd_obmc_sad128x64_c, aom_highbd_obmc_sad128x64_avx2), |
| 274 | TestFuncs(aom_highbd_obmc_sad64x128_c, aom_highbd_obmc_sad64x128_avx2), |
| 275 | TestFuncs(aom_highbd_obmc_sad64x64_c, aom_highbd_obmc_sad64x64_avx2), |
| 276 | TestFuncs(aom_highbd_obmc_sad64x32_c, aom_highbd_obmc_sad64x32_avx2), |
| 277 | TestFuncs(aom_highbd_obmc_sad32x64_c, aom_highbd_obmc_sad32x64_avx2), |
| 278 | TestFuncs(aom_highbd_obmc_sad32x32_c, aom_highbd_obmc_sad32x32_avx2), |
| 279 | TestFuncs(aom_highbd_obmc_sad32x16_c, aom_highbd_obmc_sad32x16_avx2), |
| 280 | TestFuncs(aom_highbd_obmc_sad16x32_c, aom_highbd_obmc_sad16x32_avx2), |
| 281 | TestFuncs(aom_highbd_obmc_sad16x16_c, aom_highbd_obmc_sad16x16_avx2), |
| 282 | TestFuncs(aom_highbd_obmc_sad16x8_c, aom_highbd_obmc_sad16x8_avx2), |
| 283 | TestFuncs(aom_highbd_obmc_sad8x16_c, aom_highbd_obmc_sad8x16_avx2), |
| 284 | TestFuncs(aom_highbd_obmc_sad8x8_c, aom_highbd_obmc_sad8x8_avx2), |
| 285 | TestFuncs(aom_highbd_obmc_sad8x4_c, aom_highbd_obmc_sad8x4_avx2), |
| 286 | TestFuncs(aom_highbd_obmc_sad4x8_c, aom_highbd_obmc_sad4x8_avx2), |
Debargha Mukherjee | 79787fd | 2019-07-16 09:56:15 -0700 | [diff] [blame] | 287 | TestFuncs(aom_highbd_obmc_sad4x4_c, aom_highbd_obmc_sad4x4_avx2), |
| 288 | |
| 289 | TestFuncs(aom_highbd_obmc_sad64x16_c, aom_highbd_obmc_sad64x16_avx2), |
| 290 | TestFuncs(aom_highbd_obmc_sad16x64_c, aom_highbd_obmc_sad16x64_avx2), |
| 291 | TestFuncs(aom_highbd_obmc_sad32x8_c, aom_highbd_obmc_sad32x8_avx2), |
| 292 | TestFuncs(aom_highbd_obmc_sad8x32_c, aom_highbd_obmc_sad8x32_avx2), |
| 293 | TestFuncs(aom_highbd_obmc_sad16x4_c, aom_highbd_obmc_sad16x4_avx2), |
| 294 | TestFuncs(aom_highbd_obmc_sad4x16_c, aom_highbd_obmc_sad4x16_avx2), |
Xing Jin | 6eecfe9 | 2018-07-09 14:54:38 +0800 | [diff] [blame] | 295 | }; |
| 296 | |
Cheng Chen | 96786fe | 2020-02-14 17:28:25 -0800 | [diff] [blame] | 297 | INSTANTIATE_TEST_SUITE_P(AVX2, ObmcSadHBDTest, |
| 298 | ::testing::ValuesIn(avx2_functions_hbd)); |
Xing Jin | 6eecfe9 | 2018-07-09 14:54:38 +0800 | [diff] [blame] | 299 | #endif // HAVE_AVX2 |
Jerome Jiang | 1cb298c | 2019-09-17 11:04:04 -0700 | [diff] [blame] | 300 | #endif // CONFIG_AV1_HIGHBITDEPTH |
Geza Lore | aacdf98 | 2016-07-05 13:36:25 +0100 | [diff] [blame] | 301 | } // namespace |