Commit 7a6e87b6 authored by Sebastien Alaiwan's avatar Sebastien Alaiwan
Browse files

Reduce scope of temporary arrays

Change-Id: Id59effcc6a27974ceaea3aed0d321dc478cda64b
parent b5138be3
......@@ -45,14 +45,6 @@ class AV1InvTxfm2d : public ::testing::TestWithParam<AV1InvTxfm2dParam> {
}
void RunRoundtripCheck() {
int16_t input_[64 * 64];
uint16_t ref_input_[64 * 64];
int32_t output_[64 * 64];
assert(txfm2d_size_ < ARRAY_SIZE(input_));
assert(txfm2d_size_ < ARRAY_SIZE(output_));
assert(txfm2d_size_ < ARRAY_SIZE(ref_input_));
const Fwd_Txfm2d_Func fwd_txfm_func =
libaom_test::fwd_txfm_func_ls[tx_size_];
const Inv_Txfm2d_Func inv_txfm_func =
......@@ -63,25 +55,31 @@ class AV1InvTxfm2d : public ::testing::TestWithParam<AV1InvTxfm2dParam> {
const int count_ = 500;
for (int ci = 0; ci < count_; ci++) {
int16_t expected[64 * 64] = { 0 };
assert(txfm2d_size_ < ARRAY_SIZE(expected));
for (int ni = 0; ni < txfm2d_size_; ++ni) {
if (ci == 0) {
int extreme_input = input_base - 1;
input_[ni] = extreme_input; // extreme case
ref_input_[ni] = 0;
expected[ni] = extreme_input; // extreme case
} else {
input_[ni] = rnd.Rand16() % input_base;
ref_input_[ni] = 0;
expected[ni] = rnd.Rand16() % input_base;
}
}
fwd_txfm_func(input_, output_, txfm1d_size_, tx_type_, bd);
inv_txfm_func(output_, ref_input_, txfm1d_size_, tx_type_, bd);
int32_t coeffs[64 * 64] = { 0 };
assert(txfm2d_size_ < ARRAY_SIZE(coeffs));
fwd_txfm_func(expected, coeffs, txfm1d_size_, tx_type_, bd);
uint16_t actual[64 * 64] = { 0 };
assert(txfm2d_size_ < ARRAY_SIZE(actual));
inv_txfm_func(coeffs, actual, txfm1d_size_, tx_type_, bd);
for (int ni = 0; ni < txfm2d_size_; ++ni) {
EXPECT_GE(max_error_, abs(input_[ni] - ref_input_[ni]));
EXPECT_GE(max_error_, abs(expected[ni] - actual[ni]));
}
avg_abs_error += compute_avg_abs_error<int16_t, uint16_t>(
input_, ref_input_, txfm2d_size_);
expected, actual, txfm2d_size_);
}
avg_abs_error /= count_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment