Modify highbd_inv_txfm test bench
Modified the test bench to support 8 bit testing.
Change-Id: I8d0329cb92768248279057e77af2b577d9de27cd
diff --git a/test/av1_highbd_iht_test.cc b/test/av1_highbd_iht_test.cc
index 28501a3..c287dae 100644
--- a/test/av1_highbd_iht_test.cc
+++ b/test/av1_highbd_iht_test.cc
@@ -33,7 +33,24 @@
typedef void (*IHbdHtFunc)(const int32_t *coeff, uint16_t *output, int stride,
TX_TYPE tx_type, int bd);
-
+static const char *tx_type_name[] = {
+ "DCT_DCT",
+ "ADST_DCT",
+ "DCT_ADST",
+ "ADST_ADST",
+ "FLIPADST_DCT",
+ "DCT_FLIPADST",
+ "FLIPADST_FLIPADST",
+ "ADST_FLIPADST",
+ "FLIPADST_ADST",
+ "IDTX",
+ "V_DCT",
+ "H_DCT",
+ "V_ADST",
+ "H_ADST",
+ "V_FLIPADST",
+ "H_FLIPADST",
+};
// Test parameter argument list:
// <transform reference function,
// optimized inverse transform function,
@@ -180,14 +197,15 @@
public:
virtual void SetUp() { target_func_ = GET_PARAM(0); }
void RunAV1InvTxfm2dTest(TX_TYPE tx_type, TX_SIZE tx_size, int run_times,
- int bit_depth);
+ int bit_depth, int gt_int16 = 0);
private:
HighbdInvTxfm2dFunc target_func_;
};
void AV1HighbdInvTxfm2d::RunAV1InvTxfm2dTest(TX_TYPE tx_type_, TX_SIZE tx_size_,
- int run_times, int bit_depth_) {
+ int run_times, int bit_depth_,
+ int gt_int16) {
FwdTxfm2dFunc fwd_func_ = libaom_test::fwd_txfm_func_ls[tx_size_];
TxfmParam txfm_param;
const int BLK_WIDTH = 64;
@@ -234,8 +252,14 @@
inv_input[scan[i]] = 0;
}
txfm_param.eob = eob;
- aom_usec_timer ref_timer, test_timer;
+ if (gt_int16) {
+ const uint16_t inv_input_mask = (1 << (bit_depth_ + 7)) - 1;
+ for (int i = 0; i < eob; i++) {
+ inv_input[scan[i]] = (rnd.Rand31() & inv_input_mask);
+ }
+ }
+ aom_usec_timer ref_timer, test_timer;
aom_usec_timer_start(&ref_timer);
for (int i = 0; i < run_times; ++i) {
av1_highbd_inv_txfm_add_c(inv_input, CONVERT_TO_BYTEPTR(ref_output),
@@ -264,7 +288,8 @@
ASSERT_EQ(ref_output[r * stride + c], output[r * stride + c])
<< "[" << r << "," << c << "] " << cnt
<< " tx_size: " << static_cast<int>(tx_size_)
- << " tx_type: " << tx_type_ << " eob " << eob;
+ << " bit_depth_: " << bit_depth_
+ << " tx_type: " << tx_type_name[tx_type_] << " eob " << eob;
}
}
}
@@ -272,8 +297,8 @@
}
TEST_P(AV1HighbdInvTxfm2d, match) {
- int bitdepth_ar[2] = { 10, 12 };
- for (int k = 0; k < 2; ++k) {
+ int bitdepth_ar[3] = { 8, 10, 12 };
+ for (int k = 0; k < 3; ++k) {
int bd = bitdepth_ar[k];
for (int j = 0; j < (int)(TX_SIZES_ALL); ++j) {
for (int i = 0; i < (int)TX_TYPES; ++i) {
@@ -287,6 +312,25 @@
}
}
+TEST_P(AV1HighbdInvTxfm2d, gt_int16) {
+ int bitdepth_ar[3] = { 8, 10, 12 };
+ static const TX_TYPE types[] = {
+ DCT_DCT, ADST_DCT, FLIPADST_DCT, IDTX, V_DCT, H_DCT, H_ADST, H_FLIPADST
+ };
+ for (int k = 0; k < 3; ++k) {
+ int bd = bitdepth_ar[k];
+ for (int j = 0; j < (int)(TX_SIZES_ALL); ++j) {
+ const TX_SIZE sz = static_cast<TX_SIZE>(j);
+ for (uint8_t i = 0; i < sizeof(types) / sizeof(TX_TYPE); ++i) {
+ const TX_TYPE tp = types[i];
+ if (libaom_test::IsTxSizeTypeValid(sz, tp)) {
+ RunAV1InvTxfm2dTest(tp, sz, 1, bd, 1);
+ }
+ }
+ }
+ }
+}
+
TEST_P(AV1HighbdInvTxfm2d, DISABLED_Speed) {
int bitdepth_ar[2] = { 10, 12 };
for (int k = 0; k < 2; ++k) {
@@ -303,15 +347,13 @@
}
}
-// TODO(yunqing): disabled sse4_1 and avx2 optimizations that caused test vector
-// mismatch. Will be enabled after the bug fix.
-// #if HAVE_SSE4_1
-// INSTANTIATE_TEST_CASE_P(SSE4_1, AV1HighbdInvTxfm2d,
-// ::testing::Values(av1_highbd_inv_txfm_add_sse4_1));
-// #endif
+#if HAVE_SSE4_1
+INSTANTIATE_TEST_CASE_P(SSE4_1, AV1HighbdInvTxfm2d,
+ ::testing::Values(av1_highbd_inv_txfm_add_sse4_1));
+#endif
-// #if HAVE_AVX2
-// INSTANTIATE_TEST_CASE_P(AVX2, AV1HighbdInvTxfm2d,
-// ::testing::Values(av1_highbd_inv_txfm_add_avx2));
-// #endif
+#if HAVE_AVX2
+INSTANTIATE_TEST_CASE_P(AVX2, AV1HighbdInvTxfm2d,
+ ::testing::Values(av1_highbd_inv_txfm_add_avx2));
+#endif
} // namespace