diff options
Diffstat (limited to 'third_party/aom/test/masked_sad_test.cc')
-rw-r--r-- | third_party/aom/test/masked_sad_test.cc | 63 |
1 files changed, 40 insertions, 23 deletions
diff --git a/third_party/aom/test/masked_sad_test.cc b/third_party/aom/test/masked_sad_test.cc index 53f85eef7..2dde3c537 100644 --- a/third_party/aom/test/masked_sad_test.cc +++ b/third_party/aom/test/masked_sad_test.cc @@ -25,11 +25,13 @@ using libaom_test::ACMRandom; namespace { -const int number_of_iterations = 500; +const int number_of_iterations = 200; -typedef unsigned int (*MaskedSADFunc)(const uint8_t *a, int a_stride, - const uint8_t *b, int b_stride, - const uint8_t *m, int m_stride); +typedef unsigned int (*MaskedSADFunc)(const uint8_t *src, int src_stride, + const uint8_t *ref, int ref_stride, + const uint8_t *second_pred, + const uint8_t *msk, int msk_stride, + int invert_mask); typedef std::tr1::tuple<MaskedSADFunc, MaskedSADFunc> MaskedSADParam; class MaskedSADTest : public ::testing::TestWithParam<MaskedSADParam> { @@ -52,6 +54,7 @@ TEST_P(MaskedSADTest, OperationCheck) { ACMRandom rnd(ACMRandom::DeterministicSeed()); DECLARE_ALIGNED(16, uint8_t, src_ptr[MAX_SB_SIZE * MAX_SB_SIZE]); DECLARE_ALIGNED(16, uint8_t, ref_ptr[MAX_SB_SIZE * MAX_SB_SIZE]); + DECLARE_ALIGNED(16, uint8_t, second_pred_ptr[MAX_SB_SIZE * MAX_SB_SIZE]); DECLARE_ALIGNED(16, uint8_t, msk_ptr[MAX_SB_SIZE * MAX_SB_SIZE]); int err_count = 0; int first_failure = -1; @@ -62,18 +65,23 @@ TEST_P(MaskedSADTest, OperationCheck) { for (int j = 0; j < MAX_SB_SIZE * MAX_SB_SIZE; j++) { src_ptr[j] = rnd.Rand8(); ref_ptr[j] = rnd.Rand8(); + second_pred_ptr[j] = rnd.Rand8(); msk_ptr[j] = ((rnd.Rand8() & 0x7f) > 64) ? rnd.Rand8() & 0x3f : 64; assert(msk_ptr[j] <= 64); } - ref_ret = ref_maskedSAD_op_(src_ptr, src_stride, ref_ptr, ref_stride, - msk_ptr, msk_stride); - ASM_REGISTER_STATE_CHECK(ret = maskedSAD_op_(src_ptr, src_stride, ref_ptr, - ref_stride, msk_ptr, - msk_stride)); - if (ret != ref_ret) { - err_count++; - if (first_failure == -1) first_failure = i; + for (int invert_mask = 0; invert_mask < 2; ++invert_mask) { + ref_ret = + ref_maskedSAD_op_(src_ptr, src_stride, ref_ptr, ref_stride, + second_pred_ptr, msk_ptr, msk_stride, invert_mask); + ASM_REGISTER_STATE_CHECK(ret = maskedSAD_op_(src_ptr, src_stride, ref_ptr, + ref_stride, second_pred_ptr, + msk_ptr, msk_stride, + invert_mask)); + if (ret != ref_ret) { + err_count++; + if (first_failure == -1) first_failure = i; + } } } EXPECT_EQ(0, err_count) @@ -82,9 +90,11 @@ TEST_P(MaskedSADTest, OperationCheck) { } #if CONFIG_HIGHBITDEPTH -typedef unsigned int (*HighbdMaskedSADFunc)(const uint8_t *a, int a_stride, - const uint8_t *b, int b_stride, - const uint8_t *m, int m_stride); +typedef unsigned int (*HighbdMaskedSADFunc)(const uint8_t *src, int src_stride, + const uint8_t *ref, int ref_stride, + const uint8_t *second_pred, + const uint8_t *msk, int msk_stride, + int invert_mask); typedef std::tr1::tuple<HighbdMaskedSADFunc, HighbdMaskedSADFunc> HighbdMaskedSADParam; @@ -109,9 +119,11 @@ TEST_P(HighbdMaskedSADTest, OperationCheck) { ACMRandom rnd(ACMRandom::DeterministicSeed()); DECLARE_ALIGNED(16, uint16_t, src_ptr[MAX_SB_SIZE * MAX_SB_SIZE]); DECLARE_ALIGNED(16, uint16_t, ref_ptr[MAX_SB_SIZE * MAX_SB_SIZE]); + DECLARE_ALIGNED(16, uint16_t, second_pred_ptr[MAX_SB_SIZE * MAX_SB_SIZE]); DECLARE_ALIGNED(16, uint8_t, msk_ptr[MAX_SB_SIZE * MAX_SB_SIZE]); uint8_t *src8_ptr = CONVERT_TO_BYTEPTR(src_ptr); uint8_t *ref8_ptr = CONVERT_TO_BYTEPTR(ref_ptr); + uint8_t *second_pred8_ptr = CONVERT_TO_BYTEPTR(second_pred_ptr); int err_count = 0; int first_failure = -1; int src_stride = MAX_SB_SIZE; @@ -121,17 +133,22 @@ TEST_P(HighbdMaskedSADTest, OperationCheck) { for (int j = 0; j < MAX_SB_SIZE * MAX_SB_SIZE; j++) { src_ptr[j] = rnd.Rand16() & 0xfff; ref_ptr[j] = rnd.Rand16() & 0xfff; + second_pred_ptr[j] = rnd.Rand16() & 0xfff; msk_ptr[j] = ((rnd.Rand8() & 0x7f) > 64) ? rnd.Rand8() & 0x3f : 64; } - ref_ret = ref_maskedSAD_op_(src8_ptr, src_stride, ref8_ptr, ref_stride, - msk_ptr, msk_stride); - ASM_REGISTER_STATE_CHECK(ret = maskedSAD_op_(src8_ptr, src_stride, ref8_ptr, - ref_stride, msk_ptr, - msk_stride)); - if (ret != ref_ret) { - err_count++; - if (first_failure == -1) first_failure = i; + for (int invert_mask = 0; invert_mask < 2; ++invert_mask) { + ref_ret = + ref_maskedSAD_op_(src8_ptr, src_stride, ref8_ptr, ref_stride, + second_pred8_ptr, msk_ptr, msk_stride, invert_mask); + ASM_REGISTER_STATE_CHECK(ret = maskedSAD_op_(src8_ptr, src_stride, + ref8_ptr, ref_stride, + second_pred8_ptr, msk_ptr, + msk_stride, invert_mask)); + if (ret != ref_ret) { + err_count++; + if (first_failure == -1) first_failure = i; + } } } EXPECT_EQ(0, err_count) |