diff options
author | Johann <johannkoenig@google.com> | 2017-05-01 09:10:06 -0700 |
---|---|---|
committer | Johann <johannkoenig@google.com> | 2017-05-04 08:59:42 -0700 |
commit | cb9133c72f06fcc595c8117078c9689258dd0cf6 (patch) | |
tree | 2b3af9d03ccb105fdc3c94d82b827e1303c7df62 /test/variance_test.cc | |
parent | a10a5cb3567a0cfcea73c2e3765bc86d427646e3 (diff) | |
download | libvpx-cb9133c72f06fcc595c8117078c9689258dd0cf6.tar libvpx-cb9133c72f06fcc595c8117078c9689258dd0cf6.tar.gz libvpx-cb9133c72f06fcc595c8117078c9689258dd0cf6.tar.bz2 libvpx-cb9133c72f06fcc595c8117078c9689258dd0cf6.zip |
neon variance: add small missing sizes
Some of the mixed sizes were missing. They can be implemented trivially
using the existing helper function.
When comparing the previous 16x8 and 8x16 implementations, the helper
function is about 10% faster than the 16x8 version. The 8x16 is very
close, but the existing version appears to be faster.
BUG=webm:1422
Change-Id: Ib0e856083c1893e1bd399373c5fbcd6271a7f004
Diffstat (limited to 'test/variance_test.cc')
-rw-r--r-- | test/variance_test.cc | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/test/variance_test.cc b/test/variance_test.cc index 6e31165fa..ff6914360 100644 --- a/test/variance_test.cc +++ b/test/variance_test.cc @@ -22,6 +22,7 @@ #include "vpx/vpx_integer.h" #include "vpx_mem/vpx_mem.h" #include "vpx_ports/mem.h" +#include "vpx_ports/vpx_timer.h" namespace { @@ -345,6 +346,7 @@ class MainTestClass void RefTest(); void RefStrideTest(); void OneQuarterTest(); + void SpeedTest(); // MSE/SSE tests void RefTestMse(); @@ -363,6 +365,7 @@ class MainTestClass int byte_shift() const { return params_.bit_depth - 8; } int block_size() const { return params_.block_size; } int width() const { return params_.width; } + int height() const { return params_.height; } uint32_t mask() const { return params_.mask; } }; @@ -471,6 +474,35 @@ void MainTestClass<VarianceFunctionType>::OneQuarterTest() { EXPECT_EQ(expected, var); } +template <typename VarianceFunctionType> +void MainTestClass<VarianceFunctionType>::SpeedTest() { + const int half = block_size() / 2; + if (!use_high_bit_depth()) { + memset(src_, 255, block_size()); + memset(ref_, 255, half); + memset(ref_ + half, 0, half); +#if CONFIG_VP9_HIGHBITDEPTH + } else { + vpx_memset16(CONVERT_TO_SHORTPTR(src_), 255 << byte_shift(), block_size()); + vpx_memset16(CONVERT_TO_SHORTPTR(ref_), 255 << byte_shift(), half); + vpx_memset16(CONVERT_TO_SHORTPTR(ref_) + half, 0, half); +#endif // CONFIG_VP9_HIGHBITDEPTH + } + unsigned int sse; + + vpx_usec_timer timer; + vpx_usec_timer_start(&timer); + for (int i = 0; i < 100000000 / block_size(); ++i) { + const uint32_t variance = params_.func(src_, width(), ref_, width(), &sse); + // Ignore return value. + (void)variance; + } + vpx_usec_timer_mark(&timer); + const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer)); + printf("Variance %dx%d time: %5d ms\n", width(), height(), + elapsed_time / 1000); +} + //////////////////////////////////////////////////////////////////////////////// // Tests related to MSE / SSE. @@ -727,6 +759,7 @@ TEST_P(VpxVarianceTest, Zero) { ZeroTest(); } TEST_P(VpxVarianceTest, Ref) { RefTest(); } TEST_P(VpxVarianceTest, RefStride) { RefStrideTest(); } TEST_P(VpxVarianceTest, OneQuarter) { OneQuarterTest(); } +TEST_P(VpxVarianceTest, DISABLED_Speed) { SpeedTest(); } TEST_P(SumOfSquaresTest, Const) { ConstTest(); } TEST_P(SumOfSquaresTest, Ref) { RefTest(); } TEST_P(VpxSubpelVarianceTest, Ref) { RefTest(); } @@ -809,6 +842,7 @@ TEST_P(VpxHBDVarianceTest, Zero) { ZeroTest(); } TEST_P(VpxHBDVarianceTest, Ref) { RefTest(); } TEST_P(VpxHBDVarianceTest, RefStride) { RefStrideTest(); } TEST_P(VpxHBDVarianceTest, OneQuarter) { OneQuarterTest(); } +TEST_P(VpxHBDVarianceTest, DISABLED_Speed) { SpeedTest(); } TEST_P(VpxHBDSubpelVarianceTest, Ref) { RefTest(); } TEST_P(VpxHBDSubpelVarianceTest, ExtremeRef) { ExtremeRefTest(); } TEST_P(VpxHBDSubpelAvgVarianceTest, Ref) { RefTest(); } @@ -1219,10 +1253,13 @@ INSTANTIATE_TEST_CASE_P( VarianceParams(6, 5, &vpx_variance64x32_neon), VarianceParams(5, 6, &vpx_variance32x64_neon), VarianceParams(5, 5, &vpx_variance32x32_neon), + VarianceParams(5, 4, &vpx_variance32x16_neon), + VarianceParams(4, 5, &vpx_variance16x32_neon), VarianceParams(4, 4, &vpx_variance16x16_neon), VarianceParams(4, 3, &vpx_variance16x8_neon), VarianceParams(3, 4, &vpx_variance8x16_neon), - VarianceParams(3, 3, &vpx_variance8x8_neon))); + VarianceParams(3, 3, &vpx_variance8x8_neon), + VarianceParams(3, 2, &vpx_variance8x4_neon))); INSTANTIATE_TEST_CASE_P( NEON, VpxSubpelVarianceTest, |