Geza Lore | a661bc8 | 2016-05-20 16:33:12 +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 | a661bc8 | 2016-05-20 16:33:12 +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 | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #include <math.h> |
| 13 | #include <stdlib.h> |
| 14 | #include <string.h> |
| 15 | |
Tom Finegan | 7a07ece | 2017-02-07 17:14:05 -0800 | [diff] [blame] | 16 | #include "third_party/googletest/src/googletest/include/gtest/gtest.h" |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 17 | #include "test/register_state_check.h" |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 18 | #include "test/function_equivalence_test.h" |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 19 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 20 | #include "./aom_config.h" |
| 21 | #include "./aom_dsp_rtcd.h" |
| 22 | #include "aom/aom_integer.h" |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 23 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 24 | #include "./av1_rtcd.h" |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 25 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 26 | #include "av1/common/enums.h" |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 27 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 28 | #include "aom_dsp/blend.h" |
Geza Lore | bfa59b4 | 2016-07-11 12:43:47 +0100 | [diff] [blame] | 29 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 30 | using libaom_test::FunctionEquivalenceTest; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 31 | |
| 32 | namespace { |
| 33 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 34 | template <typename F, typename T> |
Geza Lore | bfa59b4 | 2016-07-11 12:43:47 +0100 | [diff] [blame] | 35 | class BlendA64MaskTest : public FunctionEquivalenceTest<F> { |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 36 | protected: |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 37 | static const int kIterations = 10000; |
| 38 | static const int kMaxWidth = MAX_SB_SIZE * 5; // * 5 to cover longer strides |
| 39 | static const int kMaxHeight = MAX_SB_SIZE; |
| 40 | static const int kBufSize = kMaxWidth * kMaxHeight; |
| 41 | static const int kMaxMaskWidth = 2 * MAX_SB_SIZE; |
| 42 | static const int kMaxMaskSize = kMaxMaskWidth * kMaxMaskWidth; |
| 43 | |
Geza Lore | bfa59b4 | 2016-07-11 12:43:47 +0100 | [diff] [blame] | 44 | virtual ~BlendA64MaskTest() {} |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 45 | |
Geza Lore | bfa59b4 | 2016-07-11 12:43:47 +0100 | [diff] [blame] | 46 | virtual void Execute(const T *p_src0, const T *p_src1) = 0; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 47 | |
| 48 | void Common() { |
Geza Lore | a3f7ddc | 2016-07-12 15:26:36 +0100 | [diff] [blame] | 49 | w_ = 1 << this->rng_(MAX_SB_SIZE_LOG2 + 1); |
| 50 | h_ = 1 << this->rng_(MAX_SB_SIZE_LOG2 + 1); |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 51 | |
Geza Lore | a3f7ddc | 2016-07-12 15:26:36 +0100 | [diff] [blame] | 52 | subx_ = this->rng_(2); |
| 53 | suby_ = this->rng_(2); |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 54 | |
Geza Lore | a3f7ddc | 2016-07-12 15:26:36 +0100 | [diff] [blame] | 55 | dst_offset_ = this->rng_(33); |
| 56 | dst_stride_ = this->rng_(kMaxWidth + 1 - w_) + w_; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 57 | |
Geza Lore | a3f7ddc | 2016-07-12 15:26:36 +0100 | [diff] [blame] | 58 | src0_offset_ = this->rng_(33); |
| 59 | src0_stride_ = this->rng_(kMaxWidth + 1 - w_) + w_; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 60 | |
Geza Lore | a3f7ddc | 2016-07-12 15:26:36 +0100 | [diff] [blame] | 61 | src1_offset_ = this->rng_(33); |
| 62 | src1_stride_ = this->rng_(kMaxWidth + 1 - w_) + w_; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 63 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 64 | mask_stride_ = |
| 65 | this->rng_(kMaxWidth + 1 - w_ * (subx_ ? 2 : 1)) + w_ * (subx_ ? 2 : 1); |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 66 | |
| 67 | T *p_src0; |
| 68 | T *p_src1; |
| 69 | |
Geza Lore | a3f7ddc | 2016-07-12 15:26:36 +0100 | [diff] [blame] | 70 | switch (this->rng_(3)) { |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 71 | case 0: // Separate sources |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 72 | p_src0 = src0_; |
| 73 | p_src1 = src1_; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 74 | break; |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 75 | case 1: // src0 == dst |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 76 | p_src0 = dst_tst_; |
| 77 | src0_stride_ = dst_stride_; |
| 78 | src0_offset_ = dst_offset_; |
| 79 | p_src1 = src1_; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 80 | break; |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 81 | case 2: // src1 == dst |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 82 | p_src0 = src0_; |
| 83 | p_src1 = dst_tst_; |
| 84 | src1_stride_ = dst_stride_; |
| 85 | src1_offset_ = dst_offset_; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 86 | break; |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 87 | default: FAIL(); |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 88 | } |
| 89 | |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 90 | Execute(p_src0, p_src1); |
| 91 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 92 | for (int r = 0; r < h_; ++r) { |
| 93 | for (int c = 0; c < w_; ++c) { |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 94 | ASSERT_EQ(dst_ref_[dst_offset_ + r * dst_stride_ + c], |
| 95 | dst_tst_[dst_offset_ + r * dst_stride_ + c]); |
| 96 | } |
| 97 | } |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 98 | } |
| 99 | |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 100 | T dst_ref_[kBufSize]; |
| 101 | T dst_tst_[kBufSize]; |
Jingning Han | 91ae5d9 | 2016-08-26 11:24:36 -0700 | [diff] [blame] | 102 | uint32_t dst_stride_; |
| 103 | uint32_t dst_offset_; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 104 | |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 105 | T src0_[kBufSize]; |
Jingning Han | 91ae5d9 | 2016-08-26 11:24:36 -0700 | [diff] [blame] | 106 | uint32_t src0_stride_; |
| 107 | uint32_t src0_offset_; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 108 | |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 109 | T src1_[kBufSize]; |
Jingning Han | 91ae5d9 | 2016-08-26 11:24:36 -0700 | [diff] [blame] | 110 | uint32_t src1_stride_; |
| 111 | uint32_t src1_offset_; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 112 | |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 113 | uint8_t mask_[kMaxMaskSize]; |
| 114 | size_t mask_stride_; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 115 | |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 116 | int w_; |
| 117 | int h_; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 118 | |
Jingning Han | 91ae5d9 | 2016-08-26 11:24:36 -0700 | [diff] [blame] | 119 | int suby_; |
| 120 | int subx_; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 121 | }; |
| 122 | |
| 123 | ////////////////////////////////////////////////////////////////////////////// |
| 124 | // 8 bit version |
| 125 | ////////////////////////////////////////////////////////////////////////////// |
| 126 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 127 | typedef void (*F8B)(uint8_t *dst, uint32_t dst_stride, const uint8_t *src0, |
| 128 | uint32_t src0_stride, const uint8_t *src1, |
| 129 | uint32_t src1_stride, const uint8_t *mask, |
| 130 | uint32_t mask_stride, int h, int w, int suby, int subx); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 131 | typedef libaom_test::FuncParam<F8B> TestFuncs; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 132 | |
Geza Lore | bfa59b4 | 2016-07-11 12:43:47 +0100 | [diff] [blame] | 133 | class BlendA64MaskTest8B : public BlendA64MaskTest<F8B, uint8_t> { |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 134 | protected: |
Geza Lore | bfa59b4 | 2016-07-11 12:43:47 +0100 | [diff] [blame] | 135 | void Execute(const uint8_t *p_src0, const uint8_t *p_src1) { |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 136 | params_.ref_func(dst_ref_ + dst_offset_, dst_stride_, p_src0 + src0_offset_, |
| 137 | src0_stride_, p_src1 + src1_offset_, src1_stride_, mask_, |
| 138 | kMaxMaskWidth, h_, w_, suby_, subx_); |
| 139 | ASM_REGISTER_STATE_CHECK(params_.tst_func( |
| 140 | dst_tst_ + dst_offset_, dst_stride_, p_src0 + src0_offset_, |
| 141 | src0_stride_, p_src1 + src1_offset_, src1_stride_, mask_, kMaxMaskWidth, |
| 142 | h_, w_, suby_, subx_)); |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 143 | } |
| 144 | }; |
| 145 | |
Geza Lore | bfa59b4 | 2016-07-11 12:43:47 +0100 | [diff] [blame] | 146 | TEST_P(BlendA64MaskTest8B, RandomValues) { |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 147 | for (int iter = 0; iter < kIterations && !HasFatalFailure(); ++iter) { |
| 148 | for (int i = 0; i < kBufSize; ++i) { |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 149 | dst_ref_[i] = rng_.Rand8(); |
| 150 | dst_tst_[i] = rng_.Rand8(); |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 151 | |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 152 | src0_[i] = rng_.Rand8(); |
| 153 | src1_[i] = rng_.Rand8(); |
| 154 | } |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 155 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 156 | for (int i = 0; i < kMaxMaskSize; ++i) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 157 | mask_[i] = rng_(AOM_BLEND_A64_MAX_ALPHA + 1); |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 158 | |
| 159 | Common(); |
| 160 | } |
| 161 | } |
| 162 | |
Geza Lore | bfa59b4 | 2016-07-11 12:43:47 +0100 | [diff] [blame] | 163 | TEST_P(BlendA64MaskTest8B, ExtremeValues) { |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 164 | for (int iter = 0; iter < kIterations && !HasFatalFailure(); ++iter) { |
| 165 | for (int i = 0; i < kBufSize; ++i) { |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 166 | dst_ref_[i] = rng_(2) + 254; |
| 167 | dst_tst_[i] = rng_(2) + 254; |
| 168 | src0_[i] = rng_(2) + 254; |
| 169 | src1_[i] = rng_(2) + 254; |
| 170 | } |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 171 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 172 | for (int i = 0; i < kMaxMaskSize; ++i) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 173 | mask_[i] = rng_(2) + AOM_BLEND_A64_MAX_ALPHA - 1; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 174 | |
| 175 | Common(); |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | #if HAVE_SSE4_1 |
Yaowu Xu | 685039d | 2016-12-07 10:56:39 -0800 | [diff] [blame] | 180 | INSTANTIATE_TEST_CASE_P(SSE4_1, BlendA64MaskTest8B, |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 181 | ::testing::Values(TestFuncs( |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 182 | aom_blend_a64_mask_c, aom_blend_a64_mask_sse4_1))); |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 183 | #endif // HAVE_SSE4_1 |
| 184 | |
Sebastien Alaiwan | 71e8784 | 2017-04-12 16:03:28 +0200 | [diff] [blame] | 185 | #if CONFIG_HIGHBITDEPTH |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 186 | ////////////////////////////////////////////////////////////////////////////// |
| 187 | // High bit-depth version |
| 188 | ////////////////////////////////////////////////////////////////////////////// |
| 189 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 190 | typedef void (*FHBD)(uint8_t *dst, uint32_t dst_stride, const uint8_t *src0, |
| 191 | uint32_t src0_stride, const uint8_t *src1, |
| 192 | uint32_t src1_stride, const uint8_t *mask, |
| 193 | uint32_t mask_stride, int h, int w, int suby, int subx, |
| 194 | int bd); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 195 | typedef libaom_test::FuncParam<FHBD> TestFuncsHBD; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 196 | |
Geza Lore | bfa59b4 | 2016-07-11 12:43:47 +0100 | [diff] [blame] | 197 | class BlendA64MaskTestHBD : public BlendA64MaskTest<FHBD, uint16_t> { |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 198 | protected: |
Geza Lore | bfa59b4 | 2016-07-11 12:43:47 +0100 | [diff] [blame] | 199 | void Execute(const uint16_t *p_src0, const uint16_t *p_src1) { |
Geza Lore | a3f7ddc | 2016-07-12 15:26:36 +0100 | [diff] [blame] | 200 | params_.ref_func(CONVERT_TO_BYTEPTR(dst_ref_ + dst_offset_), dst_stride_, |
| 201 | CONVERT_TO_BYTEPTR(p_src0 + src0_offset_), src0_stride_, |
| 202 | CONVERT_TO_BYTEPTR(p_src1 + src1_offset_), src1_stride_, |
| 203 | mask_, kMaxMaskWidth, h_, w_, suby_, subx_, bit_depth_); |
| 204 | ASM_REGISTER_STATE_CHECK(params_.tst_func( |
| 205 | CONVERT_TO_BYTEPTR(dst_tst_ + dst_offset_), dst_stride_, |
| 206 | CONVERT_TO_BYTEPTR(p_src0 + src0_offset_), src0_stride_, |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 207 | CONVERT_TO_BYTEPTR(p_src1 + src1_offset_), src1_stride_, mask_, |
| 208 | kMaxMaskWidth, h_, w_, suby_, subx_, bit_depth_)); |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 209 | } |
| 210 | |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 211 | int bit_depth_; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 212 | }; |
| 213 | |
Geza Lore | bfa59b4 | 2016-07-11 12:43:47 +0100 | [diff] [blame] | 214 | TEST_P(BlendA64MaskTestHBD, RandomValues) { |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 215 | for (int iter = 0; iter < kIterations && !HasFatalFailure(); ++iter) { |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 216 | switch (rng_(3)) { |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 217 | case 0: bit_depth_ = 8; break; |
| 218 | case 1: bit_depth_ = 10; break; |
| 219 | default: bit_depth_ = 12; break; |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 220 | } |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 221 | |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 222 | const int hi = 1 << bit_depth_; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 223 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 224 | for (int i = 0; i < kBufSize; ++i) { |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 225 | dst_ref_[i] = rng_(hi); |
| 226 | dst_tst_[i] = rng_(hi); |
| 227 | src0_[i] = rng_(hi); |
| 228 | src1_[i] = rng_(hi); |
| 229 | } |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 230 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 231 | for (int i = 0; i < kMaxMaskSize; ++i) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 232 | mask_[i] = rng_(AOM_BLEND_A64_MAX_ALPHA + 1); |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 233 | |
| 234 | Common(); |
| 235 | } |
| 236 | } |
| 237 | |
Geza Lore | bfa59b4 | 2016-07-11 12:43:47 +0100 | [diff] [blame] | 238 | TEST_P(BlendA64MaskTestHBD, ExtremeValues) { |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 239 | for (int iter = 0; iter < 1000 && !HasFatalFailure(); ++iter) { |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 240 | switch (rng_(3)) { |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 241 | case 0: bit_depth_ = 8; break; |
| 242 | case 1: bit_depth_ = 10; break; |
| 243 | default: bit_depth_ = 12; break; |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 244 | } |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 245 | |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 246 | const int hi = 1 << bit_depth_; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 247 | const int lo = hi - 2; |
| 248 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 249 | for (int i = 0; i < kBufSize; ++i) { |
Geza Lore | e6f8c17 | 2016-07-06 15:54:29 +0100 | [diff] [blame] | 250 | dst_ref_[i] = rng_(hi - lo) + lo; |
| 251 | dst_tst_[i] = rng_(hi - lo) + lo; |
| 252 | src0_[i] = rng_(hi - lo) + lo; |
| 253 | src1_[i] = rng_(hi - lo) + lo; |
| 254 | } |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 255 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 256 | for (int i = 0; i < kMaxMaskSize; ++i) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 257 | mask_[i] = rng_(2) + AOM_BLEND_A64_MAX_ALPHA - 1; |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 258 | |
| 259 | Common(); |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | #if HAVE_SSE4_1 |
| 264 | INSTANTIATE_TEST_CASE_P( |
Yaowu Xu | 685039d | 2016-12-07 10:56:39 -0800 | [diff] [blame] | 265 | SSE4_1, BlendA64MaskTestHBD, |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 266 | ::testing::Values(TestFuncsHBD(aom_highbd_blend_a64_mask_c, |
| 267 | aom_highbd_blend_a64_mask_sse4_1))); |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 268 | #endif // HAVE_SSE4_1 |
Sebastien Alaiwan | 71e8784 | 2017-04-12 16:03:28 +0200 | [diff] [blame] | 269 | #endif // CONFIG_HIGHBITDEPTH |
Geza Lore | a661bc8 | 2016-05-20 16:33:12 +0100 | [diff] [blame] | 270 | } // namespace |