123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756 |
- /*
- * Copyright (c) 2017 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
- #include <math.h>
- #include <stdlib.h>
- #include <string.h>
- #include <tuple>
- #include "third_party/googletest/src/include/gtest/gtest.h"
- #include "./vp9_rtcd.h"
- #include "./vpx_dsp_rtcd.h"
- #include "test/acm_random.h"
- #include "test/buffer.h"
- #include "test/clear_system_state.h"
- #include "test/register_state_check.h"
- #include "test/util.h"
- #include "vp9/common/vp9_entropy.h"
- #include "vpx/vpx_codec.h"
- #include "vpx/vpx_integer.h"
- #include "vpx_ports/mem.h"
- using libvpx_test::ACMRandom;
- using libvpx_test::Buffer;
- using std::make_tuple;
- using std::tuple;
- namespace {
- typedef void (*FdctFunc)(const int16_t *in, tran_low_t *out, int stride);
- typedef void (*IdctFunc)(const tran_low_t *in, uint8_t *out, int stride);
- typedef void (*FhtFunc)(const int16_t *in, tran_low_t *out, int stride,
- int tx_type);
- typedef void (*FhtFuncRef)(const Buffer<int16_t> &in, Buffer<tran_low_t> *out,
- int size, int tx_type);
- typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride,
- int tx_type);
- typedef void (*IhtWithBdFunc)(const tran_low_t *in, uint8_t *out, int stride,
- int tx_type, int bd);
- template <FdctFunc fn>
- void fdct_wrapper(const int16_t *in, tran_low_t *out, int stride, int tx_type) {
- (void)tx_type;
- fn(in, out, stride);
- }
- template <IdctFunc fn>
- void idct_wrapper(const tran_low_t *in, uint8_t *out, int stride, int tx_type,
- int bd) {
- (void)tx_type;
- (void)bd;
- fn(in, out, stride);
- }
- template <IhtFunc fn>
- void iht_wrapper(const tran_low_t *in, uint8_t *out, int stride, int tx_type,
- int bd) {
- (void)bd;
- fn(in, out, stride, tx_type);
- }
- #if CONFIG_VP9_HIGHBITDEPTH
- typedef void (*HighbdIdctFunc)(const tran_low_t *in, uint16_t *out, int stride,
- int bd);
- typedef void (*HighbdIhtFunc)(const tran_low_t *in, uint16_t *out, int stride,
- int tx_type, int bd);
- template <HighbdIdctFunc fn>
- void highbd_idct_wrapper(const tran_low_t *in, uint8_t *out, int stride,
- int tx_type, int bd) {
- (void)tx_type;
- fn(in, CAST_TO_SHORTPTR(out), stride, bd);
- }
- template <HighbdIhtFunc fn>
- void highbd_iht_wrapper(const tran_low_t *in, uint8_t *out, int stride,
- int tx_type, int bd) {
- fn(in, CAST_TO_SHORTPTR(out), stride, tx_type, bd);
- }
- #endif // CONFIG_VP9_HIGHBITDEPTH
- struct FuncInfo {
- FhtFunc ft_func;
- IhtWithBdFunc it_func;
- int size;
- int pixel_size;
- };
- /* forward transform, inverse transform, size, transform type, bit depth */
- typedef tuple<int, const FuncInfo *, int, vpx_bit_depth_t> DctParam;
- void fdct_ref(const Buffer<int16_t> &in, Buffer<tran_low_t> *out, int size,
- int /*tx_type*/) {
- const int16_t *i = in.TopLeftPixel();
- const int i_stride = in.stride();
- tran_low_t *o = out->TopLeftPixel();
- if (size == 4) {
- vpx_fdct4x4_c(i, o, i_stride);
- } else if (size == 8) {
- vpx_fdct8x8_c(i, o, i_stride);
- } else if (size == 16) {
- vpx_fdct16x16_c(i, o, i_stride);
- } else if (size == 32) {
- vpx_fdct32x32_c(i, o, i_stride);
- }
- }
- void fht_ref(const Buffer<int16_t> &in, Buffer<tran_low_t> *out, int size,
- int tx_type) {
- const int16_t *i = in.TopLeftPixel();
- const int i_stride = in.stride();
- tran_low_t *o = out->TopLeftPixel();
- if (size == 4) {
- vp9_fht4x4_c(i, o, i_stride, tx_type);
- } else if (size == 8) {
- vp9_fht8x8_c(i, o, i_stride, tx_type);
- } else if (size == 16) {
- vp9_fht16x16_c(i, o, i_stride, tx_type);
- }
- }
- void fwht_ref(const Buffer<int16_t> &in, Buffer<tran_low_t> *out, int size,
- int /*tx_type*/) {
- ASSERT_EQ(size, 4);
- vp9_fwht4x4_c(in.TopLeftPixel(), out->TopLeftPixel(), in.stride());
- }
- class TransTestBase : public ::testing::TestWithParam<DctParam> {
- public:
- virtual void SetUp() {
- rnd_.Reset(ACMRandom::DeterministicSeed());
- const int idx = GET_PARAM(0);
- const FuncInfo *func_info = &(GET_PARAM(1)[idx]);
- tx_type_ = GET_PARAM(2);
- bit_depth_ = GET_PARAM(3);
- fwd_txfm_ = func_info->ft_func;
- inv_txfm_ = func_info->it_func;
- size_ = func_info->size;
- pixel_size_ = func_info->pixel_size;
- max_pixel_value_ = (1 << bit_depth_) - 1;
- // Randomize stride_ to a value less than or equal to 1024
- stride_ = rnd_(1024) + 1;
- if (stride_ < size_) {
- stride_ = size_;
- }
- // Align stride_ to 16 if it's bigger than 16.
- if (stride_ > 16) {
- stride_ &= ~15;
- }
- block_size_ = size_ * stride_;
- src_ = reinterpret_cast<uint8_t *>(
- vpx_memalign(16, pixel_size_ * block_size_));
- ASSERT_TRUE(src_ != NULL);
- dst_ = reinterpret_cast<uint8_t *>(
- vpx_memalign(16, pixel_size_ * block_size_));
- ASSERT_TRUE(dst_ != NULL);
- }
- virtual void TearDown() {
- vpx_free(src_);
- src_ = NULL;
- vpx_free(dst_);
- dst_ = NULL;
- libvpx_test::ClearSystemState();
- }
- void InitMem() {
- if (pixel_size_ == 1 && bit_depth_ > VPX_BITS_8) return;
- if (pixel_size_ == 1) {
- for (int j = 0; j < block_size_; ++j) {
- src_[j] = rnd_.Rand16() & max_pixel_value_;
- }
- for (int j = 0; j < block_size_; ++j) {
- dst_[j] = rnd_.Rand16() & max_pixel_value_;
- }
- } else {
- ASSERT_EQ(pixel_size_, 2);
- uint16_t *const src = reinterpret_cast<uint16_t *>(src_);
- uint16_t *const dst = reinterpret_cast<uint16_t *>(dst_);
- for (int j = 0; j < block_size_; ++j) {
- src[j] = rnd_.Rand16() & max_pixel_value_;
- }
- for (int j = 0; j < block_size_; ++j) {
- dst[j] = rnd_.Rand16() & max_pixel_value_;
- }
- }
- }
- void RunFwdTxfm(const Buffer<int16_t> &in, Buffer<tran_low_t> *out) {
- fwd_txfm_(in.TopLeftPixel(), out->TopLeftPixel(), in.stride(), tx_type_);
- }
- void RunInvTxfm(const Buffer<tran_low_t> &in, uint8_t *out) {
- inv_txfm_(in.TopLeftPixel(), out, stride_, tx_type_, bit_depth_);
- }
- protected:
- void RunAccuracyCheck(int limit) {
- if (pixel_size_ == 1 && bit_depth_ > VPX_BITS_8) return;
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- Buffer<int16_t> test_input_block =
- Buffer<int16_t>(size_, size_, 8, size_ == 4 ? 0 : 16);
- ASSERT_TRUE(test_input_block.Init());
- ASSERT_TRUE(test_input_block.TopLeftPixel() != NULL);
- Buffer<tran_low_t> test_temp_block =
- Buffer<tran_low_t>(size_, size_, 0, 16);
- ASSERT_TRUE(test_temp_block.Init());
- uint32_t max_error = 0;
- int64_t total_error = 0;
- const int count_test_block = 10000;
- for (int i = 0; i < count_test_block; ++i) {
- InitMem();
- for (int h = 0; h < size_; ++h) {
- for (int w = 0; w < size_; ++w) {
- if (pixel_size_ == 1) {
- test_input_block.TopLeftPixel()[h * test_input_block.stride() + w] =
- src_[h * stride_ + w] - dst_[h * stride_ + w];
- } else {
- ASSERT_EQ(pixel_size_, 2);
- const uint16_t *const src = reinterpret_cast<uint16_t *>(src_);
- const uint16_t *const dst = reinterpret_cast<uint16_t *>(dst_);
- test_input_block.TopLeftPixel()[h * test_input_block.stride() + w] =
- src[h * stride_ + w] - dst[h * stride_ + w];
- }
- }
- }
- ASM_REGISTER_STATE_CHECK(RunFwdTxfm(test_input_block, &test_temp_block));
- ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst_));
- for (int h = 0; h < size_; ++h) {
- for (int w = 0; w < size_; ++w) {
- int diff;
- if (pixel_size_ == 1) {
- diff = dst_[h * stride_ + w] - src_[h * stride_ + w];
- } else {
- ASSERT_EQ(pixel_size_, 2);
- const uint16_t *const src = reinterpret_cast<uint16_t *>(src_);
- const uint16_t *const dst = reinterpret_cast<uint16_t *>(dst_);
- diff = dst[h * stride_ + w] - src[h * stride_ + w];
- }
- const uint32_t error = diff * diff;
- if (max_error < error) max_error = error;
- total_error += error;
- }
- }
- }
- EXPECT_GE(static_cast<uint32_t>(limit), max_error)
- << "Error: " << size_ << "x" << size_
- << " transform/inverse transform has an individual round trip error > "
- << limit;
- EXPECT_GE(count_test_block * limit, total_error)
- << "Error: " << size_ << "x" << size_
- << " transform/inverse transform has average round trip error > "
- << limit << " per block";
- }
- void RunCoeffCheck() {
- if (pixel_size_ == 1 && bit_depth_ > VPX_BITS_8) return;
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- const int count_test_block = 5000;
- Buffer<int16_t> input_block =
- Buffer<int16_t>(size_, size_, 8, size_ == 4 ? 0 : 16);
- ASSERT_TRUE(input_block.Init());
- Buffer<tran_low_t> output_ref_block = Buffer<tran_low_t>(size_, size_, 0);
- ASSERT_TRUE(output_ref_block.Init());
- Buffer<tran_low_t> output_block = Buffer<tran_low_t>(size_, size_, 0, 16);
- ASSERT_TRUE(output_block.Init());
- for (int i = 0; i < count_test_block; ++i) {
- // Initialize a test block with input range [-max_pixel_value_,
- // max_pixel_value_].
- input_block.Set(&rnd, -max_pixel_value_, max_pixel_value_);
- fwd_txfm_ref(input_block, &output_ref_block, size_, tx_type_);
- ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_block, &output_block));
- // The minimum quant value is 4.
- EXPECT_TRUE(output_block.CheckValues(output_ref_block));
- if (::testing::Test::HasFailure()) {
- printf("Size: %d Transform type: %d\n", size_, tx_type_);
- output_block.PrintDifference(output_ref_block);
- return;
- }
- }
- }
- void RunMemCheck() {
- if (pixel_size_ == 1 && bit_depth_ > VPX_BITS_8) return;
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- const int count_test_block = 5000;
- Buffer<int16_t> input_extreme_block =
- Buffer<int16_t>(size_, size_, 8, size_ == 4 ? 0 : 16);
- ASSERT_TRUE(input_extreme_block.Init());
- Buffer<tran_low_t> output_ref_block = Buffer<tran_low_t>(size_, size_, 0);
- ASSERT_TRUE(output_ref_block.Init());
- Buffer<tran_low_t> output_block = Buffer<tran_low_t>(size_, size_, 0, 16);
- ASSERT_TRUE(output_block.Init());
- for (int i = 0; i < count_test_block; ++i) {
- // Initialize a test block with -max_pixel_value_ or max_pixel_value_.
- if (i == 0) {
- input_extreme_block.Set(max_pixel_value_);
- } else if (i == 1) {
- input_extreme_block.Set(-max_pixel_value_);
- } else {
- ASSERT_TRUE(input_extreme_block.TopLeftPixel() != NULL);
- for (int h = 0; h < size_; ++h) {
- for (int w = 0; w < size_; ++w) {
- input_extreme_block
- .TopLeftPixel()[h * input_extreme_block.stride() + w] =
- rnd.Rand8() % 2 ? max_pixel_value_ : -max_pixel_value_;
- }
- }
- }
- fwd_txfm_ref(input_extreme_block, &output_ref_block, size_, tx_type_);
- ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_extreme_block, &output_block));
- // The minimum quant value is 4.
- EXPECT_TRUE(output_block.CheckValues(output_ref_block));
- ASSERT_TRUE(output_block.TopLeftPixel() != NULL);
- for (int h = 0; h < size_; ++h) {
- for (int w = 0; w < size_; ++w) {
- EXPECT_GE(
- 4 * DCT_MAX_VALUE << (bit_depth_ - 8),
- abs(output_block.TopLeftPixel()[h * output_block.stride() + w]))
- << "Error: " << size_ << "x" << size_
- << " transform has coefficient larger than 4*DCT_MAX_VALUE"
- << " at " << w << "," << h;
- if (::testing::Test::HasFailure()) {
- printf("Size: %d Transform type: %d\n", size_, tx_type_);
- output_block.DumpBuffer();
- return;
- }
- }
- }
- }
- }
- void RunInvAccuracyCheck(int limit) {
- if (pixel_size_ == 1 && bit_depth_ > VPX_BITS_8) return;
- ACMRandom rnd(ACMRandom::DeterministicSeed());
- const int count_test_block = 1000;
- Buffer<int16_t> in = Buffer<int16_t>(size_, size_, 4);
- ASSERT_TRUE(in.Init());
- Buffer<tran_low_t> coeff = Buffer<tran_low_t>(size_, size_, 0, 16);
- ASSERT_TRUE(coeff.Init());
- Buffer<uint8_t> dst = Buffer<uint8_t>(size_, size_, 0, 16);
- ASSERT_TRUE(dst.Init());
- Buffer<uint8_t> src = Buffer<uint8_t>(size_, size_, 0);
- ASSERT_TRUE(src.Init());
- Buffer<uint16_t> dst16 = Buffer<uint16_t>(size_, size_, 0, 16);
- ASSERT_TRUE(dst16.Init());
- Buffer<uint16_t> src16 = Buffer<uint16_t>(size_, size_, 0);
- ASSERT_TRUE(src16.Init());
- for (int i = 0; i < count_test_block; ++i) {
- InitMem();
- ASSERT_TRUE(in.TopLeftPixel() != NULL);
- // Initialize a test block with input range [-max_pixel_value_,
- // max_pixel_value_].
- for (int h = 0; h < size_; ++h) {
- for (int w = 0; w < size_; ++w) {
- if (pixel_size_ == 1) {
- in.TopLeftPixel()[h * in.stride() + w] =
- src_[h * stride_ + w] - dst_[h * stride_ + w];
- } else {
- ASSERT_EQ(pixel_size_, 2);
- const uint16_t *const src = reinterpret_cast<uint16_t *>(src_);
- const uint16_t *const dst = reinterpret_cast<uint16_t *>(dst_);
- in.TopLeftPixel()[h * in.stride() + w] =
- src[h * stride_ + w] - dst[h * stride_ + w];
- }
- }
- }
- fwd_txfm_ref(in, &coeff, size_, tx_type_);
- ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst_));
- for (int h = 0; h < size_; ++h) {
- for (int w = 0; w < size_; ++w) {
- int diff;
- if (pixel_size_ == 1) {
- diff = dst_[h * stride_ + w] - src_[h * stride_ + w];
- } else {
- ASSERT_EQ(pixel_size_, 2);
- const uint16_t *const src = reinterpret_cast<uint16_t *>(src_);
- const uint16_t *const dst = reinterpret_cast<uint16_t *>(dst_);
- diff = dst[h * stride_ + w] - src[h * stride_ + w];
- }
- const uint32_t error = diff * diff;
- EXPECT_GE(static_cast<uint32_t>(limit), error)
- << "Error: " << size_ << "x" << size_
- << " inverse transform has error " << error << " at " << w << ","
- << h;
- if (::testing::Test::HasFailure()) {
- printf("Size: %d Transform type: %d\n", size_, tx_type_);
- return;
- }
- }
- }
- }
- }
- FhtFunc fwd_txfm_;
- FhtFuncRef fwd_txfm_ref;
- IhtWithBdFunc inv_txfm_;
- ACMRandom rnd_;
- uint8_t *src_;
- uint8_t *dst_;
- vpx_bit_depth_t bit_depth_;
- int tx_type_;
- int max_pixel_value_;
- int size_;
- int stride_;
- int pixel_size_;
- int block_size_;
- };
- /* -------------------------------------------------------------------------- */
- class TransDCT : public TransTestBase {
- public:
- TransDCT() { fwd_txfm_ref = fdct_ref; }
- };
- TEST_P(TransDCT, AccuracyCheck) {
- int t = 1;
- if (size_ == 16 && bit_depth_ > 10 && pixel_size_ == 2) {
- t = 2;
- } else if (size_ == 32 && bit_depth_ > 10 && pixel_size_ == 2) {
- t = 7;
- }
- RunAccuracyCheck(t);
- }
- TEST_P(TransDCT, CoeffCheck) { RunCoeffCheck(); }
- TEST_P(TransDCT, MemCheck) { RunMemCheck(); }
- TEST_P(TransDCT, InvAccuracyCheck) { RunInvAccuracyCheck(1); }
- static const FuncInfo dct_c_func_info[] = {
- #if CONFIG_VP9_HIGHBITDEPTH
- { &fdct_wrapper<vpx_highbd_fdct4x4_c>,
- &highbd_idct_wrapper<vpx_highbd_idct4x4_16_add_c>, 4, 2 },
- { &fdct_wrapper<vpx_highbd_fdct8x8_c>,
- &highbd_idct_wrapper<vpx_highbd_idct8x8_64_add_c>, 8, 2 },
- { &fdct_wrapper<vpx_highbd_fdct16x16_c>,
- &highbd_idct_wrapper<vpx_highbd_idct16x16_256_add_c>, 16, 2 },
- { &fdct_wrapper<vpx_highbd_fdct32x32_c>,
- &highbd_idct_wrapper<vpx_highbd_idct32x32_1024_add_c>, 32, 2 },
- #endif
- { &fdct_wrapper<vpx_fdct4x4_c>, &idct_wrapper<vpx_idct4x4_16_add_c>, 4, 1 },
- { &fdct_wrapper<vpx_fdct8x8_c>, &idct_wrapper<vpx_idct8x8_64_add_c>, 8, 1 },
- { &fdct_wrapper<vpx_fdct16x16_c>, &idct_wrapper<vpx_idct16x16_256_add_c>, 16,
- 1 },
- { &fdct_wrapper<vpx_fdct32x32_c>, &idct_wrapper<vpx_idct32x32_1024_add_c>, 32,
- 1 }
- };
- INSTANTIATE_TEST_CASE_P(
- C, TransDCT,
- ::testing::Combine(
- ::testing::Range(0, static_cast<int>(sizeof(dct_c_func_info) /
- sizeof(dct_c_func_info[0]))),
- ::testing::Values(dct_c_func_info), ::testing::Values(0),
- ::testing::Values(VPX_BITS_8, VPX_BITS_10, VPX_BITS_12)));
- #if !CONFIG_EMULATE_HARDWARE
- #if HAVE_SSE2
- static const FuncInfo dct_sse2_func_info[] = {
- #if CONFIG_VP9_HIGHBITDEPTH
- { &fdct_wrapper<vpx_highbd_fdct4x4_sse2>,
- &highbd_idct_wrapper<vpx_highbd_idct4x4_16_add_sse2>, 4, 2 },
- { &fdct_wrapper<vpx_highbd_fdct8x8_sse2>,
- &highbd_idct_wrapper<vpx_highbd_idct8x8_64_add_sse2>, 8, 2 },
- { &fdct_wrapper<vpx_highbd_fdct16x16_sse2>,
- &highbd_idct_wrapper<vpx_highbd_idct16x16_256_add_sse2>, 16, 2 },
- { &fdct_wrapper<vpx_highbd_fdct32x32_sse2>,
- &highbd_idct_wrapper<vpx_highbd_idct32x32_1024_add_sse2>, 32, 2 },
- #endif
- { &fdct_wrapper<vpx_fdct4x4_sse2>, &idct_wrapper<vpx_idct4x4_16_add_sse2>, 4,
- 1 },
- { &fdct_wrapper<vpx_fdct8x8_sse2>, &idct_wrapper<vpx_idct8x8_64_add_sse2>, 8,
- 1 },
- { &fdct_wrapper<vpx_fdct16x16_sse2>,
- &idct_wrapper<vpx_idct16x16_256_add_sse2>, 16, 1 },
- { &fdct_wrapper<vpx_fdct32x32_sse2>,
- &idct_wrapper<vpx_idct32x32_1024_add_sse2>, 32, 1 }
- };
- INSTANTIATE_TEST_CASE_P(
- SSE2, TransDCT,
- ::testing::Combine(
- ::testing::Range(0, static_cast<int>(sizeof(dct_sse2_func_info) /
- sizeof(dct_sse2_func_info[0]))),
- ::testing::Values(dct_sse2_func_info), ::testing::Values(0),
- ::testing::Values(VPX_BITS_8, VPX_BITS_10, VPX_BITS_12)));
- #endif // HAVE_SSE2
- #if HAVE_SSSE3 && !CONFIG_VP9_HIGHBITDEPTH && ARCH_X86_64
- // vpx_fdct8x8_ssse3 is only available in 64 bit builds.
- static const FuncInfo dct_ssse3_func_info = {
- &fdct_wrapper<vpx_fdct8x8_ssse3>, &idct_wrapper<vpx_idct8x8_64_add_sse2>, 8, 1
- };
- // TODO(johannkoenig): high bit depth fdct8x8.
- INSTANTIATE_TEST_CASE_P(SSSE3, TransDCT,
- ::testing::Values(make_tuple(0, &dct_ssse3_func_info, 0,
- VPX_BITS_8)));
- #endif // HAVE_SSSE3 && !CONFIG_VP9_HIGHBITDEPTH && ARCH_X86_64
- #if HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH
- static const FuncInfo dct_avx2_func_info = {
- &fdct_wrapper<vpx_fdct32x32_avx2>, &idct_wrapper<vpx_idct32x32_1024_add_sse2>,
- 32, 1
- };
- // TODO(johannkoenig): high bit depth fdct32x32.
- INSTANTIATE_TEST_CASE_P(AVX2, TransDCT,
- ::testing::Values(make_tuple(0, &dct_avx2_func_info, 0,
- VPX_BITS_8)));
- #endif // HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH
- #if HAVE_NEON
- static const FuncInfo dct_neon_func_info[4] = {
- { &fdct_wrapper<vpx_fdct4x4_neon>, &idct_wrapper<vpx_idct4x4_16_add_neon>, 4,
- 1 },
- { &fdct_wrapper<vpx_fdct8x8_neon>, &idct_wrapper<vpx_idct8x8_64_add_neon>, 8,
- 1 },
- { &fdct_wrapper<vpx_fdct16x16_neon>,
- &idct_wrapper<vpx_idct16x16_256_add_neon>, 16, 1 },
- { &fdct_wrapper<vpx_fdct32x32_neon>,
- &idct_wrapper<vpx_idct32x32_1024_add_neon>, 32, 1 }
- };
- INSTANTIATE_TEST_CASE_P(
- NEON, TransDCT,
- ::testing::Combine(::testing::Range(0, 4),
- ::testing::Values(dct_neon_func_info),
- ::testing::Values(0), ::testing::Values(VPX_BITS_8)));
- #endif // HAVE_NEON
- #if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH
- static const FuncInfo dct_msa_func_info[4] = {
- { &fdct_wrapper<vpx_fdct4x4_msa>, &idct_wrapper<vpx_idct4x4_16_add_msa>, 4,
- 1 },
- { &fdct_wrapper<vpx_fdct8x8_msa>, &idct_wrapper<vpx_idct8x8_64_add_msa>, 8,
- 1 },
- { &fdct_wrapper<vpx_fdct16x16_msa>, &idct_wrapper<vpx_idct16x16_256_add_msa>,
- 16, 1 },
- { &fdct_wrapper<vpx_fdct32x32_msa>, &idct_wrapper<vpx_idct32x32_1024_add_msa>,
- 32, 1 }
- };
- INSTANTIATE_TEST_CASE_P(MSA, TransDCT,
- ::testing::Combine(::testing::Range(0, 4),
- ::testing::Values(dct_msa_func_info),
- ::testing::Values(0),
- ::testing::Values(VPX_BITS_8)));
- #endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH
- #if HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH
- static const FuncInfo dct_vsx_func_info = {
- &fdct_wrapper<vpx_fdct4x4_c>, &idct_wrapper<vpx_idct4x4_16_add_vsx>, 4, 1
- };
- INSTANTIATE_TEST_CASE_P(VSX, TransDCT,
- ::testing::Values(make_tuple(0, &dct_vsx_func_info, 0,
- VPX_BITS_8)));
- #endif // HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH &&
- #endif // !CONFIG_EMULATE_HARDWARE
- /* -------------------------------------------------------------------------- */
- class TransHT : public TransTestBase {
- public:
- TransHT() { fwd_txfm_ref = fht_ref; }
- };
- TEST_P(TransHT, AccuracyCheck) {
- RunAccuracyCheck(size_ == 16 && bit_depth_ > 10 && pixel_size_ == 2 ? 2 : 1);
- }
- TEST_P(TransHT, CoeffCheck) { RunCoeffCheck(); }
- TEST_P(TransHT, MemCheck) { RunMemCheck(); }
- TEST_P(TransHT, InvAccuracyCheck) { RunInvAccuracyCheck(1); }
- static const FuncInfo ht_c_func_info[] = {
- #if CONFIG_VP9_HIGHBITDEPTH
- { &vp9_highbd_fht4x4_c, &highbd_iht_wrapper<vp9_highbd_iht4x4_16_add_c>, 4,
- 2 },
- { &vp9_highbd_fht8x8_c, &highbd_iht_wrapper<vp9_highbd_iht8x8_64_add_c>, 8,
- 2 },
- { &vp9_highbd_fht16x16_c, &highbd_iht_wrapper<vp9_highbd_iht16x16_256_add_c>,
- 16, 2 },
- #endif
- { &vp9_fht4x4_c, &iht_wrapper<vp9_iht4x4_16_add_c>, 4, 1 },
- { &vp9_fht8x8_c, &iht_wrapper<vp9_iht8x8_64_add_c>, 8, 1 },
- { &vp9_fht16x16_c, &iht_wrapper<vp9_iht16x16_256_add_c>, 16, 1 }
- };
- INSTANTIATE_TEST_CASE_P(
- C, TransHT,
- ::testing::Combine(
- ::testing::Range(0, static_cast<int>(sizeof(ht_c_func_info) /
- sizeof(ht_c_func_info[0]))),
- ::testing::Values(ht_c_func_info), ::testing::Range(0, 4),
- ::testing::Values(VPX_BITS_8, VPX_BITS_10, VPX_BITS_12)));
- #if !CONFIG_EMULATE_HARDWARE
- #if HAVE_NEON
- static const FuncInfo ht_neon_func_info[] = {
- #if CONFIG_VP9_HIGHBITDEPTH
- { &vp9_highbd_fht4x4_c, &highbd_iht_wrapper<vp9_highbd_iht4x4_16_add_neon>, 4,
- 2 },
- { &vp9_highbd_fht8x8_c, &highbd_iht_wrapper<vp9_highbd_iht8x8_64_add_neon>, 8,
- 2 },
- { &vp9_highbd_fht16x16_c,
- &highbd_iht_wrapper<vp9_highbd_iht16x16_256_add_neon>, 16, 2 },
- #endif
- { &vp9_fht4x4_c, &iht_wrapper<vp9_iht4x4_16_add_neon>, 4, 1 },
- { &vp9_fht8x8_c, &iht_wrapper<vp9_iht8x8_64_add_neon>, 8, 1 },
- { &vp9_fht16x16_c, &iht_wrapper<vp9_iht16x16_256_add_neon>, 16, 1 }
- };
- INSTANTIATE_TEST_CASE_P(
- NEON, TransHT,
- ::testing::Combine(
- ::testing::Range(0, static_cast<int>(sizeof(ht_neon_func_info) /
- sizeof(ht_neon_func_info[0]))),
- ::testing::Values(ht_neon_func_info), ::testing::Range(0, 4),
- ::testing::Values(VPX_BITS_8, VPX_BITS_10, VPX_BITS_12)));
- #endif // HAVE_NEON
- #if HAVE_SSE2
- static const FuncInfo ht_sse2_func_info[3] = {
- { &vp9_fht4x4_sse2, &iht_wrapper<vp9_iht4x4_16_add_sse2>, 4, 1 },
- { &vp9_fht8x8_sse2, &iht_wrapper<vp9_iht8x8_64_add_sse2>, 8, 1 },
- { &vp9_fht16x16_sse2, &iht_wrapper<vp9_iht16x16_256_add_sse2>, 16, 1 }
- };
- INSTANTIATE_TEST_CASE_P(SSE2, TransHT,
- ::testing::Combine(::testing::Range(0, 3),
- ::testing::Values(ht_sse2_func_info),
- ::testing::Range(0, 4),
- ::testing::Values(VPX_BITS_8)));
- #endif // HAVE_SSE2
- #if HAVE_SSE4_1 && CONFIG_VP9_HIGHBITDEPTH
- static const FuncInfo ht_sse4_1_func_info[3] = {
- { &vp9_highbd_fht4x4_c, &highbd_iht_wrapper<vp9_highbd_iht4x4_16_add_sse4_1>,
- 4, 2 },
- { vp9_highbd_fht8x8_c, &highbd_iht_wrapper<vp9_highbd_iht8x8_64_add_sse4_1>,
- 8, 2 },
- { &vp9_highbd_fht16x16_c,
- &highbd_iht_wrapper<vp9_highbd_iht16x16_256_add_sse4_1>, 16, 2 }
- };
- INSTANTIATE_TEST_CASE_P(
- SSE4_1, TransHT,
- ::testing::Combine(::testing::Range(0, 3),
- ::testing::Values(ht_sse4_1_func_info),
- ::testing::Range(0, 4),
- ::testing::Values(VPX_BITS_8, VPX_BITS_10,
- VPX_BITS_12)));
- #endif // HAVE_SSE4_1 && CONFIG_VP9_HIGHBITDEPTH
- #if HAVE_VSX && !CONFIG_EMULATE_HARDWARE && !CONFIG_VP9_HIGHBITDEPTH
- static const FuncInfo ht_vsx_func_info[3] = {
- { &vp9_fht4x4_c, &iht_wrapper<vp9_iht4x4_16_add_vsx>, 4, 1 },
- { &vp9_fht8x8_c, &iht_wrapper<vp9_iht8x8_64_add_vsx>, 8, 1 },
- { &vp9_fht16x16_c, &iht_wrapper<vp9_iht16x16_256_add_vsx>, 16, 1 }
- };
- INSTANTIATE_TEST_CASE_P(VSX, TransHT,
- ::testing::Combine(::testing::Range(0, 3),
- ::testing::Values(ht_vsx_func_info),
- ::testing::Range(0, 4),
- ::testing::Values(VPX_BITS_8)));
- #endif // HAVE_VSX
- #endif // !CONFIG_EMULATE_HARDWARE
- /* -------------------------------------------------------------------------- */
- class TransWHT : public TransTestBase {
- public:
- TransWHT() { fwd_txfm_ref = fwht_ref; }
- };
- TEST_P(TransWHT, AccuracyCheck) { RunAccuracyCheck(0); }
- TEST_P(TransWHT, CoeffCheck) { RunCoeffCheck(); }
- TEST_P(TransWHT, MemCheck) { RunMemCheck(); }
- TEST_P(TransWHT, InvAccuracyCheck) { RunInvAccuracyCheck(0); }
- static const FuncInfo wht_c_func_info[] = {
- #if CONFIG_VP9_HIGHBITDEPTH
- { &fdct_wrapper<vp9_highbd_fwht4x4_c>,
- &highbd_idct_wrapper<vpx_highbd_iwht4x4_16_add_c>, 4, 2 },
- #endif
- { &fdct_wrapper<vp9_fwht4x4_c>, &idct_wrapper<vpx_iwht4x4_16_add_c>, 4, 1 }
- };
- INSTANTIATE_TEST_CASE_P(
- C, TransWHT,
- ::testing::Combine(
- ::testing::Range(0, static_cast<int>(sizeof(wht_c_func_info) /
- sizeof(wht_c_func_info[0]))),
- ::testing::Values(wht_c_func_info), ::testing::Values(0),
- ::testing::Values(VPX_BITS_8, VPX_BITS_10, VPX_BITS_12)));
- #if HAVE_SSE2 && !CONFIG_EMULATE_HARDWARE
- static const FuncInfo wht_sse2_func_info = {
- &fdct_wrapper<vp9_fwht4x4_sse2>, &idct_wrapper<vpx_iwht4x4_16_add_sse2>, 4, 1
- };
- INSTANTIATE_TEST_CASE_P(SSE2, TransWHT,
- ::testing::Values(make_tuple(0, &wht_sse2_func_info, 0,
- VPX_BITS_8)));
- #endif // HAVE_SSE2 && !CONFIG_EMULATE_HARDWARE
- #if HAVE_VSX && !CONFIG_EMULATE_HARDWARE && !CONFIG_VP9_HIGHBITDEPTH
- static const FuncInfo wht_vsx_func_info = {
- &fdct_wrapper<vp9_fwht4x4_c>, &idct_wrapper<vpx_iwht4x4_16_add_vsx>, 4, 1
- };
- INSTANTIATE_TEST_CASE_P(VSX, TransWHT,
- ::testing::Values(make_tuple(0, &wht_vsx_func_info, 0,
- VPX_BITS_8)));
- #endif // HAVE_VSX && !CONFIG_EMULATE_HARDWARE
- } // namespace
|