Merge "Update partial idct testing code"
This commit is contained in:
commit
13918a9ccc
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user