diff options
author | Linfeng Zhang <linfengz@google.com> | 2017-05-17 17:53:02 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-05-17 17:53:03 +0000 |
commit | 13918a9ccce87c598035a63fd17fb14a203f7cea (patch) | |
tree | 983ca124f55df57d9c99b17f5ddd7baa7e7a17e4 | |
parent | bde2c04fb7f3d4b59326f233f96a63a93650621e (diff) | |
parent | 3210ca6d6044e2a6d01a3f8584f7279107eff7d8 (diff) | |
download | libvpx-13918a9ccce87c598035a63fd17fb14a203f7cea.tar libvpx-13918a9ccce87c598035a63fd17fb14a203f7cea.tar.gz libvpx-13918a9ccce87c598035a63fd17fb14a203f7cea.tar.bz2 libvpx-13918a9ccce87c598035a63fd17fb14a203f7cea.zip |
Merge "Update partial idct testing code"
-rw-r--r-- | test/partial_idct_test.cc | 61 |
1 files changed, 46 insertions, 15 deletions
diff --git a/test/partial_idct_test.cc b/test/partial_idct_test.cc index 2dda7da45..da9316746 100644 --- a/test/partial_idct_test.cc +++ b/test/partial_idct_test.cc @@ -128,11 +128,11 @@ class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> { } void InitInput() { - const int max_coeff = 32766 / 4; + const int max_coeff = (32766 << (bit_depth_ - 8)) / 4; int max_energy_leftover = max_coeff * max_coeff; for (int j = 0; j < last_nonzero_; ++j) { - int16_t coeff = static_cast<int16_t>(sqrt(1.0 * max_energy_leftover) * - (rnd_.Rand16() - 32768) / 65536); + tran_low_t coeff = static_cast<tran_low_t>( + sqrt(1.0 * max_energy_leftover) * (rnd_.Rand16() - 32768) / 65536); max_energy_leftover -= coeff * coeff; if (max_energy_leftover < 0) { max_energy_leftover = 0; @@ -142,6 +142,28 @@ class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> { } } + void PrintDiff() { + if (memcmp(output_block_ref_, output_block_, + pixel_size_ * output_block_size_)) { + uint16_t ref, opt; + for (int y = 0; y < size_; y++) { + for (int x = 0; x < size_; x++) { + if (pixel_size_ == 1) { + ref = output_block_ref_[y * stride_ + x]; + opt = output_block_[y * stride_ + x]; + } else { + ref = reinterpret_cast<uint16_t *>( + output_block_ref_)[y * stride_ + x]; + opt = reinterpret_cast<uint16_t *>(output_block_)[y * stride_ + x]; + } + if (ref != opt) { + printf("dest[%d][%d] diff:%6d (ref),%6d (opt)\n", y, x, ref, opt); + } + } + } + } + } + protected: int last_nonzero_; TX_SIZE tx_size_; @@ -162,23 +184,32 @@ class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> { }; TEST_P(PartialIDctTest, RunQuantCheck) { + const int count_test_block = (size_ != 4) ? kCountTestBlock : 65536; DECLARE_ALIGNED(16, int16_t, input_extreme_block[kMaxNumCoeffs]); DECLARE_ALIGNED(16, tran_low_t, output_ref_block[kMaxNumCoeffs]); InitMem(); - for (int i = 0; i < kCountTestBlock; ++i) { + + for (int i = 0; i < count_test_block; ++i) { // Initialize a test block with input range [-mask_, mask_]. - if (i == 0) { - for (int k = 0; k < input_block_size_; ++k) { - input_extreme_block[k] = mask_; - } - } else if (i == 1) { - for (int k = 0; k < input_block_size_; ++k) { - input_extreme_block[k] = -mask_; + if (size_ != 4) { + if (i == 0) { + for (int k = 0; k < input_block_size_; ++k) { + input_extreme_block[k] = mask_; + } + } else if (i == 1) { + for (int k = 0; k < input_block_size_; ++k) { + input_extreme_block[k] = -mask_; + } + } else { + for (int k = 0; k < input_block_size_; ++k) { + input_extreme_block[k] = rnd_.Rand8() % 2 ? mask_ : -mask_; + } } } else { + // Try all possible combinations. for (int k = 0; k < input_block_size_; ++k) { - input_extreme_block[k] = rnd_.Rand8() % 2 ? mask_ : -mask_; + input_extreme_block[k] = (i & (1 << k)) ? mask_ : -mask_; } } @@ -277,9 +308,9 @@ TEST_P(PartialIDctTest, DISABLED_Speed) { vpx_usec_timer_mark(&timer); const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer) / 1000); - printf("idct%dx%d_%d (bitdepth %d) time: %5d ms\n", size_, size_, - last_nonzero_, bit_depth_, elapsed_time); - + printf("idct%dx%d_%d (%s %d) time: %5d ms\n", size_, size_, last_nonzero_, + (pixel_size_ == 1) ? "bitdepth" : "high bitdepth", bit_depth_, + elapsed_time); ASSERT_EQ(0, memcmp(output_block_ref_, output_block_, pixel_size_ * output_block_size_)) << "Error: partial inverse transform produces different results"; |