| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs); | 72 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs); |
| 73 DECLARE_ALIGNED_ARRAY(16, uint8_t, src, kNumCoeffs); | 73 DECLARE_ALIGNED_ARRAY(16, uint8_t, src, kNumCoeffs); |
| 74 | 74 |
| 75 // Initialize a test block with input range [-255, 255]. | 75 // Initialize a test block with input range [-255, 255]. |
| 76 for (int j = 0; j < kNumCoeffs; ++j) { | 76 for (int j = 0; j < kNumCoeffs; ++j) { |
| 77 src[j] = rnd.Rand8(); | 77 src[j] = rnd.Rand8(); |
| 78 dst[j] = rnd.Rand8(); | 78 dst[j] = rnd.Rand8(); |
| 79 test_input_block[j] = src[j] - dst[j]; | 79 test_input_block[j] = src[j] - dst[j]; |
| 80 } | 80 } |
| 81 | 81 |
| 82 REGISTER_STATE_CHECK(RunFwdTxfm(test_input_block, | 82 ASM_REGISTER_STATE_CHECK(RunFwdTxfm(test_input_block, |
| 83 test_temp_block, pitch_)); | 83 test_temp_block, pitch_)); |
| 84 REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_)); | 84 ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_)); |
| 85 | 85 |
| 86 for (int j = 0; j < kNumCoeffs; ++j) { | 86 for (int j = 0; j < kNumCoeffs; ++j) { |
| 87 const uint32_t diff = dst[j] - src[j]; | 87 const uint32_t diff = dst[j] - src[j]; |
| 88 const uint32_t error = diff * diff; | 88 const uint32_t error = diff * diff; |
| 89 if (max_error < error) | 89 if (max_error < error) |
| 90 max_error = error; | 90 max_error = error; |
| 91 total_error += error; | 91 total_error += error; |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 107 DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs); | 107 DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs); |
| 108 DECLARE_ALIGNED_ARRAY(16, int16_t, output_ref_block, kNumCoeffs); | 108 DECLARE_ALIGNED_ARRAY(16, int16_t, output_ref_block, kNumCoeffs); |
| 109 DECLARE_ALIGNED_ARRAY(16, int16_t, output_block, kNumCoeffs); | 109 DECLARE_ALIGNED_ARRAY(16, int16_t, output_block, kNumCoeffs); |
| 110 | 110 |
| 111 for (int i = 0; i < count_test_block; ++i) { | 111 for (int i = 0; i < count_test_block; ++i) { |
| 112 // Initialize a test block with input range [-255, 255]. | 112 // Initialize a test block with input range [-255, 255]. |
| 113 for (int j = 0; j < kNumCoeffs; ++j) | 113 for (int j = 0; j < kNumCoeffs; ++j) |
| 114 input_block[j] = rnd.Rand8() - rnd.Rand8(); | 114 input_block[j] = rnd.Rand8() - rnd.Rand8(); |
| 115 | 115 |
| 116 fwd_txfm_ref(input_block, output_ref_block, pitch_, tx_type_); | 116 fwd_txfm_ref(input_block, output_ref_block, pitch_, tx_type_); |
| 117 REGISTER_STATE_CHECK(RunFwdTxfm(input_block, output_block, pitch_)); | 117 ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_block, output_block, pitch_)); |
| 118 | 118 |
| 119 // The minimum quant value is 4. | 119 // The minimum quant value is 4. |
| 120 for (int j = 0; j < kNumCoeffs; ++j) | 120 for (int j = 0; j < kNumCoeffs; ++j) |
| 121 EXPECT_EQ(output_block[j], output_ref_block[j]); | 121 EXPECT_EQ(output_block[j], output_ref_block[j]); |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 | 124 |
| 125 void RunMemCheck() { | 125 void RunMemCheck() { |
| 126 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 126 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 127 const int count_test_block = 5000; | 127 const int count_test_block = 5000; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 138 } | 138 } |
| 139 if (i == 0) { | 139 if (i == 0) { |
| 140 for (int j = 0; j < kNumCoeffs; ++j) | 140 for (int j = 0; j < kNumCoeffs; ++j) |
| 141 input_extreme_block[j] = 255; | 141 input_extreme_block[j] = 255; |
| 142 } else if (i == 1) { | 142 } else if (i == 1) { |
| 143 for (int j = 0; j < kNumCoeffs; ++j) | 143 for (int j = 0; j < kNumCoeffs; ++j) |
| 144 input_extreme_block[j] = -255; | 144 input_extreme_block[j] = -255; |
| 145 } | 145 } |
| 146 | 146 |
| 147 fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_); | 147 fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_); |
| 148 REGISTER_STATE_CHECK(RunFwdTxfm(input_extreme_block, | 148 ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_extreme_block, |
| 149 output_block, pitch_)); | 149 output_block, pitch_)); |
| 150 | 150 |
| 151 // The minimum quant value is 4. | 151 // The minimum quant value is 4. |
| 152 for (int j = 0; j < kNumCoeffs; ++j) { | 152 for (int j = 0; j < kNumCoeffs; ++j) { |
| 153 EXPECT_EQ(output_block[j], output_ref_block[j]); | 153 EXPECT_EQ(output_block[j], output_ref_block[j]); |
| 154 EXPECT_GE(4 * DCT_MAX_VALUE, abs(output_block[j])) | 154 EXPECT_GE(4 * DCT_MAX_VALUE, abs(output_block[j])) |
| 155 << "Error: 16x16 FDCT has coefficient larger than 4*DCT_MAX_VALUE"; | 155 << "Error: 16x16 FDCT has coefficient larger than 4*DCT_MAX_VALUE"; |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 | 159 |
| 160 void RunInvAccuracyCheck(int limit) { | 160 void RunInvAccuracyCheck(int limit) { |
| 161 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 161 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| 162 const int count_test_block = 1000; | 162 const int count_test_block = 1000; |
| 163 DECLARE_ALIGNED_ARRAY(16, int16_t, in, kNumCoeffs); | 163 DECLARE_ALIGNED_ARRAY(16, int16_t, in, kNumCoeffs); |
| 164 DECLARE_ALIGNED_ARRAY(16, int16_t, coeff, kNumCoeffs); | 164 DECLARE_ALIGNED_ARRAY(16, int16_t, coeff, kNumCoeffs); |
| 165 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs); | 165 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs); |
| 166 DECLARE_ALIGNED_ARRAY(16, uint8_t, src, kNumCoeffs); | 166 DECLARE_ALIGNED_ARRAY(16, uint8_t, src, kNumCoeffs); |
| 167 | 167 |
| 168 for (int i = 0; i < count_test_block; ++i) { | 168 for (int i = 0; i < count_test_block; ++i) { |
| 169 // Initialize a test block with input range [-255, 255]. | 169 // Initialize a test block with input range [-255, 255]. |
| 170 for (int j = 0; j < kNumCoeffs; ++j) { | 170 for (int j = 0; j < kNumCoeffs; ++j) { |
| 171 src[j] = rnd.Rand8(); | 171 src[j] = rnd.Rand8(); |
| 172 dst[j] = rnd.Rand8(); | 172 dst[j] = rnd.Rand8(); |
| 173 in[j] = src[j] - dst[j]; | 173 in[j] = src[j] - dst[j]; |
| 174 } | 174 } |
| 175 | 175 |
| 176 fwd_txfm_ref(in, coeff, pitch_, tx_type_); | 176 fwd_txfm_ref(in, coeff, pitch_, tx_type_); |
| 177 | 177 |
| 178 REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_)); | 178 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_)); |
| 179 | 179 |
| 180 for (int j = 0; j < kNumCoeffs; ++j) { | 180 for (int j = 0; j < kNumCoeffs; ++j) { |
| 181 const uint32_t diff = dst[j] - src[j]; | 181 const uint32_t diff = dst[j] - src[j]; |
| 182 const uint32_t error = diff * diff; | 182 const uint32_t error = diff * diff; |
| 183 EXPECT_GE(static_cast<uint32_t>(limit), error) | 183 EXPECT_GE(static_cast<uint32_t>(limit), error) |
| 184 << "Error: 4x4 IDCT has error " << error | 184 << "Error: 4x4 IDCT has error " << error |
| 185 << " at index " << j; | 185 << " at index " << j; |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 } | 188 } |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 INSTANTIATE_TEST_CASE_P( | 385 INSTANTIATE_TEST_CASE_P( |
| 386 AVX2, Trans4x4HT, | 386 AVX2, Trans4x4HT, |
| 387 ::testing::Values( | 387 ::testing::Values( |
| 388 make_tuple(&vp9_fht4x4_avx2, &vp9_iht4x4_16_add_c, 0), | 388 make_tuple(&vp9_fht4x4_avx2, &vp9_iht4x4_16_add_c, 0), |
| 389 make_tuple(&vp9_fht4x4_avx2, &vp9_iht4x4_16_add_c, 1), | 389 make_tuple(&vp9_fht4x4_avx2, &vp9_iht4x4_16_add_c, 1), |
| 390 make_tuple(&vp9_fht4x4_avx2, &vp9_iht4x4_16_add_c, 2), | 390 make_tuple(&vp9_fht4x4_avx2, &vp9_iht4x4_16_add_c, 2), |
| 391 make_tuple(&vp9_fht4x4_avx2, &vp9_iht4x4_16_add_c, 3))); | 391 make_tuple(&vp9_fht4x4_avx2, &vp9_iht4x4_16_add_c, 3))); |
| 392 #endif | 392 #endif |
| 393 | 393 |
| 394 } // namespace | 394 } // namespace |
| OLD | NEW |