| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 : public SADTestBase, | 142 : public SADTestBase, |
| 143 public ::testing::WithParamInterface<sad_n_by_n_by_4_test_param_t> { | 143 public ::testing::WithParamInterface<sad_n_by_n_by_4_test_param_t> { |
| 144 public: | 144 public: |
| 145 SADx4Test() : SADTestBase(GET_PARAM(0), GET_PARAM(1)) {} | 145 SADx4Test() : SADTestBase(GET_PARAM(0), GET_PARAM(1)) {} |
| 146 | 146 |
| 147 protected: | 147 protected: |
| 148 void SADs(unsigned int *results) { | 148 void SADs(unsigned int *results) { |
| 149 const uint8_t* refs[] = {GetReference(0), GetReference(1), | 149 const uint8_t* refs[] = {GetReference(0), GetReference(1), |
| 150 GetReference(2), GetReference(3)}; | 150 GetReference(2), GetReference(3)}; |
| 151 | 151 |
| 152 REGISTER_STATE_CHECK(GET_PARAM(2)(source_data_, source_stride_, | 152 ASM_REGISTER_STATE_CHECK(GET_PARAM(2)(source_data_, source_stride_, |
| 153 refs, reference_stride_, | 153 refs, reference_stride_, |
| 154 results)); | 154 results)); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void CheckSADs() { | 157 void CheckSADs() { |
| 158 unsigned int reference_sad, exp_sad[4]; | 158 unsigned int reference_sad, exp_sad[4]; |
| 159 | 159 |
| 160 SADs(exp_sad); | 160 SADs(exp_sad); |
| 161 for (int block = 0; block < 4; ++block) { | 161 for (int block = 0; block < 4; ++block) { |
| 162 reference_sad = ReferenceSAD(UINT_MAX, block); | 162 reference_sad = ReferenceSAD(UINT_MAX, block); |
| 163 | 163 |
| 164 EXPECT_EQ(reference_sad, exp_sad[block]) << "block " << block; | 164 EXPECT_EQ(reference_sad, exp_sad[block]) << "block " << block; |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 #if CONFIG_VP8_ENCODER | 169 #if CONFIG_VP8_ENCODER |
| 170 class SADTest | 170 class SADTest |
| 171 : public SADTestBase, | 171 : public SADTestBase, |
| 172 public ::testing::WithParamInterface<sad_m_by_n_test_param_t> { | 172 public ::testing::WithParamInterface<sad_m_by_n_test_param_t> { |
| 173 public: | 173 public: |
| 174 SADTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1)) {} | 174 SADTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1)) {} |
| 175 | 175 |
| 176 protected: | 176 protected: |
| 177 unsigned int SAD(unsigned int max_sad, int block_idx) { | 177 unsigned int SAD(unsigned int max_sad, int block_idx) { |
| 178 unsigned int ret; | 178 unsigned int ret; |
| 179 const uint8_t* const reference = GetReference(block_idx); | 179 const uint8_t* const reference = GetReference(block_idx); |
| 180 | 180 |
| 181 REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_, | 181 ASM_REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_, |
| 182 reference, reference_stride_, | 182 reference, reference_stride_, |
| 183 max_sad)); | 183 max_sad)); |
| 184 return ret; | 184 return ret; |
| 185 } | 185 } |
| 186 | 186 |
| 187 void CheckSAD(unsigned int max_sad) { | 187 void CheckSAD(unsigned int max_sad) { |
| 188 const unsigned int reference_sad = ReferenceSAD(max_sad, 0); | 188 const unsigned int reference_sad = ReferenceSAD(max_sad, 0); |
| 189 const unsigned int exp_sad = SAD(max_sad, 0); | 189 const unsigned int exp_sad = SAD(max_sad, 0); |
| 190 | 190 |
| 191 if (reference_sad <= max_sad) { | 191 if (reference_sad <= max_sad) { |
| 192 ASSERT_EQ(exp_sad, reference_sad); | 192 ASSERT_EQ(exp_sad, reference_sad); |
| 193 } else { | 193 } else { |
| 194 // Alternative implementations are not required to check max_sad | 194 // Alternative implementations are not required to check max_sad |
| 195 ASSERT_GE(exp_sad, reference_sad); | 195 ASSERT_GE(exp_sad, reference_sad); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 }; | 198 }; |
| 199 #endif // CONFIG_VP8_ENCODER | 199 #endif // CONFIG_VP8_ENCODER |
| 200 | 200 |
| 201 #if CONFIG_VP9_ENCODER | 201 #if CONFIG_VP9_ENCODER |
| 202 class SADVP9Test | 202 class SADVP9Test |
| 203 : public SADTestBase, | 203 : public SADTestBase, |
| 204 public ::testing::WithParamInterface<sad_m_by_n_test_param_vp9_t> { | 204 public ::testing::WithParamInterface<sad_m_by_n_test_param_vp9_t> { |
| 205 public: | 205 public: |
| 206 SADVP9Test() : SADTestBase(GET_PARAM(0), GET_PARAM(1)) {} | 206 SADVP9Test() : SADTestBase(GET_PARAM(0), GET_PARAM(1)) {} |
| 207 | 207 |
| 208 protected: | 208 protected: |
| 209 unsigned int SAD(int block_idx) { | 209 unsigned int SAD(int block_idx) { |
| 210 unsigned int ret; | 210 unsigned int ret; |
| 211 const uint8_t* const reference = GetReference(block_idx); | 211 const uint8_t* const reference = GetReference(block_idx); |
| 212 | 212 |
| 213 REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_, | 213 ASM_REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_, |
| 214 reference, reference_stride_)); | 214 reference, reference_stride_)); |
| 215 return ret; | 215 return ret; |
| 216 } | 216 } |
| 217 | 217 |
| 218 void CheckSAD() { | 218 void CheckSAD() { |
| 219 const unsigned int reference_sad = ReferenceSAD(UINT_MAX, 0); | 219 const unsigned int reference_sad = ReferenceSAD(UINT_MAX, 0); |
| 220 const unsigned int exp_sad = SAD(0); | 220 const unsigned int exp_sad = SAD(0); |
| 221 | 221 |
| 222 ASSERT_EQ(reference_sad, exp_sad); | 222 ASSERT_EQ(reference_sad, exp_sad); |
| 223 } | 223 } |
| 224 }; | 224 }; |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 } | 641 } |
| 642 const sad_n_by_n_by_4_fn_t sad_64x64x4d_avx2 = vp9_sad64x64x4d_avx2; | 642 const sad_n_by_n_by_4_fn_t sad_64x64x4d_avx2 = vp9_sad64x64x4d_avx2; |
| 643 const sad_n_by_n_by_4_fn_t sad_32x32x4d_avx2 = vp9_sad32x32x4d_avx2; | 643 const sad_n_by_n_by_4_fn_t sad_32x32x4d_avx2 = vp9_sad32x32x4d_avx2; |
| 644 INSTANTIATE_TEST_CASE_P(DISABLED_AVX2, SADx4Test, ::testing::Values( | 644 INSTANTIATE_TEST_CASE_P(DISABLED_AVX2, SADx4Test, ::testing::Values( |
| 645 make_tuple(32, 32, sad_32x32x4d_avx2), | 645 make_tuple(32, 32, sad_32x32x4d_avx2), |
| 646 make_tuple(64, 64, sad_64x64x4d_avx2))); | 646 make_tuple(64, 64, sad_64x64x4d_avx2))); |
| 647 #endif // CONFIG_VP9_ENCODER | 647 #endif // CONFIG_VP9_ENCODER |
| 648 #endif // HAVE_AVX2 | 648 #endif // HAVE_AVX2 |
| 649 | 649 |
| 650 } // namespace | 650 } // namespace |
| OLD | NEW |