Commit aa84f3e6 authored by Debargha Mukherjee's avatar Debargha Mukherjee

Enhance tests to include fwd/inv 1D transforms

All test pass with --enable-coeffecient-range-checking.

Change-Id: I89fecfcbaabb37f7cf89bceaf3c3caaa5d704e55
parent e2f6b166
...@@ -18,10 +18,12 @@ using libaom_test::reference_hybrid_1d; ...@@ -18,10 +18,12 @@ using libaom_test::reference_hybrid_1d;
using libaom_test::TYPE_TXFM; using libaom_test::TYPE_TXFM;
using libaom_test::TYPE_DCT; using libaom_test::TYPE_DCT;
using libaom_test::TYPE_ADST; using libaom_test::TYPE_ADST;
using libaom_test::TYPE_IDTX;
namespace { namespace {
const int txfm_type_num = 2; const int txfm_type_num = 3;
const TYPE_TXFM txfm_type_ls[2] = { TYPE_DCT, TYPE_ADST }; const TYPE_TXFM txfm_type_ls[txfm_type_num] = { TYPE_DCT, TYPE_ADST,
TYPE_IDTX };
#if CONFIG_TX64X64 #if CONFIG_TX64X64
const int txfm_size_num = 5; const int txfm_size_num = 5;
...@@ -35,13 +37,13 @@ const int txfm_size_ls[] = { 4, 8, 16, 32, ...@@ -35,13 +37,13 @@ const int txfm_size_ls[] = { 4, 8, 16, 32,
#endif // CONFIG_TX64X64 #endif // CONFIG_TX64X64
}; };
const TxfmFunc fwd_txfm_func_ls[][2] = { const TxfmFunc fwd_txfm_func_ls[][txfm_type_num] = {
{ av1_fdct4_new, av1_fadst4_new }, { av1_fdct4_new, av1_fadst4_new, av1_fidentity4_c },
{ av1_fdct8_new, av1_fadst8_new }, { av1_fdct8_new, av1_fadst8_new, av1_fidentity8_c },
{ av1_fdct16_new, av1_fadst16_new }, { av1_fdct16_new, av1_fadst16_new, av1_fidentity16_c },
{ av1_fdct32_new, av1_fadst32_new }, { av1_fdct32_new, av1_fadst32_new, av1_fidentity32_c },
#if CONFIG_TX64X64 #if CONFIG_TX64X64
{ av1_fdct64_new, NULL }, { av1_fdct64_new, NULL, NULL },
#endif #endif
}; };
......
...@@ -136,7 +136,7 @@ class AV1FwdTxfm2d : public ::testing::TestWithParam<AV1FwdTxfm2dParam> { ...@@ -136,7 +136,7 @@ class AV1FwdTxfm2d : public ::testing::TestWithParam<AV1FwdTxfm2dParam> {
vector<AV1FwdTxfm2dParam> GetTxfm2dParamList() { vector<AV1FwdTxfm2dParam> GetTxfm2dParamList() {
vector<AV1FwdTxfm2dParam> param_list; vector<AV1FwdTxfm2dParam> param_list;
for (int t = 0; t <= FLIPADST_ADST; ++t) { for (int t = 0; t < TX_TYPES; ++t) {
const TX_TYPE tx_type = static_cast<TX_TYPE>(t); const TX_TYPE tx_type = static_cast<TX_TYPE>(t);
param_list.push_back(AV1FwdTxfm2dParam(tx_type, TX_4X4, 2, 0.5)); param_list.push_back(AV1FwdTxfm2dParam(tx_type, TX_4X4, 2, 0.5));
param_list.push_back(AV1FwdTxfm2dParam(tx_type, TX_8X8, 5, 0.6)); param_list.push_back(AV1FwdTxfm2dParam(tx_type, TX_8X8, 5, 0.6));
......
...@@ -28,7 +28,7 @@ const int txfm_size_ls[] = { ...@@ -28,7 +28,7 @@ const int txfm_size_ls[] = {
#endif // CONFIG_TX64X64 #endif // CONFIG_TX64X64
}; };
const TxfmFunc fwd_txfm_func_ls[][2] = { const TxfmFunc fwd_txfm_func_ls[][txfm_type_num] = {
{ av1_fdct4_new, av1_fadst4_new }, { av1_fdct4_new, av1_fadst4_new },
{ av1_fdct8_new, av1_fadst8_new }, { av1_fdct8_new, av1_fadst8_new },
{ av1_fdct16_new, av1_fadst16_new }, { av1_fdct16_new, av1_fadst16_new },
...@@ -38,7 +38,7 @@ const TxfmFunc fwd_txfm_func_ls[][2] = { ...@@ -38,7 +38,7 @@ const TxfmFunc fwd_txfm_func_ls[][2] = {
#endif #endif
}; };
const TxfmFunc inv_txfm_func_ls[][2] = { const TxfmFunc inv_txfm_func_ls[][txfm_type_num] = {
{ av1_idct4_new, av1_iadst4_new }, { av1_idct4_new, av1_iadst4_new },
{ av1_idct8_new, av1_iadst8_new }, { av1_idct8_new, av1_iadst8_new },
{ av1_idct16_new, av1_iadst16_new }, { av1_idct16_new, av1_iadst16_new },
......
...@@ -142,7 +142,7 @@ class AV1InvTxfm2d : public ::testing::TestWithParam<AV1InvTxfm2dParam> { ...@@ -142,7 +142,7 @@ class AV1InvTxfm2d : public ::testing::TestWithParam<AV1InvTxfm2dParam> {
vector<AV1InvTxfm2dParam> GetInvTxfm2dParamList() { vector<AV1InvTxfm2dParam> GetInvTxfm2dParamList() {
vector<AV1InvTxfm2dParam> param_list; vector<AV1InvTxfm2dParam> param_list;
for (int t = 0; t <= FLIPADST_ADST; ++t) { for (int t = 0; t < TX_TYPES; ++t) {
const TX_TYPE tx_type = static_cast<TX_TYPE>(t); const TX_TYPE tx_type = static_cast<TX_TYPE>(t);
param_list.push_back(AV1InvTxfm2dParam(tx_type, TX_4X4, 2, 0.002)); param_list.push_back(AV1InvTxfm2dParam(tx_type, TX_4X4, 2, 0.002));
param_list.push_back(AV1InvTxfm2dParam(tx_type, TX_8X8, 2, 0.025)); param_list.push_back(AV1InvTxfm2dParam(tx_type, TX_8X8, 2, 0.025));
......
...@@ -54,6 +54,34 @@ void get_txfm1d_type(TX_TYPE txfm2d_type, TYPE_TXFM *type0, TYPE_TXFM *type1) { ...@@ -54,6 +54,34 @@ void get_txfm1d_type(TX_TYPE txfm2d_type, TYPE_TXFM *type0, TYPE_TXFM *type1) {
*type0 = TYPE_ADST; *type0 = TYPE_ADST;
*type1 = TYPE_ADST; *type1 = TYPE_ADST;
break; break;
case IDTX:
*type0 = TYPE_IDTX;
*type1 = TYPE_IDTX;
break;
case H_DCT:
*type0 = TYPE_IDTX;
*type1 = TYPE_DCT;
break;
case V_DCT:
*type0 = TYPE_DCT;
*type1 = TYPE_IDTX;
break;
case H_ADST:
*type0 = TYPE_IDTX;
*type1 = TYPE_ADST;
break;
case V_ADST:
*type0 = TYPE_ADST;
*type1 = TYPE_IDTX;
break;
case H_FLIPADST:
*type0 = TYPE_IDTX;
*type1 = TYPE_ADST;
break;
case V_FLIPADST:
*type0 = TYPE_ADST;
*type1 = TYPE_IDTX;
break;
default: default:
*type0 = TYPE_DCT; *type0 = TYPE_DCT;
*type1 = TYPE_DCT; *type1 = TYPE_DCT;
...@@ -62,6 +90,7 @@ void get_txfm1d_type(TX_TYPE txfm2d_type, TYPE_TXFM *type0, TYPE_TXFM *type1) { ...@@ -62,6 +90,7 @@ void get_txfm1d_type(TX_TYPE txfm2d_type, TYPE_TXFM *type0, TYPE_TXFM *type1) {
} }
} }
double Sqrt2 = pow(2, 0.5);
double invSqrt2 = 1 / pow(2, 0.5); double invSqrt2 = 1 / pow(2, 0.5);
double dct_matrix(double n, double k, int size) { double dct_matrix(double n, double k, int size) {
...@@ -154,11 +183,30 @@ void reference_adst_1d(const double *in, double *out, int size) { ...@@ -154,11 +183,30 @@ void reference_adst_1d(const double *in, double *out, int size) {
} }
} }
void reference_idtx_1d(const double *in, double *out, int size) {
double scale = 0;
if (size == 4)
scale = Sqrt2;
else if (size == 8)
scale = 2;
else if (size == 16)
scale = 2 * Sqrt2;
else if (size == 32)
scale = 4;
else if (size == 64)
scale = 4 * Sqrt2;
for (int k = 0; k < size; ++k) {
out[k] = in[k] * scale;
}
}
void reference_hybrid_1d(double *in, double *out, int size, int type) { void reference_hybrid_1d(double *in, double *out, int size, int type) {
if (type == TYPE_DCT) if (type == TYPE_DCT)
reference_dct_1d(in, out, size); reference_dct_1d(in, out, size);
else else if (type == TYPE_ADST)
reference_adst_1d(in, out, size); reference_adst_1d(in, out, size);
else
reference_idtx_1d(in, out, size);
} }
double get_amplification_factor(TX_TYPE tx_type, TX_SIZE tx_size) { double get_amplification_factor(TX_TYPE tx_type, TX_SIZE tx_size) {
......
...@@ -30,6 +30,7 @@ namespace libaom_test { ...@@ -30,6 +30,7 @@ namespace libaom_test {
typedef enum { typedef enum {
TYPE_DCT = 0, TYPE_DCT = 0,
TYPE_ADST, TYPE_ADST,
TYPE_IDTX,
TYPE_IDCT, TYPE_IDCT,
TYPE_IADST, TYPE_IADST,
TYPE_LAST TYPE_LAST
......
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