diff options
Diffstat (limited to 'test/intra_edge_test.cc')
-rw-r--r-- | test/intra_edge_test.cc | 228 |
1 files changed, 121 insertions, 107 deletions
diff --git a/test/intra_edge_test.cc b/test/intra_edge_test.cc index 84e712d1d..96ee65466 100644 --- a/test/intra_edge_test.cc +++ b/test/intra_edge_test.cc @@ -37,7 +37,7 @@ class UpsampleTest : public FunctionEquivalenceTest<F> { static const int kBufSize = 2 * 64 + 32; static const int kOffset = 16; - virtual ~UpsampleTest() {} + ~UpsampleTest() override = default; virtual void Execute(T *edge_tst) = 0; @@ -62,16 +62,12 @@ class UpsampleTest : public FunctionEquivalenceTest<F> { int size_; }; -////////////////////////////////////////////////////////////////////////////// -// 8 bit version -////////////////////////////////////////////////////////////////////////////// - typedef void (*UP8B)(uint8_t *p, int size); typedef libaom_test::FuncParam<UP8B> TestFuncs; class UpsampleTest8B : public UpsampleTest<UP8B, uint8_t> { protected: - void Execute(uint8_t *edge_tst) { + void Execute(uint8_t *edge_tst) override { params_.ref_func(edge_ref_, size_); API_REGISTER_STATE_CHECK(params_.tst_func(edge_tst, size_)); } @@ -99,6 +95,18 @@ TEST_P(UpsampleTest8B, RandomValues) { } } +TEST_P(UpsampleTest8B, DISABLED_Speed) { + const int test_count = 10000000; + size_ = kMaxEdge; + for (int i = 0; i < kOffset + size_; ++i) { + edge_tst_data_[i] = rng_.Rand8(); + } + edge_tst_ = &edge_tst_data_[kOffset]; + for (int iter = 0; iter < test_count; ++iter) { + API_REGISTER_STATE_CHECK(params_.tst_func(edge_tst_, size_)); + } +} + #if HAVE_SSE4_1 INSTANTIATE_TEST_SUITE_P( SSE4_1, UpsampleTest8B, @@ -106,57 +114,12 @@ INSTANTIATE_TEST_SUITE_P( av1_upsample_intra_edge_sse4_1))); #endif // HAVE_SSE4_1 -////////////////////////////////////////////////////////////////////////////// -// High bit-depth version -////////////////////////////////////////////////////////////////////////////// - -typedef void (*UPHB)(uint16_t *p, int size, int bd); -typedef libaom_test::FuncParam<UPHB> TestFuncsHBD; - -class UpsampleTestHB : public UpsampleTest<UPHB, uint16_t> { - protected: - void Execute(uint16_t *edge_tst) { - params_.ref_func(edge_ref_, size_, bit_depth_); - API_REGISTER_STATE_CHECK(params_.tst_func(edge_tst, size_, bit_depth_)); - } - int bit_depth_; -}; - -TEST_P(UpsampleTestHB, RandomValues) { - for (int iter = 0; iter < kIterations && !HasFatalFailure(); ++iter) { - switch (rng_(3)) { - case 0: bit_depth_ = 8; break; - case 1: bit_depth_ = 10; break; - default: bit_depth_ = 12; break; - } - const int hi = 1 << bit_depth_; - - size_ = 4 * (this->rng_(4) + 1); - - int i, pix = 0; - for (i = 0; i < kOffset + size_; ++i) { - pix = rng_(hi); - edge_ref_data_[i] = pix; - edge_tst_data_[i] = pix; - } - - // Extend final sample - while (i < kBufSize) { - edge_ref_data_[i] = pix; - edge_tst_data_[i] = pix; - i++; - } - - Common(); - } -} - -#if HAVE_SSE4_1 +#if HAVE_NEON INSTANTIATE_TEST_SUITE_P( - SSE4_1, UpsampleTestHB, - ::testing::Values(TestFuncsHBD(av1_upsample_intra_edge_high_c, - av1_upsample_intra_edge_high_sse4_1))); -#endif // HAVE_SSE4_1 + NEON, UpsampleTest8B, + ::testing::Values(TestFuncs(av1_upsample_intra_edge_c, + av1_upsample_intra_edge_neon))); +#endif // HAVE_NEON template <typename F, typename T> class FilterEdgeTest : public FunctionEquivalenceTest<F> { @@ -166,7 +129,7 @@ class FilterEdgeTest : public FunctionEquivalenceTest<F> { static const int kBufSize = kMaxEdge + 32; static const int kOffset = 15; - virtual ~FilterEdgeTest() {} + ~FilterEdgeTest() override = default; virtual void Execute(T *edge_tst) = 0; @@ -191,16 +154,12 @@ class FilterEdgeTest : public FunctionEquivalenceTest<F> { int strength_; }; -////////////////////////////////////////////////////////////////////////////// -// 8 bit version -////////////////////////////////////////////////////////////////////////////// - typedef void (*FE8B)(uint8_t *p, int size, int strength); typedef libaom_test::FuncParam<FE8B> FilterEdgeTestFuncs; class FilterEdgeTest8B : public FilterEdgeTest<FE8B, uint8_t> { protected: - void Execute(uint8_t *edge_tst) { + void Execute(uint8_t *edge_tst) override { params_.ref_func(edge_ref_, size_, strength_); API_REGISTER_STATE_CHECK(params_.tst_func(edge_tst, size_, strength_)); } @@ -222,6 +181,21 @@ TEST_P(FilterEdgeTest8B, RandomValues) { } } +TEST_P(FilterEdgeTest8B, DISABLED_Speed) { + const int test_count = 10000000; + size_ = kMaxEdge; + strength_ = 1; + for (int i = 0; i < kOffset + size_; ++i) { + edge_tst_data_[i] = rng_.Rand8(); + } + edge_tst_ = &edge_tst_data_[kOffset]; + for (int iter = 0; iter < test_count; ++iter) { + API_REGISTER_STATE_CHECK(params_.tst_func(edge_tst_, size_, strength_)); + // iterate over filter strengths (1,2,3) + strength_ = strength_ == 3 ? 1 : strength_ + 1; + } +} + #if HAVE_SSE4_1 INSTANTIATE_TEST_SUITE_P( SSE4_1, FilterEdgeTest8B, @@ -229,23 +203,28 @@ INSTANTIATE_TEST_SUITE_P( av1_filter_intra_edge_sse4_1))); #endif // HAVE_SSE4_1 -////////////////////////////////////////////////////////////////////////////// -// High bit-depth version -////////////////////////////////////////////////////////////////////////////// +#if HAVE_NEON +INSTANTIATE_TEST_SUITE_P( + NEON, FilterEdgeTest8B, + ::testing::Values(FilterEdgeTestFuncs(av1_filter_intra_edge_c, + av1_filter_intra_edge_neon))); +#endif // HAVE_NEON -typedef void (*FEHB)(uint16_t *p, int size, int strength); -typedef libaom_test::FuncParam<FEHB> FilterEdgeTestFuncsHBD; +#if CONFIG_AV1_HIGHBITDEPTH -class FilterEdgeTestHB : public FilterEdgeTest<FEHB, uint16_t> { +typedef void (*UPHB)(uint16_t *p, int size, int bd); +typedef libaom_test::FuncParam<UPHB> TestFuncsHBD; + +class UpsampleTestHB : public UpsampleTest<UPHB, uint16_t> { protected: - void Execute(uint16_t *edge_tst) { - params_.ref_func(edge_ref_, size_, strength_); - API_REGISTER_STATE_CHECK(params_.tst_func(edge_tst, size_, strength_)); + void Execute(uint16_t *edge_tst) override { + params_.ref_func(edge_ref_, size_, bit_depth_); + API_REGISTER_STATE_CHECK(params_.tst_func(edge_tst, size_, bit_depth_)); } int bit_depth_; }; -TEST_P(FilterEdgeTestHB, RandomValues) { +TEST_P(UpsampleTestHB, RandomValues) { for (int iter = 0; iter < kIterations && !HasFatalFailure(); ++iter) { switch (rng_(3)) { case 0: bit_depth_ = 8; break; @@ -253,8 +232,8 @@ TEST_P(FilterEdgeTestHB, RandomValues) { default: bit_depth_ = 12; break; } const int hi = 1 << bit_depth_; - strength_ = this->rng_(4); - size_ = 4 * (this->rng_(128 / 4) + 1) + 1; + + size_ = 4 * (this->rng_(4) + 1); int i, pix = 0; for (i = 0; i < kOffset + size_; ++i) { @@ -263,28 +242,14 @@ TEST_P(FilterEdgeTestHB, RandomValues) { edge_tst_data_[i] = pix; } - Common(); - } -} - -#if HAVE_SSE4_1 -INSTANTIATE_TEST_SUITE_P(SSE4_1, FilterEdgeTestHB, - ::testing::Values(FilterEdgeTestFuncsHBD( - av1_filter_intra_edge_high_c, - av1_filter_intra_edge_high_sse4_1))); -#endif // HAVE_SSE4_1 - -// Speed tests + // Extend final sample + while (i < kBufSize) { + edge_ref_data_[i] = pix; + edge_tst_data_[i] = pix; + i++; + } -TEST_P(UpsampleTest8B, DISABLED_Speed) { - const int test_count = 10000000; - size_ = kMaxEdge; - for (int i = 0; i < kOffset + size_; ++i) { - edge_tst_data_[i] = rng_.Rand8(); - } - edge_tst_ = &edge_tst_data_[kOffset]; - for (int iter = 0; iter < test_count; ++iter) { - API_REGISTER_STATE_CHECK(params_.tst_func(edge_tst_, size_)); + Common(); } } @@ -302,18 +267,51 @@ TEST_P(UpsampleTestHB, DISABLED_Speed) { } } -TEST_P(FilterEdgeTest8B, DISABLED_Speed) { - const int test_count = 10000000; - size_ = kMaxEdge; - strength_ = 1; - for (int i = 0; i < kOffset + size_; ++i) { - edge_tst_data_[i] = rng_.Rand8(); +#if HAVE_SSE4_1 +INSTANTIATE_TEST_SUITE_P( + SSE4_1, UpsampleTestHB, + ::testing::Values(TestFuncsHBD(av1_highbd_upsample_intra_edge_c, + av1_highbd_upsample_intra_edge_sse4_1))); +#endif // HAVE_SSE4_1 + +#if HAVE_NEON +INSTANTIATE_TEST_SUITE_P( + NEON, UpsampleTestHB, + ::testing::Values(TestFuncsHBD(av1_highbd_upsample_intra_edge_c, + av1_highbd_upsample_intra_edge_neon))); +#endif // HAVE_NEON + +typedef void (*FEHB)(uint16_t *p, int size, int strength); +typedef libaom_test::FuncParam<FEHB> FilterEdgeTestFuncsHBD; + +class FilterEdgeTestHB : public FilterEdgeTest<FEHB, uint16_t> { + protected: + void Execute(uint16_t *edge_tst) override { + params_.ref_func(edge_ref_, size_, strength_); + API_REGISTER_STATE_CHECK(params_.tst_func(edge_tst, size_, strength_)); } - edge_tst_ = &edge_tst_data_[kOffset]; - for (int iter = 0; iter < test_count; ++iter) { - API_REGISTER_STATE_CHECK(params_.tst_func(edge_tst_, size_, strength_)); - // iterate over filter strengths (1,2,3) - strength_ = (strength_ == 3) ? 1 : strength_ + 1; + int bit_depth_; +}; + +TEST_P(FilterEdgeTestHB, RandomValues) { + for (int iter = 0; iter < kIterations && !HasFatalFailure(); ++iter) { + switch (rng_(3)) { + case 0: bit_depth_ = 8; break; + case 1: bit_depth_ = 10; break; + default: bit_depth_ = 12; break; + } + const int hi = 1 << bit_depth_; + strength_ = this->rng_(4); + size_ = 4 * (this->rng_(128 / 4) + 1) + 1; + + int i, pix = 0; + for (i = 0; i < kOffset + size_; ++i) { + pix = rng_(hi); + edge_ref_data_[i] = pix; + edge_tst_data_[i] = pix; + } + + Common(); } } @@ -330,8 +328,24 @@ TEST_P(FilterEdgeTestHB, DISABLED_Speed) { for (int iter = 0; iter < test_count; ++iter) { API_REGISTER_STATE_CHECK(params_.tst_func(edge_tst_, size_, strength_)); // iterate over filter strengths (1,2,3) - strength_ = (strength_ == 3) ? 1 : strength_ + 1; + strength_ = strength_ == 3 ? 1 : strength_ + 1; } } +#if HAVE_SSE4_1 +INSTANTIATE_TEST_SUITE_P(SSE4_1, FilterEdgeTestHB, + ::testing::Values(FilterEdgeTestFuncsHBD( + av1_highbd_filter_intra_edge_c, + av1_highbd_filter_intra_edge_sse4_1))); +#endif // HAVE_SSE4_1 + +#if HAVE_NEON +INSTANTIATE_TEST_SUITE_P(NEON, FilterEdgeTestHB, + ::testing::Values(FilterEdgeTestFuncsHBD( + av1_highbd_filter_intra_edge_c, + av1_highbd_filter_intra_edge_neon))); +#endif // HAVE_NEON + +#endif // CONFIG_AV1_HIGHBITDEPTH + } // namespace |