| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #else | 45 #else |
| 46 typedef void (*loop_op_t)(uint8_t *s, int p, const uint8_t *blimit, | 46 typedef void (*loop_op_t)(uint8_t *s, int p, const uint8_t *blimit, |
| 47 const uint8_t *limit, const uint8_t *thresh, | 47 const uint8_t *limit, const uint8_t *thresh, |
| 48 int count); | 48 int count); |
| 49 typedef void (*dual_loop_op_t)(uint8_t *s, int p, const uint8_t *blimit0, | 49 typedef void (*dual_loop_op_t)(uint8_t *s, int p, const uint8_t *blimit0, |
| 50 const uint8_t *limit0, const uint8_t *thresh0, | 50 const uint8_t *limit0, const uint8_t *thresh0, |
| 51 const uint8_t *blimit1, const uint8_t *limit1, | 51 const uint8_t *blimit1, const uint8_t *limit1, |
| 52 const uint8_t *thresh1); | 52 const uint8_t *thresh1); |
| 53 #endif // CONFIG_VP9_HIGHBITDEPTH | 53 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 54 | 54 |
| 55 typedef std::tr1::tuple<loop_op_t, loop_op_t, int> loop8_param_t; | 55 typedef std::tr1::tuple<loop_op_t, loop_op_t, int, int> loop8_param_t; |
| 56 typedef std::tr1::tuple<dual_loop_op_t, dual_loop_op_t, int> dualloop8_param_t; | 56 typedef std::tr1::tuple<dual_loop_op_t, dual_loop_op_t, int> dualloop8_param_t; |
| 57 | 57 |
| 58 #if HAVE_SSE2 | 58 #if HAVE_SSE2 |
| 59 #if CONFIG_VP9_HIGHBITDEPTH | 59 #if CONFIG_VP9_HIGHBITDEPTH |
| 60 void wrapper_vertical_16_sse2(uint16_t *s, int p, const uint8_t *blimit, | 60 void wrapper_vertical_16_sse2(uint16_t *s, int p, const uint8_t *blimit, |
| 61 const uint8_t *limit, const uint8_t *thresh, | 61 const uint8_t *limit, const uint8_t *thresh, |
| 62 int count, int bd) { | 62 int count, int bd) { |
| 63 vp9_highbd_lpf_vertical_16_sse2(s, p, blimit, limit, thresh, bd); | 63 vp9_highbd_lpf_vertical_16_sse2(s, p, blimit, limit, thresh, bd); |
| 64 } | 64 } |
| 65 | 65 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 #endif // CONFIG_VP9_HIGHBITDEPTH | 137 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 138 #endif // HAVE_NEON_ASM | 138 #endif // HAVE_NEON_ASM |
| 139 | 139 |
| 140 class Loop8Test6Param : public ::testing::TestWithParam<loop8_param_t> { | 140 class Loop8Test6Param : public ::testing::TestWithParam<loop8_param_t> { |
| 141 public: | 141 public: |
| 142 virtual ~Loop8Test6Param() {} | 142 virtual ~Loop8Test6Param() {} |
| 143 virtual void SetUp() { | 143 virtual void SetUp() { |
| 144 loopfilter_op_ = GET_PARAM(0); | 144 loopfilter_op_ = GET_PARAM(0); |
| 145 ref_loopfilter_op_ = GET_PARAM(1); | 145 ref_loopfilter_op_ = GET_PARAM(1); |
| 146 bit_depth_ = GET_PARAM(2); | 146 bit_depth_ = GET_PARAM(2); |
| 147 count_ = GET_PARAM(3); |
| 147 mask_ = (1 << bit_depth_) - 1; | 148 mask_ = (1 << bit_depth_) - 1; |
| 148 } | 149 } |
| 149 | 150 |
| 150 virtual void TearDown() { libvpx_test::ClearSystemState(); } | 151 virtual void TearDown() { libvpx_test::ClearSystemState(); } |
| 151 | 152 |
| 152 protected: | 153 protected: |
| 153 int bit_depth_; | 154 int bit_depth_; |
| 155 int count_; |
| 154 int mask_; | 156 int mask_; |
| 155 loop_op_t loopfilter_op_; | 157 loop_op_t loopfilter_op_; |
| 156 loop_op_t ref_loopfilter_op_; | 158 loop_op_t ref_loopfilter_op_; |
| 157 }; | 159 }; |
| 158 | 160 |
| 159 class Loop8Test9Param : public ::testing::TestWithParam<dualloop8_param_t> { | 161 class Loop8Test9Param : public ::testing::TestWithParam<dualloop8_param_t> { |
| 160 public: | 162 public: |
| 161 virtual ~Loop8Test9Param() {} | 163 virtual ~Loop8Test9Param() {} |
| 162 virtual void SetUp() { | 164 virtual void SetUp() { |
| 163 loopfilter_op_ = GET_PARAM(0); | 165 loopfilter_op_ = GET_PARAM(0); |
| 164 ref_loopfilter_op_ = GET_PARAM(1); | 166 ref_loopfilter_op_ = GET_PARAM(1); |
| 165 bit_depth_ = GET_PARAM(2); | 167 bit_depth_ = GET_PARAM(2); |
| 166 mask_ = (1 << bit_depth_) - 1; | 168 mask_ = (1 << bit_depth_) - 1; |
| 167 } | 169 } |
| 168 | 170 |
| 169 virtual void TearDown() { libvpx_test::ClearSystemState(); } | 171 virtual void TearDown() { libvpx_test::ClearSystemState(); } |
| 170 | 172 |
| 171 protected: | 173 protected: |
| 172 int bit_depth_; | 174 int bit_depth_; |
| 173 int mask_; | 175 int mask_; |
| 174 dual_loop_op_t loopfilter_op_; | 176 dual_loop_op_t loopfilter_op_; |
| 175 dual_loop_op_t ref_loopfilter_op_; | 177 dual_loop_op_t ref_loopfilter_op_; |
| 176 }; | 178 }; |
| 177 | 179 |
| 178 TEST_P(Loop8Test6Param, OperationCheck) { | 180 TEST_P(Loop8Test6Param, OperationCheck) { |
| 179 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 181 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 180 const int count_test_block = number_of_iterations; | 182 const int count_test_block = number_of_iterations; |
| 181 #if CONFIG_VP9_HIGHBITDEPTH | 183 #if CONFIG_VP9_HIGHBITDEPTH |
| 182 int32_t bd = bit_depth_; | 184 int32_t bd = bit_depth_; |
| 183 DECLARE_ALIGNED_ARRAY(16, uint16_t, s, kNumCoeffs); | 185 DECLARE_ALIGNED(16, uint16_t, s[kNumCoeffs]); |
| 184 DECLARE_ALIGNED_ARRAY(16, uint16_t, ref_s, kNumCoeffs); | 186 DECLARE_ALIGNED(16, uint16_t, ref_s[kNumCoeffs]); |
| 185 #else | 187 #else |
| 186 DECLARE_ALIGNED_ARRAY(8, uint8_t, s, kNumCoeffs); | 188 DECLARE_ALIGNED(8, uint8_t, s[kNumCoeffs]); |
| 187 DECLARE_ALIGNED_ARRAY(8, uint8_t, ref_s, kNumCoeffs); | 189 DECLARE_ALIGNED(8, uint8_t, ref_s[kNumCoeffs]); |
| 188 #endif // CONFIG_VP9_HIGHBITDEPTH | 190 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 189 int err_count_total = 0; | 191 int err_count_total = 0; |
| 190 int first_failure = -1; | 192 int first_failure = -1; |
| 191 for (int i = 0; i < count_test_block; ++i) { | 193 for (int i = 0; i < count_test_block; ++i) { |
| 192 int err_count = 0; | 194 int err_count = 0; |
| 193 uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4)); | 195 uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4)); |
| 194 DECLARE_ALIGNED(16, const uint8_t, blimit[16]) = { | 196 DECLARE_ALIGNED(16, const uint8_t, blimit[16]) = { |
| 195 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, | 197 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 196 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp | 198 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp |
| 197 }; | 199 }; |
| 198 tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER)); | 200 tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER)); |
| 199 DECLARE_ALIGNED(16, const uint8_t, limit[16]) = { | 201 DECLARE_ALIGNED(16, const uint8_t, limit[16]) = { |
| 200 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, | 202 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 201 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp | 203 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp |
| 202 }; | 204 }; |
| 203 tmp = rnd.Rand8(); | 205 tmp = rnd.Rand8(); |
| 204 DECLARE_ALIGNED(16, const uint8_t, thresh[16]) = { | 206 DECLARE_ALIGNED(16, const uint8_t, thresh[16]) = { |
| 205 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, | 207 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 206 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp | 208 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp |
| 207 }; | 209 }; |
| 208 int32_t p = kNumCoeffs/32; | 210 int32_t p = kNumCoeffs/32; |
| 209 int count = 1; | |
| 210 | 211 |
| 211 uint16_t tmp_s[kNumCoeffs]; | 212 uint16_t tmp_s[kNumCoeffs]; |
| 212 int j = 0; | 213 int j = 0; |
| 213 while (j < kNumCoeffs) { | 214 while (j < kNumCoeffs) { |
| 214 uint8_t val = rnd.Rand8(); | 215 uint8_t val = rnd.Rand8(); |
| 215 if (val & 0x80) { // 50% chance to choose a new value. | 216 if (val & 0x80) { // 50% chance to choose a new value. |
| 216 tmp_s[j] = rnd.Rand16(); | 217 tmp_s[j] = rnd.Rand16(); |
| 217 j++; | 218 j++; |
| 218 } else { // 50% chance to repeat previous value in row X times | 219 } else { // 50% chance to repeat previous value in row X times |
| 219 int k = 0; | 220 int k = 0; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 231 } | 232 } |
| 232 for (j = 0; j < kNumCoeffs; j++) { | 233 for (j = 0; j < kNumCoeffs; j++) { |
| 233 if (i % 2) { | 234 if (i % 2) { |
| 234 s[j] = tmp_s[j] & mask_; | 235 s[j] = tmp_s[j] & mask_; |
| 235 } else { | 236 } else { |
| 236 s[j] = tmp_s[p * (j % p) + j / p] & mask_; | 237 s[j] = tmp_s[p * (j % p) + j / p] & mask_; |
| 237 } | 238 } |
| 238 ref_s[j] = s[j]; | 239 ref_s[j] = s[j]; |
| 239 } | 240 } |
| 240 #if CONFIG_VP9_HIGHBITDEPTH | 241 #if CONFIG_VP9_HIGHBITDEPTH |
| 241 ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit, limit, thresh, count, bd); | 242 ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit, limit, thresh, count_, bd); |
| 242 ASM_REGISTER_STATE_CHECK( | 243 ASM_REGISTER_STATE_CHECK( |
| 243 loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, count, bd)); | 244 loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, count_, bd)); |
| 244 #else | 245 #else |
| 245 ref_loopfilter_op_(ref_s+8+p*8, p, blimit, limit, thresh, count); | 246 ref_loopfilter_op_(ref_s+8+p*8, p, blimit, limit, thresh, count_); |
| 246 ASM_REGISTER_STATE_CHECK( | 247 ASM_REGISTER_STATE_CHECK( |
| 247 loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, count)); | 248 loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, count_)); |
| 248 #endif // CONFIG_VP9_HIGHBITDEPTH | 249 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 249 | 250 |
| 250 for (int j = 0; j < kNumCoeffs; ++j) { | 251 for (int j = 0; j < kNumCoeffs; ++j) { |
| 251 err_count += ref_s[j] != s[j]; | 252 err_count += ref_s[j] != s[j]; |
| 252 } | 253 } |
| 253 if (err_count && !err_count_total) { | 254 if (err_count && !err_count_total) { |
| 254 first_failure = i; | 255 first_failure = i; |
| 255 } | 256 } |
| 256 err_count_total += err_count; | 257 err_count_total += err_count; |
| 257 } | 258 } |
| 258 EXPECT_EQ(0, err_count_total) | 259 EXPECT_EQ(0, err_count_total) |
| 259 << "Error: Loop8Test6Param, C output doesn't match SSE2 " | 260 << "Error: Loop8Test6Param, C output doesn't match SSE2 " |
| 260 "loopfilter output. " | 261 "loopfilter output. " |
| 261 << "First failed at test case " << first_failure; | 262 << "First failed at test case " << first_failure; |
| 262 } | 263 } |
| 263 | 264 |
| 264 TEST_P(Loop8Test6Param, ValueCheck) { | 265 TEST_P(Loop8Test6Param, ValueCheck) { |
| 265 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 266 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 266 const int count_test_block = number_of_iterations; | 267 const int count_test_block = number_of_iterations; |
| 267 #if CONFIG_VP9_HIGHBITDEPTH | 268 #if CONFIG_VP9_HIGHBITDEPTH |
| 268 const int32_t bd = bit_depth_; | 269 const int32_t bd = bit_depth_; |
| 269 DECLARE_ALIGNED_ARRAY(16, uint16_t, s, kNumCoeffs); | 270 DECLARE_ALIGNED(16, uint16_t, s[kNumCoeffs]); |
| 270 DECLARE_ALIGNED_ARRAY(16, uint16_t, ref_s, kNumCoeffs); | 271 DECLARE_ALIGNED(16, uint16_t, ref_s[kNumCoeffs]); |
| 271 #else | 272 #else |
| 272 DECLARE_ALIGNED_ARRAY(8, uint8_t, s, kNumCoeffs); | 273 DECLARE_ALIGNED(8, uint8_t, s[kNumCoeffs]); |
| 273 DECLARE_ALIGNED_ARRAY(8, uint8_t, ref_s, kNumCoeffs); | 274 DECLARE_ALIGNED(8, uint8_t, ref_s[kNumCoeffs]); |
| 274 #endif // CONFIG_VP9_HIGHBITDEPTH | 275 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 275 int err_count_total = 0; | 276 int err_count_total = 0; |
| 276 int first_failure = -1; | 277 int first_failure = -1; |
| 277 | 278 |
| 278 // NOTE: The code in vp9_loopfilter.c:update_sharpness computes mblim as a | 279 // NOTE: The code in vp9_loopfilter.c:update_sharpness computes mblim as a |
| 279 // function of sharpness_lvl and the loopfilter lvl as: | 280 // function of sharpness_lvl and the loopfilter lvl as: |
| 280 // block_inside_limit = lvl >> ((sharpness_lvl > 0) + (sharpness_lvl > 4)); | 281 // block_inside_limit = lvl >> ((sharpness_lvl > 0) + (sharpness_lvl > 4)); |
| 281 // ... | 282 // ... |
| 282 // vpx_memset(lfi->lfthr[lvl].mblim, (2 * (lvl + 2) + block_inside_limit), | 283 // memset(lfi->lfthr[lvl].mblim, (2 * (lvl + 2) + block_inside_limit), |
| 283 // SIMD_WIDTH); | 284 // SIMD_WIDTH); |
| 284 // This means that the largest value for mblim will occur when sharpness_lvl | 285 // This means that the largest value for mblim will occur when sharpness_lvl |
| 285 // is equal to 0, and lvl is equal to its greatest value (MAX_LOOP_FILTER). | 286 // is equal to 0, and lvl is equal to its greatest value (MAX_LOOP_FILTER). |
| 286 // In this case block_inside_limit will be equal to MAX_LOOP_FILTER and | 287 // In this case block_inside_limit will be equal to MAX_LOOP_FILTER and |
| 287 // therefore mblim will be equal to (2 * (lvl + 2) + block_inside_limit) = | 288 // therefore mblim will be equal to (2 * (lvl + 2) + block_inside_limit) = |
| 288 // 2 * (MAX_LOOP_FILTER + 2) + MAX_LOOP_FILTER = 3 * MAX_LOOP_FILTER + 4 | 289 // 2 * (MAX_LOOP_FILTER + 2) + MAX_LOOP_FILTER = 3 * MAX_LOOP_FILTER + 4 |
| 289 | 290 |
| 290 for (int i = 0; i < count_test_block; ++i) { | 291 for (int i = 0; i < count_test_block; ++i) { |
| 291 int err_count = 0; | 292 int err_count = 0; |
| 292 uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4)); | 293 uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4)); |
| 293 DECLARE_ALIGNED(16, const uint8_t, blimit[16]) = { | 294 DECLARE_ALIGNED(16, const uint8_t, blimit[16]) = { |
| 294 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, | 295 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 295 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp | 296 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp |
| 296 }; | 297 }; |
| 297 tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER)); | 298 tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER)); |
| 298 DECLARE_ALIGNED(16, const uint8_t, limit[16]) = { | 299 DECLARE_ALIGNED(16, const uint8_t, limit[16]) = { |
| 299 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, | 300 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 300 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp | 301 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp |
| 301 }; | 302 }; |
| 302 tmp = rnd.Rand8(); | 303 tmp = rnd.Rand8(); |
| 303 DECLARE_ALIGNED(16, const uint8_t, thresh[16]) = { | 304 DECLARE_ALIGNED(16, const uint8_t, thresh[16]) = { |
| 304 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, | 305 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 305 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp | 306 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp |
| 306 }; | 307 }; |
| 307 int32_t p = kNumCoeffs / 32; | 308 int32_t p = kNumCoeffs / 32; |
| 308 int count = 1; | |
| 309 for (int j = 0; j < kNumCoeffs; ++j) { | 309 for (int j = 0; j < kNumCoeffs; ++j) { |
| 310 s[j] = rnd.Rand16() & mask_; | 310 s[j] = rnd.Rand16() & mask_; |
| 311 ref_s[j] = s[j]; | 311 ref_s[j] = s[j]; |
| 312 } | 312 } |
| 313 #if CONFIG_VP9_HIGHBITDEPTH | 313 #if CONFIG_VP9_HIGHBITDEPTH |
| 314 ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit, limit, thresh, count, bd); | 314 ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit, limit, thresh, count_, bd); |
| 315 ASM_REGISTER_STATE_CHECK( | 315 ASM_REGISTER_STATE_CHECK( |
| 316 loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, count, bd)); | 316 loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, count_, bd)); |
| 317 #else | 317 #else |
| 318 ref_loopfilter_op_(ref_s+8+p*8, p, blimit, limit, thresh, count); | 318 ref_loopfilter_op_(ref_s+8+p*8, p, blimit, limit, thresh, count_); |
| 319 ASM_REGISTER_STATE_CHECK( | 319 ASM_REGISTER_STATE_CHECK( |
| 320 loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, count)); | 320 loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, count_)); |
| 321 #endif // CONFIG_VP9_HIGHBITDEPTH | 321 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 322 for (int j = 0; j < kNumCoeffs; ++j) { | 322 for (int j = 0; j < kNumCoeffs; ++j) { |
| 323 err_count += ref_s[j] != s[j]; | 323 err_count += ref_s[j] != s[j]; |
| 324 } | 324 } |
| 325 if (err_count && !err_count_total) { | 325 if (err_count && !err_count_total) { |
| 326 first_failure = i; | 326 first_failure = i; |
| 327 } | 327 } |
| 328 err_count_total += err_count; | 328 err_count_total += err_count; |
| 329 } | 329 } |
| 330 EXPECT_EQ(0, err_count_total) | 330 EXPECT_EQ(0, err_count_total) |
| 331 << "Error: Loop8Test6Param, C output doesn't match SSE2 " | 331 << "Error: Loop8Test6Param, C output doesn't match SSE2 " |
| 332 "loopfilter output. " | 332 "loopfilter output. " |
| 333 << "First failed at test case " << first_failure; | 333 << "First failed at test case " << first_failure; |
| 334 } | 334 } |
| 335 | 335 |
| 336 TEST_P(Loop8Test9Param, OperationCheck) { | 336 TEST_P(Loop8Test9Param, OperationCheck) { |
| 337 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 337 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 338 const int count_test_block = number_of_iterations; | 338 const int count_test_block = number_of_iterations; |
| 339 #if CONFIG_VP9_HIGHBITDEPTH | 339 #if CONFIG_VP9_HIGHBITDEPTH |
| 340 const int32_t bd = bit_depth_; | 340 const int32_t bd = bit_depth_; |
| 341 DECLARE_ALIGNED_ARRAY(16, uint16_t, s, kNumCoeffs); | 341 DECLARE_ALIGNED(16, uint16_t, s[kNumCoeffs]); |
| 342 DECLARE_ALIGNED_ARRAY(16, uint16_t, ref_s, kNumCoeffs); | 342 DECLARE_ALIGNED(16, uint16_t, ref_s[kNumCoeffs]); |
| 343 #else | 343 #else |
| 344 DECLARE_ALIGNED_ARRAY(8, uint8_t, s, kNumCoeffs); | 344 DECLARE_ALIGNED(8, uint8_t, s[kNumCoeffs]); |
| 345 DECLARE_ALIGNED_ARRAY(8, uint8_t, ref_s, kNumCoeffs); | 345 DECLARE_ALIGNED(8, uint8_t, ref_s[kNumCoeffs]); |
| 346 #endif // CONFIG_VP9_HIGHBITDEPTH | 346 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 347 int err_count_total = 0; | 347 int err_count_total = 0; |
| 348 int first_failure = -1; | 348 int first_failure = -1; |
| 349 for (int i = 0; i < count_test_block; ++i) { | 349 for (int i = 0; i < count_test_block; ++i) { |
| 350 int err_count = 0; | 350 int err_count = 0; |
| 351 uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4)); | 351 uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4)); |
| 352 DECLARE_ALIGNED(16, const uint8_t, blimit0[16]) = { | 352 DECLARE_ALIGNED(16, const uint8_t, blimit0[16]) = { |
| 353 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, | 353 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 354 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp | 354 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp |
| 355 }; | 355 }; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 EXPECT_EQ(0, err_count_total) | 433 EXPECT_EQ(0, err_count_total) |
| 434 << "Error: Loop8Test9Param, C output doesn't match SSE2 " | 434 << "Error: Loop8Test9Param, C output doesn't match SSE2 " |
| 435 "loopfilter output. " | 435 "loopfilter output. " |
| 436 << "First failed at test case " << first_failure; | 436 << "First failed at test case " << first_failure; |
| 437 } | 437 } |
| 438 | 438 |
| 439 TEST_P(Loop8Test9Param, ValueCheck) { | 439 TEST_P(Loop8Test9Param, ValueCheck) { |
| 440 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 440 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 441 const int count_test_block = number_of_iterations; | 441 const int count_test_block = number_of_iterations; |
| 442 #if CONFIG_VP9_HIGHBITDEPTH | 442 #if CONFIG_VP9_HIGHBITDEPTH |
| 443 DECLARE_ALIGNED_ARRAY(16, uint16_t, s, kNumCoeffs); | 443 DECLARE_ALIGNED(16, uint16_t, s[kNumCoeffs]); |
| 444 DECLARE_ALIGNED_ARRAY(16, uint16_t, ref_s, kNumCoeffs); | 444 DECLARE_ALIGNED(16, uint16_t, ref_s[kNumCoeffs]); |
| 445 #else | 445 #else |
| 446 DECLARE_ALIGNED_ARRAY(8, uint8_t, s, kNumCoeffs); | 446 DECLARE_ALIGNED(8, uint8_t, s[kNumCoeffs]); |
| 447 DECLARE_ALIGNED_ARRAY(8, uint8_t, ref_s, kNumCoeffs); | 447 DECLARE_ALIGNED(8, uint8_t, ref_s[kNumCoeffs]); |
| 448 #endif // CONFIG_VP9_HIGHBITDEPTH | 448 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 449 int err_count_total = 0; | 449 int err_count_total = 0; |
| 450 int first_failure = -1; | 450 int first_failure = -1; |
| 451 for (int i = 0; i < count_test_block; ++i) { | 451 for (int i = 0; i < count_test_block; ++i) { |
| 452 int err_count = 0; | 452 int err_count = 0; |
| 453 uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4)); | 453 uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4)); |
| 454 DECLARE_ALIGNED(16, const uint8_t, blimit0[16]) = { | 454 DECLARE_ALIGNED(16, const uint8_t, blimit0[16]) = { |
| 455 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, | 455 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, |
| 456 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp | 456 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp |
| 457 }; | 457 }; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 } | 514 } |
| 515 | 515 |
| 516 using std::tr1::make_tuple; | 516 using std::tr1::make_tuple; |
| 517 | 517 |
| 518 #if HAVE_SSE2 | 518 #if HAVE_SSE2 |
| 519 #if CONFIG_VP9_HIGHBITDEPTH | 519 #if CONFIG_VP9_HIGHBITDEPTH |
| 520 INSTANTIATE_TEST_CASE_P( | 520 INSTANTIATE_TEST_CASE_P( |
| 521 SSE2, Loop8Test6Param, | 521 SSE2, Loop8Test6Param, |
| 522 ::testing::Values( | 522 ::testing::Values( |
| 523 make_tuple(&vp9_highbd_lpf_horizontal_4_sse2, | 523 make_tuple(&vp9_highbd_lpf_horizontal_4_sse2, |
| 524 &vp9_highbd_lpf_horizontal_4_c, 8), | 524 &vp9_highbd_lpf_horizontal_4_c, 8, 1), |
| 525 make_tuple(&vp9_highbd_lpf_vertical_4_sse2, | 525 make_tuple(&vp9_highbd_lpf_vertical_4_sse2, |
| 526 &vp9_highbd_lpf_vertical_4_c, 8), | 526 &vp9_highbd_lpf_vertical_4_c, 8, 1), |
| 527 make_tuple(&vp9_highbd_lpf_horizontal_8_sse2, | 527 make_tuple(&vp9_highbd_lpf_horizontal_8_sse2, |
| 528 &vp9_highbd_lpf_horizontal_8_c, 8), | 528 &vp9_highbd_lpf_horizontal_8_c, 8, 1), |
| 529 make_tuple(&vp9_highbd_lpf_horizontal_16_sse2, | 529 make_tuple(&vp9_highbd_lpf_horizontal_16_sse2, |
| 530 &vp9_highbd_lpf_horizontal_16_c, 8), | 530 &vp9_highbd_lpf_horizontal_16_c, 8, 1), |
| 531 make_tuple(&vp9_highbd_lpf_horizontal_16_sse2, |
| 532 &vp9_highbd_lpf_horizontal_16_c, 8, 2), |
| 531 make_tuple(&vp9_highbd_lpf_vertical_8_sse2, | 533 make_tuple(&vp9_highbd_lpf_vertical_8_sse2, |
| 532 &vp9_highbd_lpf_vertical_8_c, 8), | 534 &vp9_highbd_lpf_vertical_8_c, 8, 1), |
| 533 make_tuple(&wrapper_vertical_16_sse2, | 535 make_tuple(&wrapper_vertical_16_sse2, |
| 534 &wrapper_vertical_16_c, 8), | 536 &wrapper_vertical_16_c, 8, 1), |
| 535 make_tuple(&vp9_highbd_lpf_horizontal_4_sse2, | 537 make_tuple(&vp9_highbd_lpf_horizontal_4_sse2, |
| 536 &vp9_highbd_lpf_horizontal_4_c, 10), | 538 &vp9_highbd_lpf_horizontal_4_c, 10, 1), |
| 537 make_tuple(&vp9_highbd_lpf_vertical_4_sse2, | 539 make_tuple(&vp9_highbd_lpf_vertical_4_sse2, |
| 538 &vp9_highbd_lpf_vertical_4_c, 10), | 540 &vp9_highbd_lpf_vertical_4_c, 10, 1), |
| 539 make_tuple(&vp9_highbd_lpf_horizontal_8_sse2, | 541 make_tuple(&vp9_highbd_lpf_horizontal_8_sse2, |
| 540 &vp9_highbd_lpf_horizontal_8_c, 10), | 542 &vp9_highbd_lpf_horizontal_8_c, 10, 1), |
| 541 make_tuple(&vp9_highbd_lpf_horizontal_16_sse2, | 543 make_tuple(&vp9_highbd_lpf_horizontal_16_sse2, |
| 542 &vp9_highbd_lpf_horizontal_16_c, 10), | 544 &vp9_highbd_lpf_horizontal_16_c, 10, 1), |
| 545 make_tuple(&vp9_highbd_lpf_horizontal_16_sse2, |
| 546 &vp9_highbd_lpf_horizontal_16_c, 10, 2), |
| 543 make_tuple(&vp9_highbd_lpf_vertical_8_sse2, | 547 make_tuple(&vp9_highbd_lpf_vertical_8_sse2, |
| 544 &vp9_highbd_lpf_vertical_8_c, 10), | 548 &vp9_highbd_lpf_vertical_8_c, 10, 1), |
| 545 make_tuple(&wrapper_vertical_16_sse2, | 549 make_tuple(&wrapper_vertical_16_sse2, |
| 546 &wrapper_vertical_16_c, 10), | 550 &wrapper_vertical_16_c, 10, 1), |
| 547 make_tuple(&vp9_highbd_lpf_horizontal_4_sse2, | 551 make_tuple(&vp9_highbd_lpf_horizontal_4_sse2, |
| 548 &vp9_highbd_lpf_horizontal_4_c, 12), | 552 &vp9_highbd_lpf_horizontal_4_c, 12, 1), |
| 549 make_tuple(&vp9_highbd_lpf_vertical_4_sse2, | 553 make_tuple(&vp9_highbd_lpf_vertical_4_sse2, |
| 550 &vp9_highbd_lpf_vertical_4_c, 12), | 554 &vp9_highbd_lpf_vertical_4_c, 12, 1), |
| 551 make_tuple(&vp9_highbd_lpf_horizontal_8_sse2, | 555 make_tuple(&vp9_highbd_lpf_horizontal_8_sse2, |
| 552 &vp9_highbd_lpf_horizontal_8_c, 12), | 556 &vp9_highbd_lpf_horizontal_8_c, 12, 1), |
| 553 make_tuple(&vp9_highbd_lpf_horizontal_16_sse2, | 557 make_tuple(&vp9_highbd_lpf_horizontal_16_sse2, |
| 554 &vp9_highbd_lpf_horizontal_16_c, 12), | 558 &vp9_highbd_lpf_horizontal_16_c, 12, 1), |
| 559 make_tuple(&vp9_highbd_lpf_horizontal_16_sse2, |
| 560 &vp9_highbd_lpf_horizontal_16_c, 12, 2), |
| 555 make_tuple(&vp9_highbd_lpf_vertical_8_sse2, | 561 make_tuple(&vp9_highbd_lpf_vertical_8_sse2, |
| 556 &vp9_highbd_lpf_vertical_8_c, 12), | 562 &vp9_highbd_lpf_vertical_8_c, 12, 1), |
| 557 make_tuple(&wrapper_vertical_16_sse2, | 563 make_tuple(&wrapper_vertical_16_sse2, |
| 558 &wrapper_vertical_16_c, 12), | 564 &wrapper_vertical_16_c, 12, 1), |
| 559 make_tuple(&wrapper_vertical_16_dual_sse2, | 565 make_tuple(&wrapper_vertical_16_dual_sse2, |
| 560 &wrapper_vertical_16_dual_c, 8), | 566 &wrapper_vertical_16_dual_c, 8, 1), |
| 561 make_tuple(&wrapper_vertical_16_dual_sse2, | 567 make_tuple(&wrapper_vertical_16_dual_sse2, |
| 562 &wrapper_vertical_16_dual_c, 10), | 568 &wrapper_vertical_16_dual_c, 10, 1), |
| 563 make_tuple(&wrapper_vertical_16_dual_sse2, | 569 make_tuple(&wrapper_vertical_16_dual_sse2, |
| 564 &wrapper_vertical_16_dual_c, 12))); | 570 &wrapper_vertical_16_dual_c, 12, 1))); |
| 565 #else | 571 #else |
| 566 INSTANTIATE_TEST_CASE_P( | 572 INSTANTIATE_TEST_CASE_P( |
| 567 SSE2, Loop8Test6Param, | 573 SSE2, Loop8Test6Param, |
| 568 ::testing::Values( | 574 ::testing::Values( |
| 569 make_tuple(&vp9_lpf_horizontal_8_sse2, &vp9_lpf_horizontal_8_c, 8), | 575 make_tuple(&vp9_lpf_horizontal_8_sse2, &vp9_lpf_horizontal_8_c, 8, 1), |
| 570 make_tuple(&vp9_lpf_horizontal_16_sse2, &vp9_lpf_horizontal_16_c, 8), | 576 make_tuple(&vp9_lpf_horizontal_16_sse2, &vp9_lpf_horizontal_16_c, 8, 1), |
| 571 make_tuple(&vp9_lpf_vertical_8_sse2, &vp9_lpf_vertical_8_c, 8), | 577 make_tuple(&vp9_lpf_horizontal_16_sse2, &vp9_lpf_horizontal_16_c, 8, 2), |
| 572 make_tuple(&wrapper_vertical_16_sse2, &wrapper_vertical_16_c, 8))); | 578 make_tuple(&vp9_lpf_vertical_8_sse2, &vp9_lpf_vertical_8_c, 8, 1), |
| 579 make_tuple(&wrapper_vertical_16_sse2, &wrapper_vertical_16_c, 8, 1))); |
| 573 #endif // CONFIG_VP9_HIGHBITDEPTH | 580 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 574 #endif | 581 #endif |
| 575 | 582 |
| 576 #if HAVE_AVX2 && (!CONFIG_VP9_HIGHBITDEPTH) | 583 #if HAVE_AVX2 && (!CONFIG_VP9_HIGHBITDEPTH) |
| 577 INSTANTIATE_TEST_CASE_P( | 584 INSTANTIATE_TEST_CASE_P( |
| 578 AVX2, Loop8Test6Param, | 585 AVX2, Loop8Test6Param, |
| 579 ::testing::Values( | 586 ::testing::Values( |
| 580 make_tuple(&vp9_lpf_horizontal_16_avx2, &vp9_lpf_horizontal_16_c, 8))); | 587 make_tuple(&vp9_lpf_horizontal_16_avx2, &vp9_lpf_horizontal_16_c, 8, 1), |
| 588 make_tuple(&vp9_lpf_horizontal_16_avx2, &vp9_lpf_horizontal_16_c, 8, |
| 589 2))); |
| 581 #endif | 590 #endif |
| 582 | 591 |
| 583 #if HAVE_SSE2 | 592 #if HAVE_SSE2 |
| 584 #if CONFIG_VP9_HIGHBITDEPTH | 593 #if CONFIG_VP9_HIGHBITDEPTH |
| 585 INSTANTIATE_TEST_CASE_P( | 594 INSTANTIATE_TEST_CASE_P( |
| 586 SSE2, Loop8Test9Param, | 595 SSE2, Loop8Test9Param, |
| 587 ::testing::Values( | 596 ::testing::Values( |
| 588 make_tuple(&vp9_highbd_lpf_horizontal_4_dual_sse2, | 597 make_tuple(&vp9_highbd_lpf_horizontal_4_dual_sse2, |
| 589 &vp9_highbd_lpf_horizontal_4_dual_c, 8), | 598 &vp9_highbd_lpf_horizontal_4_dual_c, 8), |
| 590 make_tuple(&vp9_highbd_lpf_horizontal_8_dual_sse2, | 599 make_tuple(&vp9_highbd_lpf_horizontal_8_dual_sse2, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 #if CONFIG_VP9_HIGHBITDEPTH | 637 #if CONFIG_VP9_HIGHBITDEPTH |
| 629 // No neon high bitdepth functions. | 638 // No neon high bitdepth functions. |
| 630 #else | 639 #else |
| 631 INSTANTIATE_TEST_CASE_P( | 640 INSTANTIATE_TEST_CASE_P( |
| 632 NEON, Loop8Test6Param, | 641 NEON, Loop8Test6Param, |
| 633 ::testing::Values( | 642 ::testing::Values( |
| 634 #if HAVE_NEON_ASM | 643 #if HAVE_NEON_ASM |
| 635 // Using #if inside the macro is unsupported on MSVS but the tests are not | 644 // Using #if inside the macro is unsupported on MSVS but the tests are not |
| 636 // currently built for MSVS with ARM and NEON. | 645 // currently built for MSVS with ARM and NEON. |
| 637 make_tuple(&vp9_lpf_horizontal_16_neon, | 646 make_tuple(&vp9_lpf_horizontal_16_neon, |
| 638 &vp9_lpf_horizontal_16_c, 8), | 647 &vp9_lpf_horizontal_16_c, 8, 1), |
| 648 make_tuple(&vp9_lpf_horizontal_16_neon, |
| 649 &vp9_lpf_horizontal_16_c, 8, 2), |
| 639 make_tuple(&wrapper_vertical_16_neon, | 650 make_tuple(&wrapper_vertical_16_neon, |
| 640 &wrapper_vertical_16_c, 8), | 651 &wrapper_vertical_16_c, 8, 1), |
| 641 make_tuple(&wrapper_vertical_16_dual_neon, | 652 make_tuple(&wrapper_vertical_16_dual_neon, |
| 642 &wrapper_vertical_16_dual_c, 8), | 653 &wrapper_vertical_16_dual_c, 8, 1), |
| 643 make_tuple(&vp9_lpf_horizontal_8_neon, | 654 make_tuple(&vp9_lpf_horizontal_8_neon, |
| 644 &vp9_lpf_horizontal_8_c, 8), | 655 &vp9_lpf_horizontal_8_c, 8, 1), |
| 645 make_tuple(&vp9_lpf_vertical_8_neon, | 656 make_tuple(&vp9_lpf_vertical_8_neon, |
| 646 &vp9_lpf_vertical_8_c, 8), | 657 &vp9_lpf_vertical_8_c, 8, 1), |
| 647 #endif // HAVE_NEON_ASM | 658 #endif // HAVE_NEON_ASM |
| 648 make_tuple(&vp9_lpf_horizontal_4_neon, | 659 make_tuple(&vp9_lpf_horizontal_4_neon, |
| 649 &vp9_lpf_horizontal_4_c, 8), | 660 &vp9_lpf_horizontal_4_c, 8, 1), |
| 650 make_tuple(&vp9_lpf_vertical_4_neon, | 661 make_tuple(&vp9_lpf_vertical_4_neon, |
| 651 &vp9_lpf_vertical_4_c, 8))); | 662 &vp9_lpf_vertical_4_c, 8, 1))); |
| 652 INSTANTIATE_TEST_CASE_P( | 663 INSTANTIATE_TEST_CASE_P( |
| 653 NEON, Loop8Test9Param, | 664 NEON, Loop8Test9Param, |
| 654 ::testing::Values( | 665 ::testing::Values( |
| 655 #if HAVE_NEON_ASM | 666 #if HAVE_NEON_ASM |
| 656 make_tuple(&vp9_lpf_horizontal_8_dual_neon, | 667 make_tuple(&vp9_lpf_horizontal_8_dual_neon, |
| 657 &vp9_lpf_horizontal_8_dual_c, 8), | 668 &vp9_lpf_horizontal_8_dual_c, 8), |
| 658 make_tuple(&vp9_lpf_vertical_8_dual_neon, | 669 make_tuple(&vp9_lpf_vertical_8_dual_neon, |
| 659 &vp9_lpf_vertical_8_dual_c, 8), | 670 &vp9_lpf_vertical_8_dual_c, 8), |
| 660 #endif // HAVE_NEON_ASM | 671 #endif // HAVE_NEON_ASM |
| 661 make_tuple(&vp9_lpf_horizontal_4_dual_neon, | 672 make_tuple(&vp9_lpf_horizontal_4_dual_neon, |
| 662 &vp9_lpf_horizontal_4_dual_c, 8), | 673 &vp9_lpf_horizontal_4_dual_c, 8), |
| 663 make_tuple(&vp9_lpf_vertical_4_dual_neon, | 674 make_tuple(&vp9_lpf_vertical_4_dual_neon, |
| 664 &vp9_lpf_vertical_4_dual_c, 8))); | 675 &vp9_lpf_vertical_4_dual_c, 8))); |
| 665 #endif // CONFIG_VP9_HIGHBITDEPTH | 676 #endif // CONFIG_VP9_HIGHBITDEPTH |
| 666 #endif // HAVE_NEON | 677 #endif // HAVE_NEON |
| 667 | 678 |
| 668 } // namespace | 679 } // namespace |
| OLD | NEW |