summaryrefslogtreecommitdiffstats
path: root/third_party/aom/test/transform_test_base.h
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/aom/test/transform_test_base.h')
-rw-r--r--third_party/aom/test/transform_test_base.h34
1 files changed, 4 insertions, 30 deletions
diff --git a/third_party/aom/test/transform_test_base.h b/third_party/aom/test/transform_test_base.h
index 21441beef..67e8faf33 100644
--- a/third_party/aom/test/transform_test_base.h
+++ b/third_party/aom/test/transform_test_base.h
@@ -12,7 +12,8 @@
#ifndef TEST_TRANSFORM_TEST_BASE_H_
#define TEST_TRANSFORM_TEST_BASE_H_
-#include "./aom_config.h"
+#include "config/aom_config.h"
+
#include "aom_mem/aom_mem.h"
#include "aom/aom_codec.h"
#include "aom_dsp/txfm_common.h"
@@ -57,12 +58,10 @@ class TransformTestBase {
aom_memalign(16, sizeof(uint8_t) * num_coeffs_));
uint8_t *src = reinterpret_cast<uint8_t *>(
aom_memalign(16, sizeof(uint8_t) * num_coeffs_));
-#if CONFIG_HIGHBITDEPTH
uint16_t *dst16 = reinterpret_cast<uint16_t *>(
aom_memalign(16, sizeof(uint16_t) * num_coeffs_));
uint16_t *src16 = reinterpret_cast<uint16_t *>(
aom_memalign(16, sizeof(uint16_t) * num_coeffs_));
-#endif
for (int i = 0; i < count_test_block; ++i) {
// Initialize a test block with input range [-255, 255].
@@ -71,12 +70,10 @@ class TransformTestBase {
src[j] = rnd.Rand8();
dst[j] = rnd.Rand8();
test_input_block[j] = src[j] - dst[j];
-#if CONFIG_HIGHBITDEPTH
} else {
src16[j] = rnd.Rand16() & mask_;
dst16[j] = rnd.Rand16() & mask_;
test_input_block[j] = src16[j] - dst16[j];
-#endif
}
}
@@ -84,21 +81,14 @@ class TransformTestBase {
RunFwdTxfm(test_input_block, test_temp_block, pitch_));
if (bit_depth_ == AOM_BITS_8) {
ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_));
-#if CONFIG_HIGHBITDEPTH
} else {
ASM_REGISTER_STATE_CHECK(
RunInvTxfm(test_temp_block, CONVERT_TO_BYTEPTR(dst16), pitch_));
-#endif
}
for (int j = 0; j < num_coeffs_; ++j) {
-#if CONFIG_HIGHBITDEPTH
const int diff =
bit_depth_ == AOM_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
-#else
- ASSERT_EQ(AOM_BITS_8, bit_depth_);
- const int diff = dst[j] - src[j];
-#endif
const uint32_t error = diff * diff;
if (max_error < error) max_error = error;
total_error += error;
@@ -119,10 +109,8 @@ class TransformTestBase {
aom_free(test_temp_block);
aom_free(dst);
aom_free(src);
-#if CONFIG_HIGHBITDEPTH
aom_free(dst16);
aom_free(src16);
-#endif
}
void RunCoeffCheck() {
@@ -149,11 +137,9 @@ class TransformTestBase {
input_block[in_idx] = (rnd.Rand16() & mask_) - (rnd.Rand16() & mask_);
if (bit_depth_ == AOM_BITS_8) {
output_block[out_idx] = output_ref_block[out_idx] = rnd.Rand8();
-#if CONFIG_HIGHBITDEPTH
} else {
output_block[out_idx] = output_ref_block[out_idx] =
rnd.Rand16() & mask_;
-#endif
}
}
}
@@ -255,7 +241,7 @@ class TransformTestBase {
int row_length = FindRowLength();
// The minimum quant value is 4.
for (int j = 0; j < num_coeffs_; ++j) {
- EXPECT_EQ(output_block[j], output_ref_block[j])
+ ASSERT_EQ(output_block[j], output_ref_block[j])
<< "Not bit-exact at test index: " << i << ", "
<< "j = " << j << std::endl;
EXPECT_GE(row_length * kDctMaxValue << (bit_depth_ - 8),
@@ -281,12 +267,10 @@ class TransformTestBase {
uint8_t *src = reinterpret_cast<uint8_t *>(
aom_memalign(16, sizeof(uint8_t) * num_coeffs_));
-#if CONFIG_HIGHBITDEPTH
uint16_t *dst16 = reinterpret_cast<uint16_t *>(
aom_memalign(16, sizeof(uint16_t) * num_coeffs_));
uint16_t *src16 = reinterpret_cast<uint16_t *>(
aom_memalign(16, sizeof(uint16_t) * num_coeffs_));
-#endif
for (int i = 0; i < count_test_block; ++i) {
// Initialize a test block with input range [-mask_, mask_].
@@ -295,12 +279,10 @@ class TransformTestBase {
src[j] = rnd.Rand8();
dst[j] = rnd.Rand8();
in[j] = src[j] - dst[j];
-#if CONFIG_HIGHBITDEPTH
} else {
src16[j] = rnd.Rand16() & mask_;
dst16[j] = rnd.Rand16() & mask_;
in[j] = src16[j] - dst16[j];
-#endif
}
}
@@ -308,22 +290,16 @@ class TransformTestBase {
if (bit_depth_ == AOM_BITS_8) {
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));
-#if CONFIG_HIGHBITDEPTH
} else {
ASM_REGISTER_STATE_CHECK(
RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_));
-#endif
}
for (int j = 0; j < num_coeffs_; ++j) {
-#if CONFIG_HIGHBITDEPTH
const int diff =
bit_depth_ == AOM_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
-#else
- const int diff = dst[j] - src[j];
-#endif
const uint32_t error = diff * diff;
- EXPECT_GE(static_cast<uint32_t>(limit), error)
+ ASSERT_GE(static_cast<uint32_t>(limit), error)
<< "Error: 4x4 IDCT has error " << error << " at index " << j;
}
}
@@ -331,10 +307,8 @@ class TransformTestBase {
aom_free(coeff);
aom_free(dst);
aom_free(src);
-#if CONFIG_HIGHBITDEPTH
aom_free(src16);
aom_free(dst16);
-#endif
}
int pitch_;