Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(744)

Side by Side Diff: source/libvpx/test/fdct8x8_test.cc

Issue 341293003: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/test/fdct4x4_test.cc ('k') | source/libvpx/test/partial_idct_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 EXPECT_GE(count_test_block/5, total_error) 171 EXPECT_GE(count_test_block/5, total_error)
172 << "Error: 8x8 FDCT/IDCT or FHT/IHT has average roundtrip " 172 << "Error: 8x8 FDCT/IDCT or FHT/IHT has average roundtrip "
173 << "error > 1/5 per block"; 173 << "error > 1/5 per block";
174 } 174 }
175 175
176 void RunExtremalCheck() { 176 void RunExtremalCheck() {
177 ACMRandom rnd(ACMRandom::DeterministicSeed()); 177 ACMRandom rnd(ACMRandom::DeterministicSeed());
178 int max_error = 0; 178 int max_error = 0;
179 int total_error = 0; 179 int total_error = 0;
180 int total_coeff_error = 0;
180 const int count_test_block = 100000; 181 const int count_test_block = 100000;
181 DECLARE_ALIGNED_ARRAY(16, int16_t, test_input_block, 64); 182 DECLARE_ALIGNED_ARRAY(16, int16_t, test_input_block, 64);
182 DECLARE_ALIGNED_ARRAY(16, int16_t, test_temp_block, 64); 183 DECLARE_ALIGNED_ARRAY(16, int16_t, test_temp_block, 64);
184 DECLARE_ALIGNED_ARRAY(16, int16_t, ref_temp_block, 64);
183 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, 64); 185 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, 64);
184 DECLARE_ALIGNED_ARRAY(16, uint8_t, src, 64); 186 DECLARE_ALIGNED_ARRAY(16, uint8_t, src, 64);
185 187
186 for (int i = 0; i < count_test_block; ++i) { 188 for (int i = 0; i < count_test_block; ++i) {
187 // Initialize a test block with input range [-255, 255]. 189 // Initialize a test block with input range [-255, 255].
188 for (int j = 0; j < 64; ++j) { 190 for (int j = 0; j < 64; ++j) {
189 src[j] = rnd.Rand8() % 2 ? 255 : 0; 191 if (i == 0) {
190 dst[j] = src[j] > 0 ? 0 : 255; 192 src[j] = 255;
193 dst[j] = 0;
194 } else if (i == 1) {
195 src[j] = 0;
196 dst[j] = 255;
197 } else {
198 src[j] = rnd.Rand8() % 2 ? 255 : 0;
199 dst[j] = rnd.Rand8() % 2 ? 255 : 0;
200 }
201
191 test_input_block[j] = src[j] - dst[j]; 202 test_input_block[j] = src[j] - dst[j];
192 } 203 }
193 204
194 REGISTER_STATE_CHECK( 205 REGISTER_STATE_CHECK(
195 RunFwdTxfm(test_input_block, test_temp_block, pitch_)); 206 RunFwdTxfm(test_input_block, test_temp_block, pitch_));
196 REGISTER_STATE_CHECK( 207 REGISTER_STATE_CHECK(
208 fwd_txfm_ref(test_input_block, ref_temp_block, pitch_, tx_type_));
209 REGISTER_STATE_CHECK(
197 RunInvTxfm(test_temp_block, dst, pitch_)); 210 RunInvTxfm(test_temp_block, dst, pitch_));
198 211
199 for (int j = 0; j < 64; ++j) { 212 for (int j = 0; j < 64; ++j) {
200 const int diff = dst[j] - src[j]; 213 const int diff = dst[j] - src[j];
201 const int error = diff * diff; 214 const int error = diff * diff;
202 if (max_error < error) 215 if (max_error < error)
203 max_error = error; 216 max_error = error;
204 total_error += error; 217 total_error += error;
218
219 const int coeff_diff = test_temp_block[j] - ref_temp_block[j];
220 total_coeff_error += abs(coeff_diff);
205 } 221 }
206 222
207 EXPECT_GE(1, max_error) 223 EXPECT_GE(1, max_error)
208 << "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has" 224 << "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has"
209 << "an individual roundtrip error > 1"; 225 << "an individual roundtrip error > 1";
210 226
211 EXPECT_GE(count_test_block/5, total_error) 227 EXPECT_GE(count_test_block/5, total_error)
212 << "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has average" 228 << "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has average"
213 << " roundtrip error > 1/5 per block"; 229 << " roundtrip error > 1/5 per block";
230
231 EXPECT_EQ(0, total_coeff_error)
232 << "Error: Extremal 8x8 FDCT/FHT has"
233 << "overflow issues in the intermediate steps > 1";
214 } 234 }
215 } 235 }
216 236
217 int pitch_; 237 int pitch_;
218 int tx_type_; 238 int tx_type_;
219 fht_t fwd_txfm_ref; 239 fht_t fwd_txfm_ref;
220 }; 240 };
221 241
222 class FwdTrans8x8DCT 242 class FwdTrans8x8DCT
223 : public FwdTrans8x8TestBase, 243 : public FwdTrans8x8TestBase,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 2), 360 make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 2),
341 make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 3))); 361 make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 3)));
342 #endif 362 #endif
343 363
344 #if HAVE_SSSE3 && ARCH_X86_64 364 #if HAVE_SSSE3 && ARCH_X86_64
345 INSTANTIATE_TEST_CASE_P( 365 INSTANTIATE_TEST_CASE_P(
346 SSSE3, FwdTrans8x8DCT, 366 SSSE3, FwdTrans8x8DCT,
347 ::testing::Values( 367 ::testing::Values(
348 make_tuple(&vp9_fdct8x8_ssse3, &vp9_idct8x8_64_add_ssse3, 0))); 368 make_tuple(&vp9_fdct8x8_ssse3, &vp9_idct8x8_64_add_ssse3, 0)));
349 #endif 369 #endif
370
371 #if HAVE_AVX2
372 INSTANTIATE_TEST_CASE_P(
373 AVX2, FwdTrans8x8DCT,
374 ::testing::Values(
375 make_tuple(&vp9_fdct8x8_avx2, &vp9_idct8x8_64_add_c, 0)));
376 INSTANTIATE_TEST_CASE_P(
377 AVX2, FwdTrans8x8HT,
378 ::testing::Values(
379 make_tuple(&vp9_fht8x8_avx2, &vp9_iht8x8_64_add_c, 0),
380 make_tuple(&vp9_fht8x8_avx2, &vp9_iht8x8_64_add_c, 1),
381 make_tuple(&vp9_fht8x8_avx2, &vp9_iht8x8_64_add_c, 2),
382 make_tuple(&vp9_fht8x8_avx2, &vp9_iht8x8_64_add_c, 3)));
383 #endif
350 } // namespace 384 } // namespace
OLDNEW
« no previous file with comments | « source/libvpx/test/fdct4x4_test.cc ('k') | source/libvpx/test/partial_idct_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698