Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [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 |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [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. |
| 10 | */ |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 11 | |
| 12 | #include <cmath> |
| 13 | #include <cstdlib> |
| 14 | #include <string> |
| 15 | |
| 16 | #include "third_party/googletest/src/include/gtest/gtest.h" |
Jingning Han | 097d59c | 2015-07-29 14:51:36 -0700 | [diff] [blame] | 17 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 18 | #include "./aom_config.h" |
| 19 | #include "./aom_dsp_rtcd.h" |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 20 | #include "test/acm_random.h" |
| 21 | #include "test/clear_system_state.h" |
| 22 | #include "test/register_state_check.h" |
| 23 | #include "test/util.h" |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 24 | #include "av1/common/entropy.h" |
| 25 | #include "av1/common/loopfilter.h" |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 26 | #include "aom/aom_integer.h" |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 27 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 28 | using libaom_test::ACMRandom; |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 29 | |
| 30 | namespace { |
| 31 | // Horizontally and Vertically need 32x32: 8 Coeffs preceeding filtered section |
| 32 | // 16 Coefs within filtered section |
| 33 | // 8 Coeffs following filtered section |
| 34 | const int kNumCoeffs = 1024; |
| 35 | |
| 36 | const int number_of_iterations = 10000; |
| 37 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 38 | #if CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 39 | typedef void (*loop_op_t)(uint16_t *s, int p, const uint8_t *blimit, |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 40 | const uint8_t *limit, const uint8_t *thresh, int bd); |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 41 | typedef void (*dual_loop_op_t)(uint16_t *s, int p, const uint8_t *blimit0, |
| 42 | const uint8_t *limit0, const uint8_t *thresh0, |
| 43 | const uint8_t *blimit1, const uint8_t *limit1, |
| 44 | const uint8_t *thresh1, int bd); |
| 45 | #else |
| 46 | typedef void (*loop_op_t)(uint8_t *s, int p, const uint8_t *blimit, |
James Zern | 3ea537c | 2016-02-13 11:05:24 -0800 | [diff] [blame] | 47 | const uint8_t *limit, const uint8_t *thresh); |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 48 | typedef void (*dual_loop_op_t)(uint8_t *s, int p, const uint8_t *blimit0, |
| 49 | const uint8_t *limit0, const uint8_t *thresh0, |
| 50 | const uint8_t *blimit1, const uint8_t *limit1, |
| 51 | const uint8_t *thresh1); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 52 | #endif // CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 53 | |
James Zern | 3ea537c | 2016-02-13 11:05:24 -0800 | [diff] [blame] | 54 | typedef std::tr1::tuple<loop_op_t, loop_op_t, int> loop8_param_t; |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 55 | typedef std::tr1::tuple<dual_loop_op_t, dual_loop_op_t, int> dualloop8_param_t; |
| 56 | |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 57 | class Loop8Test6Param : public ::testing::TestWithParam<loop8_param_t> { |
| 58 | public: |
| 59 | virtual ~Loop8Test6Param() {} |
| 60 | virtual void SetUp() { |
| 61 | loopfilter_op_ = GET_PARAM(0); |
| 62 | ref_loopfilter_op_ = GET_PARAM(1); |
| 63 | bit_depth_ = GET_PARAM(2); |
| 64 | mask_ = (1 << bit_depth_) - 1; |
| 65 | } |
| 66 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 67 | virtual void TearDown() { libaom_test::ClearSystemState(); } |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 68 | |
| 69 | protected: |
| 70 | int bit_depth_; |
| 71 | int mask_; |
| 72 | loop_op_t loopfilter_op_; |
| 73 | loop_op_t ref_loopfilter_op_; |
| 74 | }; |
| 75 | |
| 76 | class Loop8Test9Param : public ::testing::TestWithParam<dualloop8_param_t> { |
| 77 | public: |
| 78 | virtual ~Loop8Test9Param() {} |
| 79 | virtual void SetUp() { |
| 80 | loopfilter_op_ = GET_PARAM(0); |
| 81 | ref_loopfilter_op_ = GET_PARAM(1); |
| 82 | bit_depth_ = GET_PARAM(2); |
| 83 | mask_ = (1 << bit_depth_) - 1; |
| 84 | } |
| 85 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 86 | virtual void TearDown() { libaom_test::ClearSystemState(); } |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 87 | |
| 88 | protected: |
| 89 | int bit_depth_; |
| 90 | int mask_; |
| 91 | dual_loop_op_t loopfilter_op_; |
| 92 | dual_loop_op_t ref_loopfilter_op_; |
| 93 | }; |
| 94 | |
| 95 | TEST_P(Loop8Test6Param, OperationCheck) { |
| 96 | ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 97 | const int count_test_block = number_of_iterations; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 98 | #if CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 99 | int32_t bd = bit_depth_; |
James Zern | fd3658b | 2015-05-02 13:24:16 -0700 | [diff] [blame] | 100 | DECLARE_ALIGNED(16, uint16_t, s[kNumCoeffs]); |
| 101 | DECLARE_ALIGNED(16, uint16_t, ref_s[kNumCoeffs]); |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 102 | #else |
James Zern | fd3658b | 2015-05-02 13:24:16 -0700 | [diff] [blame] | 103 | DECLARE_ALIGNED(8, uint8_t, s[kNumCoeffs]); |
| 104 | DECLARE_ALIGNED(8, uint8_t, ref_s[kNumCoeffs]); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 105 | #endif // CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 106 | int err_count_total = 0; |
| 107 | int first_failure = -1; |
| 108 | for (int i = 0; i < count_test_block; ++i) { |
| 109 | int err_count = 0; |
Deb Mukherjee | 072ed17 | 2014-12-03 16:26:48 -0800 | [diff] [blame] | 110 | uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4)); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 111 | DECLARE_ALIGNED(16, const uint8_t, |
| 112 | blimit[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 113 | tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp }; |
Deb Mukherjee | 072ed17 | 2014-12-03 16:26:48 -0800 | [diff] [blame] | 114 | tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER)); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 115 | DECLARE_ALIGNED(16, const uint8_t, |
| 116 | limit[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 117 | tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp }; |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 118 | tmp = rnd.Rand8(); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 119 | DECLARE_ALIGNED(16, const uint8_t, |
| 120 | thresh[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 121 | tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp }; |
| 122 | int32_t p = kNumCoeffs / 32; |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 123 | |
| 124 | uint16_t tmp_s[kNumCoeffs]; |
| 125 | int j = 0; |
| 126 | while (j < kNumCoeffs) { |
| 127 | uint8_t val = rnd.Rand8(); |
| 128 | if (val & 0x80) { // 50% chance to choose a new value. |
| 129 | tmp_s[j] = rnd.Rand16(); |
| 130 | j++; |
| 131 | } else { // 50% chance to repeat previous value in row X times |
| 132 | int k = 0; |
| 133 | while (k++ < ((val & 0x1f) + 1) && j < kNumCoeffs) { |
| 134 | if (j < 1) { |
| 135 | tmp_s[j] = rnd.Rand16(); |
| 136 | } else if (val & 0x20) { // Increment by an value within the limit |
| 137 | tmp_s[j] = (tmp_s[j - 1] + (*limit - 1)); |
| 138 | } else { // Decrement by an value within the limit |
| 139 | tmp_s[j] = (tmp_s[j - 1] - (*limit - 1)); |
| 140 | } |
| 141 | j++; |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | for (j = 0; j < kNumCoeffs; j++) { |
| 146 | if (i % 2) { |
| 147 | s[j] = tmp_s[j] & mask_; |
| 148 | } else { |
| 149 | s[j] = tmp_s[p * (j % p) + j / p] & mask_; |
| 150 | } |
| 151 | ref_s[j] = s[j]; |
| 152 | } |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 153 | #if CONFIG_AOM_HIGHBITDEPTH |
James Zern | 3ea537c | 2016-02-13 11:05:24 -0800 | [diff] [blame] | 154 | ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit, limit, thresh, bd); |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 155 | ASM_REGISTER_STATE_CHECK( |
James Zern | 3ea537c | 2016-02-13 11:05:24 -0800 | [diff] [blame] | 156 | loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, bd)); |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 157 | #else |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 158 | ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit, limit, thresh); |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 159 | ASM_REGISTER_STATE_CHECK( |
James Zern | 3ea537c | 2016-02-13 11:05:24 -0800 | [diff] [blame] | 160 | loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh)); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 161 | #endif // CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 162 | |
Urvang Joshi | 88a03bb | 2016-10-17 14:34:48 -0700 | [diff] [blame] | 163 | for (j = 0; j < kNumCoeffs; ++j) { |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 164 | err_count += ref_s[j] != s[j]; |
| 165 | } |
| 166 | if (err_count && !err_count_total) { |
| 167 | first_failure = i; |
| 168 | } |
| 169 | err_count_total += err_count; |
| 170 | } |
| 171 | EXPECT_EQ(0, err_count_total) |
| 172 | << "Error: Loop8Test6Param, C output doesn't match SSE2 " |
| 173 | "loopfilter output. " |
| 174 | << "First failed at test case " << first_failure; |
| 175 | } |
| 176 | |
| 177 | TEST_P(Loop8Test6Param, ValueCheck) { |
| 178 | ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 179 | const int count_test_block = number_of_iterations; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 180 | #if CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 181 | const int32_t bd = bit_depth_; |
James Zern | fd3658b | 2015-05-02 13:24:16 -0700 | [diff] [blame] | 182 | DECLARE_ALIGNED(16, uint16_t, s[kNumCoeffs]); |
| 183 | DECLARE_ALIGNED(16, uint16_t, ref_s[kNumCoeffs]); |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 184 | #else |
James Zern | fd3658b | 2015-05-02 13:24:16 -0700 | [diff] [blame] | 185 | DECLARE_ALIGNED(8, uint8_t, s[kNumCoeffs]); |
| 186 | DECLARE_ALIGNED(8, uint8_t, ref_s[kNumCoeffs]); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 187 | #endif // CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 188 | int err_count_total = 0; |
| 189 | int first_failure = -1; |
Deb Mukherjee | 072ed17 | 2014-12-03 16:26:48 -0800 | [diff] [blame] | 190 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 191 | // NOTE: The code in av1_loopfilter.c:update_sharpness computes mblim as a |
Deb Mukherjee | 072ed17 | 2014-12-03 16:26:48 -0800 | [diff] [blame] | 192 | // function of sharpness_lvl and the loopfilter lvl as: |
| 193 | // block_inside_limit = lvl >> ((sharpness_lvl > 0) + (sharpness_lvl > 4)); |
| 194 | // ... |
James Zern | f58011a | 2015-04-23 20:47:40 -0700 | [diff] [blame] | 195 | // memset(lfi->lfthr[lvl].mblim, (2 * (lvl + 2) + block_inside_limit), |
| 196 | // SIMD_WIDTH); |
Deb Mukherjee | 072ed17 | 2014-12-03 16:26:48 -0800 | [diff] [blame] | 197 | // This means that the largest value for mblim will occur when sharpness_lvl |
| 198 | // is equal to 0, and lvl is equal to its greatest value (MAX_LOOP_FILTER). |
| 199 | // In this case block_inside_limit will be equal to MAX_LOOP_FILTER and |
| 200 | // therefore mblim will be equal to (2 * (lvl + 2) + block_inside_limit) = |
| 201 | // 2 * (MAX_LOOP_FILTER + 2) + MAX_LOOP_FILTER = 3 * MAX_LOOP_FILTER + 4 |
| 202 | |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 203 | for (int i = 0; i < count_test_block; ++i) { |
| 204 | int err_count = 0; |
Deb Mukherjee | 072ed17 | 2014-12-03 16:26:48 -0800 | [diff] [blame] | 205 | uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4)); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 206 | DECLARE_ALIGNED(16, const uint8_t, |
| 207 | blimit[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 208 | tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp }; |
Deb Mukherjee | 072ed17 | 2014-12-03 16:26:48 -0800 | [diff] [blame] | 209 | tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER)); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 210 | DECLARE_ALIGNED(16, const uint8_t, |
| 211 | limit[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 212 | tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp }; |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 213 | tmp = rnd.Rand8(); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 214 | DECLARE_ALIGNED(16, const uint8_t, |
| 215 | thresh[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 216 | tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp }; |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 217 | int32_t p = kNumCoeffs / 32; |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 218 | for (int j = 0; j < kNumCoeffs; ++j) { |
| 219 | s[j] = rnd.Rand16() & mask_; |
| 220 | ref_s[j] = s[j]; |
| 221 | } |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 222 | #if CONFIG_AOM_HIGHBITDEPTH |
James Zern | 3ea537c | 2016-02-13 11:05:24 -0800 | [diff] [blame] | 223 | ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit, limit, thresh, bd); |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 224 | ASM_REGISTER_STATE_CHECK( |
James Zern | 3ea537c | 2016-02-13 11:05:24 -0800 | [diff] [blame] | 225 | loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, bd)); |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 226 | #else |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 227 | ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit, limit, thresh); |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 228 | ASM_REGISTER_STATE_CHECK( |
James Zern | 3ea537c | 2016-02-13 11:05:24 -0800 | [diff] [blame] | 229 | loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh)); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 230 | #endif // CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 231 | for (int j = 0; j < kNumCoeffs; ++j) { |
| 232 | err_count += ref_s[j] != s[j]; |
| 233 | } |
| 234 | if (err_count && !err_count_total) { |
| 235 | first_failure = i; |
| 236 | } |
| 237 | err_count_total += err_count; |
| 238 | } |
| 239 | EXPECT_EQ(0, err_count_total) |
| 240 | << "Error: Loop8Test6Param, C output doesn't match SSE2 " |
| 241 | "loopfilter output. " |
| 242 | << "First failed at test case " << first_failure; |
| 243 | } |
| 244 | |
| 245 | TEST_P(Loop8Test9Param, OperationCheck) { |
| 246 | ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 247 | const int count_test_block = number_of_iterations; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 248 | #if CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 249 | const int32_t bd = bit_depth_; |
James Zern | fd3658b | 2015-05-02 13:24:16 -0700 | [diff] [blame] | 250 | DECLARE_ALIGNED(16, uint16_t, s[kNumCoeffs]); |
| 251 | DECLARE_ALIGNED(16, uint16_t, ref_s[kNumCoeffs]); |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 252 | #else |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 253 | DECLARE_ALIGNED(8, uint8_t, s[kNumCoeffs]); |
| 254 | DECLARE_ALIGNED(8, uint8_t, ref_s[kNumCoeffs]); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 255 | #endif // CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 256 | int err_count_total = 0; |
| 257 | int first_failure = -1; |
| 258 | for (int i = 0; i < count_test_block; ++i) { |
| 259 | int err_count = 0; |
Deb Mukherjee | 072ed17 | 2014-12-03 16:26:48 -0800 | [diff] [blame] | 260 | uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4)); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 261 | DECLARE_ALIGNED(16, const uint8_t, |
| 262 | blimit0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 263 | tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp }; |
Deb Mukherjee | 072ed17 | 2014-12-03 16:26:48 -0800 | [diff] [blame] | 264 | tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER)); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 265 | DECLARE_ALIGNED(16, const uint8_t, |
| 266 | limit0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 267 | tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp }; |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 268 | tmp = rnd.Rand8(); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 269 | DECLARE_ALIGNED(16, const uint8_t, |
| 270 | thresh0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 271 | tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp }; |
Deb Mukherjee | 072ed17 | 2014-12-03 16:26:48 -0800 | [diff] [blame] | 272 | tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4)); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 273 | DECLARE_ALIGNED(16, const uint8_t, |
| 274 | blimit1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 275 | tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp }; |
Deb Mukherjee | 072ed17 | 2014-12-03 16:26:48 -0800 | [diff] [blame] | 276 | tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER)); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 277 | DECLARE_ALIGNED(16, const uint8_t, |
| 278 | limit1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 279 | tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp }; |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 280 | tmp = rnd.Rand8(); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 281 | DECLARE_ALIGNED(16, const uint8_t, |
| 282 | thresh1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 283 | tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp }; |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 284 | int32_t p = kNumCoeffs / 32; |
| 285 | uint16_t tmp_s[kNumCoeffs]; |
| 286 | int j = 0; |
| 287 | const uint8_t limit = *limit0 < *limit1 ? *limit0 : *limit1; |
| 288 | while (j < kNumCoeffs) { |
| 289 | uint8_t val = rnd.Rand8(); |
| 290 | if (val & 0x80) { // 50% chance to choose a new value. |
| 291 | tmp_s[j] = rnd.Rand16(); |
| 292 | j++; |
| 293 | } else { // 50% chance to repeat previous value in row X times. |
| 294 | int k = 0; |
| 295 | while (k++ < ((val & 0x1f) + 1) && j < kNumCoeffs) { |
| 296 | if (j < 1) { |
| 297 | tmp_s[j] = rnd.Rand16(); |
| 298 | } else if (val & 0x20) { // Increment by a value within the limit. |
| 299 | tmp_s[j] = (tmp_s[j - 1] + (limit - 1)); |
| 300 | } else { // Decrement by an value within the limit. |
| 301 | tmp_s[j] = (tmp_s[j - 1] - (limit - 1)); |
| 302 | } |
| 303 | j++; |
| 304 | } |
| 305 | } |
| 306 | } |
| 307 | for (j = 0; j < kNumCoeffs; j++) { |
| 308 | if (i % 2) { |
| 309 | s[j] = tmp_s[j] & mask_; |
| 310 | } else { |
| 311 | s[j] = tmp_s[p * (j % p) + j / p] & mask_; |
| 312 | } |
| 313 | ref_s[j] = s[j]; |
| 314 | } |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 315 | #if CONFIG_AOM_HIGHBITDEPTH |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 316 | ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1, |
| 317 | limit1, thresh1, bd); |
| 318 | ASM_REGISTER_STATE_CHECK(loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0, |
| 319 | thresh0, blimit1, limit1, thresh1, |
| 320 | bd)); |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 321 | #else |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 322 | ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1, |
| 323 | limit1, thresh1); |
| 324 | ASM_REGISTER_STATE_CHECK(loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0, |
| 325 | thresh0, blimit1, limit1, thresh1)); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 326 | #endif // CONFIG_AOM_HIGHBITDEPTH |
Urvang Joshi | 88a03bb | 2016-10-17 14:34:48 -0700 | [diff] [blame] | 327 | for (j = 0; j < kNumCoeffs; ++j) { |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 328 | err_count += ref_s[j] != s[j]; |
| 329 | } |
| 330 | if (err_count && !err_count_total) { |
| 331 | first_failure = i; |
| 332 | } |
| 333 | err_count_total += err_count; |
| 334 | } |
| 335 | EXPECT_EQ(0, err_count_total) |
| 336 | << "Error: Loop8Test9Param, C output doesn't match SSE2 " |
| 337 | "loopfilter output. " |
| 338 | << "First failed at test case " << first_failure; |
| 339 | } |
| 340 | |
| 341 | TEST_P(Loop8Test9Param, ValueCheck) { |
| 342 | ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 343 | const int count_test_block = number_of_iterations; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 344 | #if CONFIG_AOM_HIGHBITDEPTH |
James Zern | fd3658b | 2015-05-02 13:24:16 -0700 | [diff] [blame] | 345 | DECLARE_ALIGNED(16, uint16_t, s[kNumCoeffs]); |
| 346 | DECLARE_ALIGNED(16, uint16_t, ref_s[kNumCoeffs]); |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 347 | #else |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 348 | DECLARE_ALIGNED(8, uint8_t, s[kNumCoeffs]); |
| 349 | DECLARE_ALIGNED(8, uint8_t, ref_s[kNumCoeffs]); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 350 | #endif // CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 351 | int err_count_total = 0; |
| 352 | int first_failure = -1; |
| 353 | for (int i = 0; i < count_test_block; ++i) { |
| 354 | int err_count = 0; |
Deb Mukherjee | 072ed17 | 2014-12-03 16:26:48 -0800 | [diff] [blame] | 355 | uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4)); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 356 | DECLARE_ALIGNED(16, const uint8_t, |
| 357 | blimit0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 358 | tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp }; |
Deb Mukherjee | 072ed17 | 2014-12-03 16:26:48 -0800 | [diff] [blame] | 359 | tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER)); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 360 | DECLARE_ALIGNED(16, const uint8_t, |
| 361 | limit0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 362 | tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp }; |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 363 | tmp = rnd.Rand8(); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 364 | DECLARE_ALIGNED(16, const uint8_t, |
| 365 | thresh0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 366 | tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp }; |
Deb Mukherjee | 072ed17 | 2014-12-03 16:26:48 -0800 | [diff] [blame] | 367 | tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4)); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 368 | DECLARE_ALIGNED(16, const uint8_t, |
| 369 | blimit1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 370 | tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp }; |
Deb Mukherjee | 072ed17 | 2014-12-03 16:26:48 -0800 | [diff] [blame] | 371 | tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER)); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 372 | DECLARE_ALIGNED(16, const uint8_t, |
| 373 | limit1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 374 | tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp }; |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 375 | tmp = rnd.Rand8(); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 376 | DECLARE_ALIGNED(16, const uint8_t, |
| 377 | thresh1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 378 | tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp }; |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 379 | int32_t p = kNumCoeffs / 32; // TODO(pdlf) can we have non-square here? |
| 380 | for (int j = 0; j < kNumCoeffs; ++j) { |
| 381 | s[j] = rnd.Rand16() & mask_; |
| 382 | ref_s[j] = s[j]; |
| 383 | } |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 384 | #if CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 385 | const int32_t bd = bit_depth_; |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 386 | ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1, |
| 387 | limit1, thresh1, bd); |
| 388 | ASM_REGISTER_STATE_CHECK(loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0, |
| 389 | thresh0, blimit1, limit1, thresh1, |
| 390 | bd)); |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 391 | #else |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 392 | ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1, |
| 393 | limit1, thresh1); |
| 394 | ASM_REGISTER_STATE_CHECK(loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0, |
| 395 | thresh0, blimit1, limit1, thresh1)); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 396 | #endif // CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 397 | for (int j = 0; j < kNumCoeffs; ++j) { |
| 398 | err_count += ref_s[j] != s[j]; |
| 399 | } |
| 400 | if (err_count && !err_count_total) { |
| 401 | first_failure = i; |
| 402 | } |
| 403 | err_count_total += err_count; |
| 404 | } |
| 405 | EXPECT_EQ(0, err_count_total) |
| 406 | << "Error: Loop8Test9Param, C output doesn't match SSE2" |
| 407 | "loopfilter output. " |
| 408 | << "First failed at test case " << first_failure; |
| 409 | } |
| 410 | |
| 411 | using std::tr1::make_tuple; |
| 412 | |
| 413 | #if HAVE_SSE2 |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 414 | #if CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 415 | INSTANTIATE_TEST_CASE_P( |
Deb Mukherjee | 27dce0f | 2014-11-07 10:19:46 -0800 | [diff] [blame] | 416 | SSE2, Loop8Test6Param, |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 417 | ::testing::Values(make_tuple(&aom_highbd_lpf_horizontal_4_sse2, |
| 418 | &aom_highbd_lpf_horizontal_4_c, 8), |
| 419 | make_tuple(&aom_highbd_lpf_vertical_4_sse2, |
| 420 | &aom_highbd_lpf_vertical_4_c, 8), |
| 421 | make_tuple(&aom_highbd_lpf_horizontal_8_sse2, |
| 422 | &aom_highbd_lpf_horizontal_8_c, 8), |
| 423 | make_tuple(&aom_highbd_lpf_horizontal_edge_8_sse2, |
| 424 | &aom_highbd_lpf_horizontal_edge_8_c, 8), |
| 425 | make_tuple(&aom_highbd_lpf_horizontal_edge_16_sse2, |
| 426 | &aom_highbd_lpf_horizontal_edge_16_c, 8), |
| 427 | make_tuple(&aom_highbd_lpf_vertical_8_sse2, |
| 428 | &aom_highbd_lpf_vertical_8_c, 8), |
| 429 | make_tuple(&aom_highbd_lpf_vertical_16_sse2, |
| 430 | &aom_highbd_lpf_vertical_16_c, 8), |
| 431 | make_tuple(&aom_highbd_lpf_horizontal_4_sse2, |
| 432 | &aom_highbd_lpf_horizontal_4_c, 10), |
| 433 | make_tuple(&aom_highbd_lpf_vertical_4_sse2, |
| 434 | &aom_highbd_lpf_vertical_4_c, 10), |
| 435 | make_tuple(&aom_highbd_lpf_horizontal_8_sse2, |
| 436 | &aom_highbd_lpf_horizontal_8_c, 10), |
| 437 | make_tuple(&aom_highbd_lpf_horizontal_edge_8_sse2, |
| 438 | &aom_highbd_lpf_horizontal_edge_8_c, 10), |
| 439 | make_tuple(&aom_highbd_lpf_horizontal_edge_16_sse2, |
| 440 | &aom_highbd_lpf_horizontal_edge_16_c, 10), |
| 441 | make_tuple(&aom_highbd_lpf_vertical_8_sse2, |
| 442 | &aom_highbd_lpf_vertical_8_c, 10), |
| 443 | make_tuple(&aom_highbd_lpf_vertical_16_sse2, |
| 444 | &aom_highbd_lpf_vertical_16_c, 10), |
| 445 | make_tuple(&aom_highbd_lpf_horizontal_4_sse2, |
| 446 | &aom_highbd_lpf_horizontal_4_c, 12), |
| 447 | make_tuple(&aom_highbd_lpf_vertical_4_sse2, |
| 448 | &aom_highbd_lpf_vertical_4_c, 12), |
| 449 | make_tuple(&aom_highbd_lpf_horizontal_8_sse2, |
| 450 | &aom_highbd_lpf_horizontal_8_c, 12), |
| 451 | make_tuple(&aom_highbd_lpf_horizontal_edge_8_sse2, |
| 452 | &aom_highbd_lpf_horizontal_edge_8_c, 12), |
| 453 | make_tuple(&aom_highbd_lpf_horizontal_edge_16_sse2, |
| 454 | &aom_highbd_lpf_horizontal_edge_16_c, 12), |
| 455 | make_tuple(&aom_highbd_lpf_vertical_8_sse2, |
| 456 | &aom_highbd_lpf_vertical_8_c, 12), |
| 457 | make_tuple(&aom_highbd_lpf_vertical_16_sse2, |
| 458 | &aom_highbd_lpf_vertical_16_c, 12), |
| 459 | make_tuple(&aom_highbd_lpf_vertical_16_dual_sse2, |
| 460 | &aom_highbd_lpf_vertical_16_dual_c, 8), |
| 461 | make_tuple(&aom_highbd_lpf_vertical_16_dual_sse2, |
| 462 | &aom_highbd_lpf_vertical_16_dual_c, 10), |
| 463 | make_tuple(&aom_highbd_lpf_vertical_16_dual_sse2, |
| 464 | &aom_highbd_lpf_vertical_16_dual_c, 12))); |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 465 | #else |
| 466 | INSTANTIATE_TEST_CASE_P( |
Deb Mukherjee | 072ed17 | 2014-12-03 16:26:48 -0800 | [diff] [blame] | 467 | SSE2, Loop8Test6Param, |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 468 | ::testing::Values( |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 469 | make_tuple(&aom_lpf_horizontal_4_sse2, &aom_lpf_horizontal_4_c, 8), |
| 470 | make_tuple(&aom_lpf_horizontal_8_sse2, &aom_lpf_horizontal_8_c, 8), |
| 471 | make_tuple(&aom_lpf_horizontal_edge_8_sse2, |
| 472 | &aom_lpf_horizontal_edge_8_c, 8), |
| 473 | make_tuple(&aom_lpf_horizontal_edge_16_sse2, |
| 474 | &aom_lpf_horizontal_edge_16_c, 8), |
| 475 | make_tuple(&aom_lpf_vertical_4_sse2, &aom_lpf_vertical_4_c, 8), |
| 476 | make_tuple(&aom_lpf_vertical_8_sse2, &aom_lpf_vertical_8_c, 8), |
| 477 | make_tuple(&aom_lpf_vertical_16_sse2, &aom_lpf_vertical_16_c, 8), |
| 478 | make_tuple(&aom_lpf_vertical_16_dual_sse2, &aom_lpf_vertical_16_dual_c, |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 479 | 8))); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 480 | #endif // CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 27dce0f | 2014-11-07 10:19:46 -0800 | [diff] [blame] | 481 | #endif |
| 482 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 483 | #if HAVE_AVX2 && (!CONFIG_AOM_HIGHBITDEPTH) |
Deb Mukherjee | 27dce0f | 2014-11-07 10:19:46 -0800 | [diff] [blame] | 484 | INSTANTIATE_TEST_CASE_P( |
Deb Mukherjee | 072ed17 | 2014-12-03 16:26:48 -0800 | [diff] [blame] | 485 | AVX2, Loop8Test6Param, |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 486 | ::testing::Values(make_tuple(&aom_lpf_horizontal_edge_8_avx2, |
| 487 | &aom_lpf_horizontal_edge_8_c, 8), |
| 488 | make_tuple(&aom_lpf_horizontal_edge_16_avx2, |
| 489 | &aom_lpf_horizontal_edge_16_c, 8))); |
Deb Mukherjee | 27dce0f | 2014-11-07 10:19:46 -0800 | [diff] [blame] | 490 | #endif |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 491 | |
| 492 | #if HAVE_SSE2 |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 493 | #if CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 494 | INSTANTIATE_TEST_CASE_P( |
Deb Mukherjee | 27dce0f | 2014-11-07 10:19:46 -0800 | [diff] [blame] | 495 | SSE2, Loop8Test9Param, |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 496 | ::testing::Values(make_tuple(&aom_highbd_lpf_horizontal_4_dual_sse2, |
| 497 | &aom_highbd_lpf_horizontal_4_dual_c, 8), |
| 498 | make_tuple(&aom_highbd_lpf_horizontal_8_dual_sse2, |
| 499 | &aom_highbd_lpf_horizontal_8_dual_c, 8), |
| 500 | make_tuple(&aom_highbd_lpf_vertical_4_dual_sse2, |
| 501 | &aom_highbd_lpf_vertical_4_dual_c, 8), |
| 502 | make_tuple(&aom_highbd_lpf_vertical_8_dual_sse2, |
| 503 | &aom_highbd_lpf_vertical_8_dual_c, 8), |
| 504 | make_tuple(&aom_highbd_lpf_horizontal_4_dual_sse2, |
| 505 | &aom_highbd_lpf_horizontal_4_dual_c, 10), |
| 506 | make_tuple(&aom_highbd_lpf_horizontal_8_dual_sse2, |
| 507 | &aom_highbd_lpf_horizontal_8_dual_c, 10), |
| 508 | make_tuple(&aom_highbd_lpf_vertical_4_dual_sse2, |
| 509 | &aom_highbd_lpf_vertical_4_dual_c, 10), |
| 510 | make_tuple(&aom_highbd_lpf_vertical_8_dual_sse2, |
| 511 | &aom_highbd_lpf_vertical_8_dual_c, 10), |
| 512 | make_tuple(&aom_highbd_lpf_horizontal_4_dual_sse2, |
| 513 | &aom_highbd_lpf_horizontal_4_dual_c, 12), |
| 514 | make_tuple(&aom_highbd_lpf_horizontal_8_dual_sse2, |
| 515 | &aom_highbd_lpf_horizontal_8_dual_c, 12), |
| 516 | make_tuple(&aom_highbd_lpf_vertical_4_dual_sse2, |
| 517 | &aom_highbd_lpf_vertical_4_dual_c, 12), |
| 518 | make_tuple(&aom_highbd_lpf_vertical_8_dual_sse2, |
| 519 | &aom_highbd_lpf_vertical_8_dual_c, 12))); |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 520 | #else |
| 521 | INSTANTIATE_TEST_CASE_P( |
Deb Mukherjee | 072ed17 | 2014-12-03 16:26:48 -0800 | [diff] [blame] | 522 | SSE2, Loop8Test9Param, |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 523 | ::testing::Values(make_tuple(&aom_lpf_horizontal_4_dual_sse2, |
| 524 | &aom_lpf_horizontal_4_dual_c, 8), |
| 525 | make_tuple(&aom_lpf_horizontal_8_dual_sse2, |
| 526 | &aom_lpf_horizontal_8_dual_c, 8), |
| 527 | make_tuple(&aom_lpf_vertical_4_dual_sse2, |
| 528 | &aom_lpf_vertical_4_dual_c, 8), |
| 529 | make_tuple(&aom_lpf_vertical_8_dual_sse2, |
| 530 | &aom_lpf_vertical_8_dual_c, 8))); |
| 531 | #endif // CONFIG_AOM_HIGHBITDEPTH |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 532 | #endif |
levytamar82 | 86175a5 | 2014-10-16 16:56:37 -0700 | [diff] [blame] | 533 | |
Johann | fca0037 | 2015-01-06 14:13:41 -0800 | [diff] [blame] | 534 | #if HAVE_NEON |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 535 | #if CONFIG_AOM_HIGHBITDEPTH |
Johann | fca0037 | 2015-01-06 14:13:41 -0800 | [diff] [blame] | 536 | // No neon high bitdepth functions. |
| 537 | #else |
James Yu | 5b098b1 | 2014-01-21 09:43:29 +0800 | [diff] [blame] | 538 | INSTANTIATE_TEST_CASE_P( |
| 539 | NEON, Loop8Test6Param, |
| 540 | ::testing::Values( |
| 541 | #if HAVE_NEON_ASM |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 542 | // Using #if inside the macro is unsupported on MSVS but the tests are |
| 543 | // not |
| 544 | // currently built for MSVS with ARM and NEON. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 545 | make_tuple(&aom_lpf_horizontal_edge_8_neon, |
| 546 | &aom_lpf_horizontal_edge_8_c, 8), |
| 547 | make_tuple(&aom_lpf_horizontal_edge_16_neon, |
| 548 | &aom_lpf_horizontal_edge_16_c, 8), |
| 549 | make_tuple(&aom_lpf_vertical_16_neon, &aom_lpf_vertical_16_c, 8), |
| 550 | make_tuple(&aom_lpf_vertical_16_dual_neon, &aom_lpf_vertical_16_dual_c, |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 551 | 8), |
Jingning Han | 50adfdf | 2015-07-15 19:14:54 -0700 | [diff] [blame] | 552 | #endif // HAVE_NEON_ASM |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 553 | make_tuple(&aom_lpf_horizontal_8_neon, &aom_lpf_horizontal_8_c, 8), |
| 554 | make_tuple(&aom_lpf_vertical_8_neon, &aom_lpf_vertical_8_c, 8), |
| 555 | make_tuple(&aom_lpf_horizontal_4_neon, &aom_lpf_horizontal_4_c, 8), |
| 556 | make_tuple(&aom_lpf_vertical_4_neon, &aom_lpf_vertical_4_c, 8))); |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 557 | INSTANTIATE_TEST_CASE_P(NEON, Loop8Test9Param, |
| 558 | ::testing::Values( |
Johann | 377b668 | 2014-12-19 15:00:04 -0800 | [diff] [blame] | 559 | #if HAVE_NEON_ASM |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 560 | make_tuple(&aom_lpf_horizontal_8_dual_neon, |
| 561 | &aom_lpf_horizontal_8_dual_c, 8), |
| 562 | make_tuple(&aom_lpf_vertical_8_dual_neon, |
| 563 | &aom_lpf_vertical_8_dual_c, 8), |
Johann | 377b668 | 2014-12-19 15:00:04 -0800 | [diff] [blame] | 564 | #endif // HAVE_NEON_ASM |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 565 | make_tuple(&aom_lpf_horizontal_4_dual_neon, |
| 566 | &aom_lpf_horizontal_4_dual_c, 8), |
| 567 | make_tuple(&aom_lpf_vertical_4_dual_neon, |
| 568 | &aom_lpf_vertical_4_dual_c, 8))); |
| 569 | #endif // CONFIG_AOM_HIGHBITDEPTH |
Johann | fca0037 | 2015-01-06 14:13:41 -0800 | [diff] [blame] | 570 | #endif // HAVE_NEON |
James Yu | 5b098b1 | 2014-01-21 09:43:29 +0800 | [diff] [blame] | 571 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 572 | #if HAVE_DSPR2 && !CONFIG_AOM_HIGHBITDEPTH |
James Zern | 47dee37 | 2016-02-13 10:24:26 -0800 | [diff] [blame] | 573 | INSTANTIATE_TEST_CASE_P( |
| 574 | DSPR2, Loop8Test6Param, |
| 575 | ::testing::Values( |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 576 | make_tuple(&aom_lpf_horizontal_4_dspr2, &aom_lpf_horizontal_4_c, 8), |
| 577 | make_tuple(&aom_lpf_horizontal_8_dspr2, &aom_lpf_horizontal_8_c, 8), |
| 578 | make_tuple(&aom_lpf_horizontal_edge_8, &aom_lpf_horizontal_edge_8, 8), |
| 579 | make_tuple(&aom_lpf_horizontal_edge_16, &aom_lpf_horizontal_edge_16, 8), |
| 580 | make_tuple(&aom_lpf_vertical_4_dspr2, &aom_lpf_vertical_4_c, 8), |
| 581 | make_tuple(&aom_lpf_vertical_8_dspr2, &aom_lpf_vertical_8_c, 8), |
| 582 | make_tuple(&aom_lpf_vertical_16_dspr2, &aom_lpf_vertical_16_c, 8), |
| 583 | make_tuple(&aom_lpf_vertical_16_dual_dspr2, &aom_lpf_vertical_16_dual_c, |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 584 | 8))); |
James Zern | 47dee37 | 2016-02-13 10:24:26 -0800 | [diff] [blame] | 585 | |
| 586 | INSTANTIATE_TEST_CASE_P( |
| 587 | DSPR2, Loop8Test9Param, |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 588 | ::testing::Values(make_tuple(&aom_lpf_horizontal_4_dual_dspr2, |
| 589 | &aom_lpf_horizontal_4_dual_c, 8), |
| 590 | make_tuple(&aom_lpf_horizontal_8_dual_dspr2, |
| 591 | &aom_lpf_horizontal_8_dual_c, 8), |
| 592 | make_tuple(&aom_lpf_vertical_4_dual_dspr2, |
| 593 | &aom_lpf_vertical_4_dual_c, 8), |
| 594 | make_tuple(&aom_lpf_vertical_8_dual_dspr2, |
| 595 | &aom_lpf_vertical_8_dual_c, 8))); |
| 596 | #endif // HAVE_DSPR2 && !CONFIG_AOM_HIGHBITDEPTH |
James Zern | 47dee37 | 2016-02-13 10:24:26 -0800 | [diff] [blame] | 597 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 598 | #if HAVE_MSA && (!CONFIG_AOM_HIGHBITDEPTH) |
Parag Salasakar | 914f8f9 | 2015-06-04 11:50:41 +0530 | [diff] [blame] | 599 | INSTANTIATE_TEST_CASE_P( |
| 600 | MSA, Loop8Test6Param, |
| 601 | ::testing::Values( |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 602 | make_tuple(&aom_lpf_horizontal_4_msa, &aom_lpf_horizontal_4_c, 8), |
| 603 | make_tuple(&aom_lpf_horizontal_8_msa, &aom_lpf_horizontal_8_c, 8), |
| 604 | make_tuple(&aom_lpf_horizontal_edge_8_msa, &aom_lpf_horizontal_edge_8_c, |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 605 | 8), |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 606 | make_tuple(&aom_lpf_horizontal_edge_16_msa, |
| 607 | &aom_lpf_horizontal_edge_16_c, 8), |
| 608 | make_tuple(&aom_lpf_vertical_4_msa, &aom_lpf_vertical_4_c, 8), |
| 609 | make_tuple(&aom_lpf_vertical_8_msa, &aom_lpf_vertical_8_c, 8), |
| 610 | make_tuple(&aom_lpf_vertical_16_msa, &aom_lpf_vertical_16_c, 8))); |
Parag Salasakar | d43fd99 | 2015-06-05 07:52:40 +0530 | [diff] [blame] | 611 | |
| 612 | INSTANTIATE_TEST_CASE_P( |
| 613 | MSA, Loop8Test9Param, |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 614 | ::testing::Values(make_tuple(&aom_lpf_horizontal_4_dual_msa, |
| 615 | &aom_lpf_horizontal_4_dual_c, 8), |
| 616 | make_tuple(&aom_lpf_horizontal_8_dual_msa, |
| 617 | &aom_lpf_horizontal_8_dual_c, 8), |
| 618 | make_tuple(&aom_lpf_vertical_4_dual_msa, |
| 619 | &aom_lpf_vertical_4_dual_c, 8), |
| 620 | make_tuple(&aom_lpf_vertical_8_dual_msa, |
| 621 | &aom_lpf_vertical_8_dual_c, 8))); |
| 622 | #endif // HAVE_MSA && (!CONFIG_AOM_HIGHBITDEPTH) |
Parag Salasakar | 914f8f9 | 2015-06-04 11:50:41 +0530 | [diff] [blame] | 623 | |
Deb Mukherjee | 931ed51 | 2014-09-17 16:55:05 -0700 | [diff] [blame] | 624 | } // namespace |