Yi Luo | 6ab0621 | 2016-03-07 14:25:07 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 The WebM project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #include "third_party/googletest/src/include/gtest/gtest.h" |
| 12 | |
| 13 | #include "./vp10_rtcd.h" |
| 14 | #include "./vpx_dsp_rtcd.h" |
| 15 | |
| 16 | #include "test/acm_random.h" |
| 17 | #include "test/clear_system_state.h" |
| 18 | #include "test/register_state_check.h" |
| 19 | #include "test/transform_test_base.h" |
| 20 | #include "test/util.h" |
| 21 | #include "vpx_ports/mem.h" |
| 22 | |
| 23 | using libvpx_test::ACMRandom; |
| 24 | |
| 25 | namespace { |
| 26 | typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride, |
| 27 | int tx_type); |
| 28 | |
| 29 | using libvpx_test::FhtFunc; |
| 30 | typedef std::tr1::tuple<FhtFunc, IhtFunc, int, vpx_bit_depth_t, int> Ht8x8Param; |
| 31 | |
| 32 | void fht8x8_ref(const int16_t *in, tran_low_t *out, int stride, |
| 33 | int tx_type) { |
| 34 | vp10_fht8x8_c(in, out, stride, tx_type); |
| 35 | } |
| 36 | |
| 37 | class VP10Trans8x8HT |
| 38 | : public libvpx_test::TransformTestBase, |
| 39 | public ::testing::TestWithParam<Ht8x8Param> { |
| 40 | public: |
| 41 | virtual ~VP10Trans8x8HT() {} |
| 42 | |
| 43 | virtual void SetUp() { |
| 44 | fwd_txfm_ = GET_PARAM(0); |
| 45 | inv_txfm_ = GET_PARAM(1); |
| 46 | tx_type_ = GET_PARAM(2); |
| 47 | pitch_ = 8; |
| 48 | fwd_txfm_ref = fht8x8_ref; |
| 49 | bit_depth_ = GET_PARAM(3); |
| 50 | mask_ = (1 << bit_depth_) - 1; |
| 51 | num_coeffs_ = GET_PARAM(4); |
| 52 | } |
| 53 | virtual void TearDown() { libvpx_test::ClearSystemState(); } |
| 54 | |
| 55 | protected: |
| 56 | void RunFwdTxfm(const int16_t *in, tran_low_t *out, int stride) { |
| 57 | fwd_txfm_(in, out, stride, tx_type_); |
| 58 | } |
| 59 | |
| 60 | void RunInvTxfm(const tran_low_t *out, uint8_t *dst, int stride) { |
| 61 | inv_txfm_(out, dst, stride, tx_type_); |
| 62 | } |
| 63 | |
| 64 | FhtFunc fwd_txfm_; |
| 65 | IhtFunc inv_txfm_; |
| 66 | }; |
| 67 | |
| 68 | TEST_P(VP10Trans8x8HT, CoeffCheck) { |
| 69 | RunCoeffCheck(); |
| 70 | } |
| 71 | |
| 72 | using std::tr1::make_tuple; |
| 73 | |
| 74 | #if HAVE_SSE2 |
| 75 | INSTANTIATE_TEST_CASE_P( |
| 76 | SSE2, VP10Trans8x8HT, |
| 77 | ::testing::Values( |
| 78 | #if !CONFIG_EXT_TX |
| 79 | make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 0, |
| 80 | VPX_BITS_8, 64), |
| 81 | make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 1, |
| 82 | VPX_BITS_8, 64), |
| 83 | make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 2, |
| 84 | VPX_BITS_8, 64), |
| 85 | make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 3, |
| 86 | VPX_BITS_8, 64))); |
| 87 | #else |
| 88 | make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 0, |
| 89 | VPX_BITS_8, 64), |
| 90 | make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 1, |
| 91 | VPX_BITS_8, 64), |
| 92 | make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 2, |
| 93 | VPX_BITS_8, 64), |
| 94 | make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 3, |
| 95 | VPX_BITS_8, 64), |
| 96 | make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 4, |
| 97 | VPX_BITS_8, 64), |
| 98 | make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 5, |
| 99 | VPX_BITS_8, 64), |
| 100 | make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 6, |
| 101 | VPX_BITS_8, 64), |
| 102 | make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 7, |
| 103 | VPX_BITS_8, 64), |
| 104 | make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 8, |
| 105 | VPX_BITS_8, 64), |
| 106 | make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 9, |
| 107 | VPX_BITS_8, 64), |
| 108 | make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 10, |
| 109 | VPX_BITS_8, 64), |
| 110 | make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 11, |
| 111 | VPX_BITS_8, 64), |
| 112 | make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 12, |
| 113 | VPX_BITS_8, 64), |
| 114 | make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 13, |
| 115 | VPX_BITS_8, 64), |
| 116 | make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 14, |
| 117 | VPX_BITS_8, 64), |
| 118 | make_tuple(&vp10_fht8x8_sse2, &vp10_iht8x8_64_add_sse2, 15, |
| 119 | VPX_BITS_8, 64))); |
| 120 | #endif // !CONFIG_EXT_TX |
| 121 | #endif // HAVE_SSE2 |
| 122 | |
| 123 | } // namespace |