ref: 4555c50ecd1fed9305b7656279e6a5e961087cf2
parent: aadfde46878351e5591c1e23dfbb52f4d35d858e
parent: ed2c2405380eb5f418b47c02d786a0a21b8723ee
author: Johann Koenig <johannkoenig@google.com>
date: Thu Oct 27 11:41:43 EDT 2016
Merge "partial_idct_test: consolidate block size"
--- a/test/partial_idct_test.cc
+++ b/test/partial_idct_test.cc
@@ -49,13 +49,14 @@
case TX_32X32: size_ = 32; break;
default: FAIL() << "Wrong Size!"; break;
}
+ block_size_ = size_ * size_;
input_block_ = reinterpret_cast<tran_low_t *>(
- vpx_memalign(16, sizeof(*input_block_) * size_ * size_));
+ vpx_memalign(16, sizeof(*input_block_) * block_size_));
output_block_ = reinterpret_cast<uint8_t *>(
- vpx_memalign(16, sizeof(*output_block_) * size_ * size_));
+ vpx_memalign(16, sizeof(*output_block_) * block_size_));
output_block_ref_ = reinterpret_cast<uint8_t *>(
- vpx_memalign(16, sizeof(*output_block_ref_) * size_ * size_));
+ vpx_memalign(16, sizeof(*output_block_ref_) * block_size_));
}
virtual void TearDown() {
@@ -75,6 +76,7 @@
uint8_t *output_block_;
uint8_t *output_block_ref_;
int size_;
+ int block_size_;
FwdTxfmFunc ftxfm_;
InvTxfmFunc full_itxfm_;
InvTxfmFunc partial_itxfm_;
@@ -84,7 +86,6 @@
ACMRandom rnd(ACMRandom::DeterministicSeed());
const int count_test_block = 1000;
- const int block_size = size_ * size_;
DECLARE_ALIGNED(16, int16_t, input_extreme_block[kMaxNumCoeffs]);
DECLARE_ALIGNED(16, tran_low_t, output_ref_block[kMaxNumCoeffs]);
@@ -91,9 +92,9 @@
for (int i = 0; i < count_test_block; ++i) {
// clear out destination buffer
- memset(input_block_, 0, sizeof(*input_block_) * block_size);
- memset(output_block_, 0, sizeof(*output_block_) * block_size);
- memset(output_block_ref_, 0, sizeof(*output_block_ref_) * block_size);
+ memset(input_block_, 0, sizeof(*input_block_) * block_size_);
+ memset(output_block_, 0, sizeof(*output_block_) * block_size_);
+ memset(output_block_ref_, 0, sizeof(*output_block_ref_) * block_size_);
ACMRandom rnd(ACMRandom::DeterministicSeed());
@@ -100,11 +101,11 @@
for (int i = 0; i < count_test_block; ++i) {
// Initialize a test block with input range [-255, 255].
if (i == 0) {
- for (int j = 0; j < block_size; ++j) input_extreme_block[j] = 255;
+ for (int j = 0; j < block_size_; ++j) input_extreme_block[j] = 255;
} else if (i == 1) {
- for (int j = 0; j < block_size; ++j) input_extreme_block[j] = -255;
+ for (int j = 0; j < block_size_; ++j) input_extreme_block[j] = -255;
} else {
- for (int j = 0; j < block_size; ++j) {
+ for (int j = 0; j < block_size_; ++j) {
input_extreme_block[j] = rnd.Rand8() % 2 ? 255 : -255;
}
}
@@ -125,7 +126,7 @@
partial_itxfm_(input_block_, output_block_, size_));
ASSERT_EQ(0, memcmp(output_block_ref_, output_block_,
- sizeof(*output_block_) * block_size))
+ sizeof(*output_block_) * block_size_))
<< "Error: partial inverse transform produces different results";
}
}
@@ -134,12 +135,11 @@
ACMRandom rnd(ACMRandom::DeterministicSeed());
const int count_test_block = 1000;
const int max_coeff = 32766 / 4;
- const int block_size = size_ * size_;
for (int i = 0; i < count_test_block; ++i) {
// clear out destination buffer
- memset(input_block_, 0, sizeof(tran_low_t) * block_size);
- memset(output_block_, 0, sizeof(*output_block_) * block_size);
- memset(output_block_ref_, 0, sizeof(*output_block_ref_) * block_size);
+ memset(input_block_, 0, sizeof(*input_block_) * block_size_);
+ memset(output_block_, 0, sizeof(*output_block_) * block_size_);
+ memset(output_block_ref_, 0, sizeof(*output_block_ref_) * block_size_);
int max_energy_leftover = max_coeff * max_coeff;
for (int j = 0; j < last_nonzero_; ++j) {
int16_t coef = static_cast<int16_t>(sqrt(1.0 * max_energy_leftover) *
@@ -158,7 +158,7 @@
partial_itxfm_(input_block_, output_block_, size_));
ASSERT_EQ(0, memcmp(output_block_ref_, output_block_,
- sizeof(*output_block_) * block_size))
+ sizeof(*output_block_) * block_size_))
<< "Error: partial inverse transform produces different results";
}
}