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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 double temp_in[16], temp_out[16]; | 251 double temp_in[16], temp_out[16]; |
252 for (int j = 0; j < 16; ++j) | 252 for (int j = 0; j < 16; ++j) |
253 temp_in[j] = output[j + i * 16]; | 253 temp_in[j] = output[j + i * 16]; |
254 butterfly_16x16_dct_1d(temp_in, temp_out); | 254 butterfly_16x16_dct_1d(temp_in, temp_out); |
255 // Scale by some magic number | 255 // Scale by some magic number |
256 for (int j = 0; j < 16; ++j) | 256 for (int j = 0; j < 16; ++j) |
257 output[j + i * 16] = temp_out[j]/2; | 257 output[j + i * 16] = temp_out[j]/2; |
258 } | 258 } |
259 } | 259 } |
260 | 260 |
261 typedef void (*fdct_t)(const int16_t *in, int16_t *out, int stride); | 261 typedef void (*FdctFunc)(const int16_t *in, int16_t *out, int stride); |
262 typedef void (*idct_t)(const int16_t *in, uint8_t *out, int stride); | 262 typedef void (*IdctFunc)(const int16_t *in, uint8_t *out, int stride); |
263 typedef void (*fht_t) (const int16_t *in, int16_t *out, int stride, | 263 typedef void (*FhtFunc)(const int16_t *in, int16_t *out, int stride, |
264 int tx_type); | 264 int tx_type); |
265 typedef void (*iht_t) (const int16_t *in, uint8_t *out, int stride, | 265 typedef void (*IhtFunc)(const int16_t *in, uint8_t *out, int stride, |
266 int tx_type); | 266 int tx_type); |
267 | 267 |
268 typedef std::tr1::tuple<fdct_t, idct_t, int> dct_16x16_param_t; | 268 typedef std::tr1::tuple<FdctFunc, IdctFunc, int> Dct16x16Param; |
269 typedef std::tr1::tuple<fht_t, iht_t, int> ht_16x16_param_t; | 269 typedef std::tr1::tuple<FhtFunc, IhtFunc, int> Ht16x16Param; |
270 | 270 |
271 void fdct16x16_ref(const int16_t *in, int16_t *out, int stride, int tx_type) { | 271 void fdct16x16_ref(const int16_t *in, int16_t *out, int stride, int tx_type) { |
272 vp9_fdct16x16_c(in, out, stride); | 272 vp9_fdct16x16_c(in, out, stride); |
273 } | 273 } |
274 | 274 |
275 void idct16x16_ref(const int16_t *in, uint8_t *dest, int stride, int tx_type) { | 275 void idct16x16_ref(const int16_t *in, uint8_t *dest, int stride, int tx_type) { |
276 vp9_idct16x16_256_add_c(in, dest, stride); | 276 vp9_idct16x16_256_add_c(in, dest, stride); |
277 } | 277 } |
278 | 278 |
279 void fht16x16_ref(const int16_t *in, int16_t *out, int stride, int tx_type) { | 279 void fht16x16_ref(const int16_t *in, int16_t *out, int stride, int tx_type) { |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 const uint32_t diff = dst[j] - src[j]; | 456 const uint32_t diff = dst[j] - src[j]; |
457 const uint32_t error = diff * diff; | 457 const uint32_t error = diff * diff; |
458 EXPECT_GE(1u, error) | 458 EXPECT_GE(1u, error) |
459 << "Error: 16x16 IDCT has error " << error | 459 << "Error: 16x16 IDCT has error " << error |
460 << " at index " << j; | 460 << " at index " << j; |
461 } | 461 } |
462 } | 462 } |
463 } | 463 } |
464 int pitch_; | 464 int pitch_; |
465 int tx_type_; | 465 int tx_type_; |
466 fht_t fwd_txfm_ref; | 466 FhtFunc fwd_txfm_ref; |
467 iht_t inv_txfm_ref; | 467 IhtFunc inv_txfm_ref; |
468 }; | 468 }; |
469 | 469 |
470 class Trans16x16DCT | 470 class Trans16x16DCT |
471 : public Trans16x16TestBase, | 471 : public Trans16x16TestBase, |
472 public ::testing::TestWithParam<dct_16x16_param_t> { | 472 public ::testing::TestWithParam<Dct16x16Param> { |
473 public: | 473 public: |
474 virtual ~Trans16x16DCT() {} | 474 virtual ~Trans16x16DCT() {} |
475 | 475 |
476 virtual void SetUp() { | 476 virtual void SetUp() { |
477 fwd_txfm_ = GET_PARAM(0); | 477 fwd_txfm_ = GET_PARAM(0); |
478 inv_txfm_ = GET_PARAM(1); | 478 inv_txfm_ = GET_PARAM(1); |
479 tx_type_ = GET_PARAM(2); | 479 tx_type_ = GET_PARAM(2); |
480 pitch_ = 16; | 480 pitch_ = 16; |
481 fwd_txfm_ref = fdct16x16_ref; | 481 fwd_txfm_ref = fdct16x16_ref; |
482 inv_txfm_ref = idct16x16_ref; | 482 inv_txfm_ref = idct16x16_ref; |
483 } | 483 } |
484 virtual void TearDown() { libvpx_test::ClearSystemState(); } | 484 virtual void TearDown() { libvpx_test::ClearSystemState(); } |
485 | 485 |
486 protected: | 486 protected: |
487 void RunFwdTxfm(int16_t *in, int16_t *out, int stride) { | 487 void RunFwdTxfm(int16_t *in, int16_t *out, int stride) { |
488 fwd_txfm_(in, out, stride); | 488 fwd_txfm_(in, out, stride); |
489 } | 489 } |
490 void RunInvTxfm(int16_t *out, uint8_t *dst, int stride) { | 490 void RunInvTxfm(int16_t *out, uint8_t *dst, int stride) { |
491 inv_txfm_(out, dst, stride); | 491 inv_txfm_(out, dst, stride); |
492 } | 492 } |
493 | 493 |
494 fdct_t fwd_txfm_; | 494 FdctFunc fwd_txfm_; |
495 idct_t inv_txfm_; | 495 IdctFunc inv_txfm_; |
496 }; | 496 }; |
497 | 497 |
498 TEST_P(Trans16x16DCT, AccuracyCheck) { | 498 TEST_P(Trans16x16DCT, AccuracyCheck) { |
499 RunAccuracyCheck(); | 499 RunAccuracyCheck(); |
500 } | 500 } |
501 | 501 |
502 TEST_P(Trans16x16DCT, CoeffCheck) { | 502 TEST_P(Trans16x16DCT, CoeffCheck) { |
503 RunCoeffCheck(); | 503 RunCoeffCheck(); |
504 } | 504 } |
505 | 505 |
506 TEST_P(Trans16x16DCT, MemCheck) { | 506 TEST_P(Trans16x16DCT, MemCheck) { |
507 RunMemCheck(); | 507 RunMemCheck(); |
508 } | 508 } |
509 | 509 |
510 TEST_P(Trans16x16DCT, QuantCheck) { | 510 TEST_P(Trans16x16DCT, QuantCheck) { |
511 // Use maximally allowed quantization step sizes for DC and AC | 511 // Use maximally allowed quantization step sizes for DC and AC |
512 // coefficients respectively. | 512 // coefficients respectively. |
513 RunQuantCheck(1336, 1828); | 513 RunQuantCheck(1336, 1828); |
514 } | 514 } |
515 | 515 |
516 TEST_P(Trans16x16DCT, InvAccuracyCheck) { | 516 TEST_P(Trans16x16DCT, InvAccuracyCheck) { |
517 RunInvAccuracyCheck(); | 517 RunInvAccuracyCheck(); |
518 } | 518 } |
519 | 519 |
520 class Trans16x16HT | 520 class Trans16x16HT |
521 : public Trans16x16TestBase, | 521 : public Trans16x16TestBase, |
522 public ::testing::TestWithParam<ht_16x16_param_t> { | 522 public ::testing::TestWithParam<Ht16x16Param> { |
523 public: | 523 public: |
524 virtual ~Trans16x16HT() {} | 524 virtual ~Trans16x16HT() {} |
525 | 525 |
526 virtual void SetUp() { | 526 virtual void SetUp() { |
527 fwd_txfm_ = GET_PARAM(0); | 527 fwd_txfm_ = GET_PARAM(0); |
528 inv_txfm_ = GET_PARAM(1); | 528 inv_txfm_ = GET_PARAM(1); |
529 tx_type_ = GET_PARAM(2); | 529 tx_type_ = GET_PARAM(2); |
530 pitch_ = 16; | 530 pitch_ = 16; |
531 fwd_txfm_ref = fht16x16_ref; | 531 fwd_txfm_ref = fht16x16_ref; |
532 inv_txfm_ref = iht16x16_ref; | 532 inv_txfm_ref = iht16x16_ref; |
533 } | 533 } |
534 virtual void TearDown() { libvpx_test::ClearSystemState(); } | 534 virtual void TearDown() { libvpx_test::ClearSystemState(); } |
535 | 535 |
536 protected: | 536 protected: |
537 void RunFwdTxfm(int16_t *in, int16_t *out, int stride) { | 537 void RunFwdTxfm(int16_t *in, int16_t *out, int stride) { |
538 fwd_txfm_(in, out, stride, tx_type_); | 538 fwd_txfm_(in, out, stride, tx_type_); |
539 } | 539 } |
540 void RunInvTxfm(int16_t *out, uint8_t *dst, int stride) { | 540 void RunInvTxfm(int16_t *out, uint8_t *dst, int stride) { |
541 inv_txfm_(out, dst, stride, tx_type_); | 541 inv_txfm_(out, dst, stride, tx_type_); |
542 } | 542 } |
543 | 543 |
544 fht_t fwd_txfm_; | 544 FhtFunc fwd_txfm_; |
545 iht_t inv_txfm_; | 545 IhtFunc inv_txfm_; |
546 }; | 546 }; |
547 | 547 |
548 TEST_P(Trans16x16HT, AccuracyCheck) { | 548 TEST_P(Trans16x16HT, AccuracyCheck) { |
549 RunAccuracyCheck(); | 549 RunAccuracyCheck(); |
550 } | 550 } |
551 | 551 |
552 TEST_P(Trans16x16HT, CoeffCheck) { | 552 TEST_P(Trans16x16HT, CoeffCheck) { |
553 RunCoeffCheck(); | 553 RunCoeffCheck(); |
554 } | 554 } |
555 | 555 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 ::testing::Values( | 625 ::testing::Values( |
626 make_tuple(&vp9_fht16x16_avx2, &vp9_iht16x16_256_add_c, 3))); | 626 make_tuple(&vp9_fht16x16_avx2, &vp9_iht16x16_256_add_c, 3))); |
627 INSTANTIATE_TEST_CASE_P( | 627 INSTANTIATE_TEST_CASE_P( |
628 DISABLED_AVX2, Trans16x16HT, | 628 DISABLED_AVX2, Trans16x16HT, |
629 ::testing::Values( | 629 ::testing::Values( |
630 make_tuple(&vp9_fht16x16_avx2, &vp9_iht16x16_256_add_c, 0), | 630 make_tuple(&vp9_fht16x16_avx2, &vp9_iht16x16_256_add_c, 0), |
631 make_tuple(&vp9_fht16x16_avx2, &vp9_iht16x16_256_add_c, 1), | 631 make_tuple(&vp9_fht16x16_avx2, &vp9_iht16x16_256_add_c, 1), |
632 make_tuple(&vp9_fht16x16_avx2, &vp9_iht16x16_256_add_c, 2))); | 632 make_tuple(&vp9_fht16x16_avx2, &vp9_iht16x16_256_add_c, 2))); |
633 #endif | 633 #endif |
634 } // namespace | 634 } // namespace |
OLD | NEW |