Commit d2db6586 authored by Angie Chiang's avatar Angie Chiang

Add rect txfm unit tests

Change-Id: I70f023a0a7f617bf3452543352c710cfedb2e1ce
parent 155bf9a7
......@@ -40,11 +40,12 @@ class AV1InvTxfm2d : public ::testing::TestWithParam<AV1InvTxfm2dParam> {
tx_size_ = GET_PARAM(1);
max_error_ = GET_PARAM(2);
max_avg_error_ = GET_PARAM(3);
txfm1d_size_ = libaom_test::get_txfm1d_size(tx_size_);
txfm2d_size_ = txfm1d_size_ * txfm1d_size_;
}
void RunRoundtripCheck() {
int tx_w = tx_size_wide[tx_size_];
int tx_h = tx_size_high[tx_size_];
int txfm2d_size = tx_w * tx_h;
const Fwd_Txfm2d_Func fwd_txfm_func =
libaom_test::fwd_txfm_func_ls[tx_size_];
const Inv_Txfm2d_Func inv_txfm_func =
......@@ -56,9 +57,9 @@ class AV1InvTxfm2d : public ::testing::TestWithParam<AV1InvTxfm2dParam> {
for (int ci = 0; ci < count; ci++) {
int16_t expected[64 * 64] = { 0 };
ASSERT_LT(txfm2d_size_, NELEMENTS(expected));
ASSERT_LT(txfm2d_size, NELEMENTS(expected));
for (int ni = 0; ni < txfm2d_size_; ++ni) {
for (int ni = 0; ni < txfm2d_size; ++ni) {
if (ci == 0) {
int extreme_input = input_base - 1;
expected[ni] = extreme_input; // extreme case
......@@ -68,25 +69,26 @@ class AV1InvTxfm2d : public ::testing::TestWithParam<AV1InvTxfm2dParam> {
}
int32_t coeffs[64 * 64] = { 0 };
ASSERT_LT(txfm2d_size_, NELEMENTS(coeffs));
fwd_txfm_func(expected, coeffs, txfm1d_size_, tx_type_, bd);
ASSERT_LT(txfm2d_size, NELEMENTS(coeffs));
fwd_txfm_func(expected, coeffs, tx_w, tx_type_, bd);
uint16_t actual[64 * 64] = { 0 };
ASSERT_LT(txfm2d_size_, NELEMENTS(actual));
inv_txfm_func(coeffs, actual, txfm1d_size_, tx_type_, bd);
ASSERT_LT(txfm2d_size, NELEMENTS(actual));
inv_txfm_func(coeffs, actual, tx_w, tx_type_, bd);
for (int ni = 0; ni < txfm2d_size_; ++ni) {
for (int ni = 0; ni < txfm2d_size; ++ni) {
EXPECT_GE(max_error_, abs(expected[ni] - actual[ni]));
}
avg_abs_error += compute_avg_abs_error<int16_t, uint16_t>(
expected, actual, txfm2d_size_);
expected, actual, txfm2d_size);
}
avg_abs_error /= count;
// max_abs_avg_error comes from upper bound of
// printf("txfm1d_size: %d accuracy_avg_abs_error: %f\n",
// txfm1d_size_, avg_abs_error);
EXPECT_GE(max_avg_error_, avg_abs_error);
EXPECT_GE(max_avg_error_, avg_abs_error)
<< " tx_w: " << tx_w << " tx_h " << tx_h << " tx_type: " << tx_type_;
}
private:
......@@ -94,14 +96,53 @@ class AV1InvTxfm2d : public ::testing::TestWithParam<AV1InvTxfm2dParam> {
double max_avg_error_;
TX_TYPE tx_type_;
TX_SIZE tx_size_;
int txfm1d_size_;
int txfm2d_size_;
};
TEST_P(AV1InvTxfm2d, RunRoundtripCheck) { RunRoundtripCheck(); }
const AV1InvTxfm2dParam av1_inv_txfm2d_param[] = {
#if CONFIG_EXT_TX
#if CONFIG_RECT_TX
AV1InvTxfm2dParam(DCT_DCT, TX_4X8, 2, 0.007),
AV1InvTxfm2dParam(ADST_DCT, TX_4X8, 2, 0.012),
AV1InvTxfm2dParam(DCT_ADST, TX_4X8, 2, 0.012),
AV1InvTxfm2dParam(ADST_ADST, TX_4X8, 2, 0.012),
AV1InvTxfm2dParam(FLIPADST_DCT, TX_4X8, 2, 0.012),
AV1InvTxfm2dParam(DCT_FLIPADST, TX_4X8, 2, 0.012),
AV1InvTxfm2dParam(FLIPADST_FLIPADST, TX_4X8, 2, 0.012),
AV1InvTxfm2dParam(ADST_FLIPADST, TX_4X8, 2, 0.012),
AV1InvTxfm2dParam(FLIPADST_ADST, TX_4X8, 2, 0.012),
AV1InvTxfm2dParam(DCT_DCT, TX_8X4, 2, 0.007),
AV1InvTxfm2dParam(ADST_DCT, TX_8X4, 2, 0.012),
AV1InvTxfm2dParam(DCT_ADST, TX_8X4, 2, 0.012),
AV1InvTxfm2dParam(ADST_ADST, TX_8X4, 2, 0.012),
AV1InvTxfm2dParam(FLIPADST_DCT, TX_8X4, 2, 0.007),
AV1InvTxfm2dParam(DCT_FLIPADST, TX_8X4, 2, 0.012),
AV1InvTxfm2dParam(FLIPADST_FLIPADST, TX_8X4, 2, 0.012),
AV1InvTxfm2dParam(ADST_FLIPADST, TX_8X4, 2, 0.012),
AV1InvTxfm2dParam(FLIPADST_ADST, TX_8X4, 2, 0.012),
AV1InvTxfm2dParam(DCT_DCT, TX_8X16, 2, 0.025),
AV1InvTxfm2dParam(ADST_DCT, TX_8X16, 2, 0.020),
AV1InvTxfm2dParam(DCT_ADST, TX_8X16, 2, 0.027),
AV1InvTxfm2dParam(ADST_ADST, TX_8X16, 2, 0.023),
AV1InvTxfm2dParam(FLIPADST_DCT, TX_8X16, 2, 0.020),
AV1InvTxfm2dParam(DCT_FLIPADST, TX_8X16, 2, 0.027),
AV1InvTxfm2dParam(FLIPADST_FLIPADST, TX_8X16, 2, 0.032),
AV1InvTxfm2dParam(ADST_FLIPADST, TX_8X16, 2, 0.023),
AV1InvTxfm2dParam(FLIPADST_ADST, TX_8X16, 2, 0.023),
AV1InvTxfm2dParam(DCT_DCT, TX_16X8, 2, 0.007),
AV1InvTxfm2dParam(ADST_DCT, TX_16X8, 2, 0.012),
AV1InvTxfm2dParam(DCT_ADST, TX_16X8, 2, 0.024),
AV1InvTxfm2dParam(ADST_ADST, TX_16X8, 2, 0.033),
AV1InvTxfm2dParam(FLIPADST_DCT, TX_16X8, 2, 0.015),
AV1InvTxfm2dParam(DCT_FLIPADST, TX_16X8, 2, 0.032),
AV1InvTxfm2dParam(FLIPADST_FLIPADST, TX_16X8, 2, 0.032),
AV1InvTxfm2dParam(ADST_FLIPADST, TX_16X8, 2, 0.033),
AV1InvTxfm2dParam(FLIPADST_ADST, TX_16X8, 2, 0.032),
#endif
AV1InvTxfm2dParam(FLIPADST_DCT, TX_4X4, 2, 0.002),
AV1InvTxfm2dParam(DCT_FLIPADST, TX_4X4, 2, 0.002),
AV1InvTxfm2dParam(FLIPADST_FLIPADST, TX_4X4, 2, 0.002),
......
......@@ -78,21 +78,52 @@ static const int input_base = (1 << bd);
#if CONFIG_HIGHBITDEPTH
#if CONFIG_AV1_ENCODER
static const Fwd_Txfm2d_Func fwd_txfm_func_ls[TX_SIZES] = {
static const Fwd_Txfm2d_Func fwd_txfm_func_ls[TX_SIZES_ALL] = {
#if CONFIG_CHROMA_2X2
NULL,
#endif
av1_fwd_txfm2d_4x4_c, av1_fwd_txfm2d_8x8_c, av1_fwd_txfm2d_16x16_c,
av1_fwd_txfm2d_32x32_c
av1_fwd_txfm2d_4x4_c,
av1_fwd_txfm2d_8x8_c,
av1_fwd_txfm2d_16x16_c,
av1_fwd_txfm2d_32x32_c,
#if CONFIG_TX64X64
av1_fwd_txfm2d_64x64_c,
#endif
av1_fwd_txfm2d_4x8_c,
av1_fwd_txfm2d_8x4_c,
av1_fwd_txfm2d_8x16_c,
av1_fwd_txfm2d_16x8_c,
av1_fwd_txfm2d_16x32_c,
av1_fwd_txfm2d_32x16_c,
NULL,
NULL,
NULL,
NULL,
};
#endif
static const Inv_Txfm2d_Func inv_txfm_func_ls[TX_SIZES] = {
static const Inv_Txfm2d_Func inv_txfm_func_ls[TX_SIZES_ALL] = {
#if CONFIG_CHROMA_2X2
NULL,
#endif
av1_inv_txfm2d_add_4x4_c, av1_inv_txfm2d_add_8x8_c,
av1_inv_txfm2d_add_16x16_c, av1_inv_txfm2d_add_32x32_c
av1_inv_txfm2d_add_4x4_c,
av1_inv_txfm2d_add_8x8_c,
av1_inv_txfm2d_add_16x16_c,
av1_inv_txfm2d_add_32x32_c,
#if CONFIG_TX64X64
av1_inv_txfm2d_add_64x64_c,
#endif
av1_inv_txfm2d_add_4x8_c,
av1_inv_txfm2d_add_8x4_c,
av1_inv_txfm2d_add_8x16_c,
av1_inv_txfm2d_add_16x8_c,
av1_inv_txfm2d_add_16x32_c,
av1_inv_txfm2d_add_32x16_c,
NULL,
NULL,
NULL,
NULL,
};
#endif // CONFIG_HIGHBITDEPTH
......
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