Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [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 "./aom_dsp_rtcd.h" |
| 14 | #include "./av1_rtcd.h" |
| 15 | |
| 16 | #include "aom_ports/mem.h" |
| 17 | #include "test/acm_random.h" |
| 18 | #include "test/clear_system_state.h" |
| 19 | #include "test/register_state_check.h" |
| 20 | #include "test/transform_test_base.h" |
| 21 | #include "test/util.h" |
| 22 | |
| 23 | using libaom_test::ACMRandom; |
| 24 | |
| 25 | namespace { |
| 26 | typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride, |
| 27 | int tx_type); |
| 28 | using std::tr1::tuple; |
| 29 | using libaom_test::FhtFunc; |
| 30 | typedef tuple<FhtFunc, IhtFunc, int, aom_bit_depth_t, int> Ht8x16Param; |
| 31 | |
| 32 | void fht8x16_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) { |
| 33 | av1_fht8x16_c(in, out, stride, tx_type); |
| 34 | } |
| 35 | |
| 36 | class AV1Trans8x16HT : public libaom_test::TransformTestBase, |
| 37 | public ::testing::TestWithParam<Ht8x16Param> { |
| 38 | public: |
| 39 | virtual ~AV1Trans8x16HT() {} |
| 40 | |
| 41 | virtual void SetUp() { |
| 42 | fwd_txfm_ = GET_PARAM(0); |
| 43 | inv_txfm_ = GET_PARAM(1); |
| 44 | tx_type_ = GET_PARAM(2); |
| 45 | pitch_ = 8; |
| 46 | fwd_txfm_ref = fht8x16_ref; |
| 47 | bit_depth_ = GET_PARAM(3); |
| 48 | mask_ = (1 << bit_depth_) - 1; |
| 49 | num_coeffs_ = GET_PARAM(4); |
| 50 | } |
| 51 | virtual void TearDown() { libaom_test::ClearSystemState(); } |
| 52 | |
| 53 | protected: |
| 54 | void RunFwdTxfm(const int16_t *in, tran_low_t *out, int stride) { |
| 55 | fwd_txfm_(in, out, stride, tx_type_); |
| 56 | } |
| 57 | |
| 58 | void RunInvTxfm(const tran_low_t *out, uint8_t *dst, int stride) { |
| 59 | inv_txfm_(out, dst, stride, tx_type_); |
| 60 | } |
| 61 | |
| 62 | FhtFunc fwd_txfm_; |
| 63 | IhtFunc inv_txfm_; |
| 64 | }; |
| 65 | |
| 66 | TEST_P(AV1Trans8x16HT, CoeffCheck) { RunCoeffCheck(); } |
| 67 | |
| 68 | using std::tr1::make_tuple; |
| 69 | |
| 70 | #if HAVE_SSE2 |
| 71 | const Ht8x16Param kArrayHt8x16Param_sse2[] = { |
| 72 | make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_c, 0, AOM_BITS_8, 128), |
| 73 | make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_c, 1, AOM_BITS_8, 128), |
| 74 | make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_c, 2, AOM_BITS_8, 128), |
| 75 | make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_c, 3, AOM_BITS_8, 128), |
| 76 | #if CONFIG_EXT_TX |
| 77 | make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_c, 4, AOM_BITS_8, 128), |
| 78 | make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_c, 5, AOM_BITS_8, 128), |
| 79 | make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_c, 6, AOM_BITS_8, 128), |
| 80 | make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_c, 7, AOM_BITS_8, 128), |
| 81 | make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_c, 8, AOM_BITS_8, 128), |
| 82 | make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_c, 9, AOM_BITS_8, 128), |
| 83 | make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_c, 10, AOM_BITS_8, 128), |
| 84 | make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_c, 11, AOM_BITS_8, 128), |
| 85 | make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_c, 12, AOM_BITS_8, 128), |
| 86 | make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_c, 13, AOM_BITS_8, 128), |
| 87 | make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_c, 14, AOM_BITS_8, 128), |
| 88 | make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_c, 15, AOM_BITS_8, 128) |
| 89 | #endif // CONFIG_EXT_TX |
| 90 | }; |
| 91 | INSTANTIATE_TEST_CASE_P(SSE2, AV1Trans8x16HT, |
| 92 | ::testing::ValuesIn(kArrayHt8x16Param_sse2)); |
| 93 | #endif // HAVE_SSE2 |
| 94 | |
| 95 | } // namespace |