diff options
author | Yunqing Wang <yunqingwang@google.com> | 2023-06-12 16:44:21 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2023-06-12 16:44:21 +0000 |
commit | 8789421bf3ed15cd86b18b4bb8f0917fda0cccd7 (patch) | |
tree | 9a3145b990b8b0d21c098eee0bb22ffd85d1b52c /test | |
parent | bdb8ccc0af49a87c9f4ee08f1d363ceec347ab6e (diff) | |
parent | 8c308aefea7c58a1a979b81f4aa6d68908e379ee (diff) | |
download | libvpx-8789421bf3ed15cd86b18b4bb8f0917fda0cccd7.tar libvpx-8789421bf3ed15cd86b18b4bb8f0917fda0cccd7.tar.gz libvpx-8789421bf3ed15cd86b18b4bb8f0917fda0cccd7.tar.bz2 libvpx-8789421bf3ed15cd86b18b4bb8f0917fda0cccd7.zip |
Merge "Fix c vs intrinsic mismatch of vpx_hadamard_32x32() function" into main
Diffstat (limited to 'test')
-rw-r--r-- | test/hadamard_test.cc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/hadamard_test.cc b/test/hadamard_test.cc index 9f6c99f3c..0de6622e2 100644 --- a/test/hadamard_test.cc +++ b/test/hadamard_test.cc @@ -170,6 +170,31 @@ class HadamardTestBase : public ::testing::TestWithParam<HadamardFuncWithSize> { EXPECT_EQ(0, memcmp(b, b_ref, sizeof(b))); } + void ExtremeValuesTest() { + const int kMaxBlockSize = 32 * 32; + DECLARE_ALIGNED(16, int16_t, input_extreme_block[kMaxBlockSize]); + DECLARE_ALIGNED(16, tran_low_t, b[kMaxBlockSize]); + memset(b, 0, sizeof(b)); + + tran_low_t b_ref[kMaxBlockSize]; + memset(b_ref, 0, sizeof(b_ref)); + + for (int i = 0; i < 2; ++i) { + // Initialize a test block with input range [-mask_, mask_]. + const int sign = (i == 0) ? 1 : -1; + for (int j = 0; j < kMaxBlockSize; ++j) + input_extreme_block[j] = sign * 255; + + ReferenceHadamard(input_extreme_block, bwh_, b_ref, bwh_); + ASM_REGISTER_STATE_CHECK(h_func_(input_extreme_block, bwh_, b)); + + // The order of the output is not important. Sort before checking. + std::sort(b, b + block_size_); + std::sort(b_ref, b_ref + block_size_); + EXPECT_EQ(0, memcmp(b, b_ref, sizeof(b))); + } + } + void VaryStride() { const int kMaxBlockSize = 32 * 32; DECLARE_ALIGNED(16, int16_t, a[kMaxBlockSize * 8]); @@ -225,6 +250,8 @@ class HadamardLowbdTest : public HadamardTestBase { TEST_P(HadamardLowbdTest, CompareReferenceRandom) { CompareReferenceRandom(); } +TEST_P(HadamardLowbdTest, ExtremeValuesTest) { ExtremeValuesTest(); } + TEST_P(HadamardLowbdTest, VaryStride) { VaryStride(); } TEST_P(HadamardLowbdTest, DISABLED_Speed) { |