Commit ad653a39 authored by Angie Chiang's avatar Angie Chiang

Add txmg experiment

This experiment aims at merging lbd/hbd txfms

So far this exp uses hbd transform on lbd path.
The performances I observed are
lowres -0.089%
midres  0.065%
(negative means performance drop)

Started from here, two main things are needed to be done.
1) Fix overflow due to quantizer noise
2) Generate a 16-bit version from the hbd txfm

Change-Id: I35bb1fc0cbb78decad2570ff5826ed665f739752
parent fc256542
...@@ -2195,11 +2195,13 @@ static void init_txfm_param(const MACROBLOCKD *xd, TX_SIZE tx_size, ...@@ -2195,11 +2195,13 @@ static void init_txfm_param(const MACROBLOCKD *xd, TX_SIZE tx_size,
#endif #endif
} }
#if !CONFIG_TXMG
typedef void (*InvTxfmFunc)(const tran_low_t *dqcoeff, uint8_t *dst, int stride, typedef void (*InvTxfmFunc)(const tran_low_t *dqcoeff, uint8_t *dst, int stride,
TxfmParam *txfm_param); TxfmParam *txfm_param);
static InvTxfmFunc inv_txfm_func[2] = { av1_inv_txfm_add, static InvTxfmFunc inv_txfm_func[2] = { av1_inv_txfm_add,
av1_highbd_inv_txfm_add }; av1_highbd_inv_txfm_add };
#endif
// TODO(kslu) Change input arguments to TxfmParam, which contains mode, // TODO(kslu) Change input arguments to TxfmParam, which contains mode,
// tx_type, tx_size, dst, stride, eob. Thus, the additional argument when LGT // tx_type, tx_size, dst, stride, eob. Thus, the additional argument when LGT
...@@ -2240,8 +2242,29 @@ void av1_inverse_transform_block(const MACROBLOCKD *xd, ...@@ -2240,8 +2242,29 @@ void av1_inverse_transform_block(const MACROBLOCKD *xd,
txfm_param.mode = mode; txfm_param.mode = mode;
#endif #endif
#if CONFIG_TXMG
DECLARE_ALIGNED(16, uint16_t, tmp[MAX_TX_SQUARE]);
int tmp_stride = MAX_TX_SIZE;
int w = tx_size_wide[tx_size];
int h = tx_size_high[tx_size];
for (int r = 0; r < h; ++r) {
for (int c = 0; c < w; ++c) {
tmp[r * tmp_stride + c] = dst[r * stride + c];
}
}
av1_highbd_inv_txfm_add(dqcoeff, CONVERT_TO_BYTEPTR(tmp), tmp_stride,
&txfm_param);
for (int r = 0; r < h; ++r) {
for (int c = 0; c < w; ++c) {
dst[r * stride + c] = tmp[r * tmp_stride + c];
}
}
#else // CONFIG_TXMG
const int is_hbd = get_bitdepth_data_path_index(xd); const int is_hbd = get_bitdepth_data_path_index(xd);
inv_txfm_func[is_hbd](dqcoeff, dst, stride, &txfm_param); inv_txfm_func[is_hbd](dqcoeff, dst, stride, &txfm_param);
#endif // CONFIG_TXMG
} }
void av1_inverse_transform_block_facade(MACROBLOCKD *xd, int plane, int block, void av1_inverse_transform_block_facade(MACROBLOCKD *xd, int plane, int block,
......
...@@ -492,10 +492,12 @@ static AV1_QUANT_FACADE ...@@ -492,10 +492,12 @@ static AV1_QUANT_FACADE
}; };
#endif // !CONFIG_PVQ #endif // !CONFIG_PVQ
#if !CONFIG_TXMG
typedef void (*fwdTxfmFunc)(const int16_t *diff, tran_low_t *coeff, int stride, typedef void (*fwdTxfmFunc)(const int16_t *diff, tran_low_t *coeff, int stride,
TxfmParam *txfm_param); TxfmParam *txfm_param);
static const fwdTxfmFunc fwd_txfm_func[2] = { av1_fwd_txfm, static const fwdTxfmFunc fwd_txfm_func[2] = { av1_fwd_txfm,
av1_highbd_fwd_txfm }; av1_highbd_fwd_txfm };
#endif
void av1_xform_quant(const AV1_COMMON *cm, MACROBLOCK *x, int plane, int block, void av1_xform_quant(const AV1_COMMON *cm, MACROBLOCK *x, int plane, int block,
int blk_row, int blk_col, BLOCK_SIZE plane_bsize, int blk_row, int blk_col, BLOCK_SIZE plane_bsize,
...@@ -642,7 +644,12 @@ void av1_xform_quant(const AV1_COMMON *cm, MACROBLOCK *x, int plane, int block, ...@@ -642,7 +644,12 @@ void av1_xform_quant(const AV1_COMMON *cm, MACROBLOCK *x, int plane, int block,
#if !CONFIG_PVQ #if !CONFIG_PVQ
txfm_param.bd = xd->bd; txfm_param.bd = xd->bd;
const int is_hbd = get_bitdepth_data_path_index(xd); const int is_hbd = get_bitdepth_data_path_index(xd);
#if CONFIG_TXMG
av1_highbd_fwd_txfm(src_diff, coeff, diff_stride, &txfm_param);
#else // CONFIG_TXMG
fwd_txfm_func[is_hbd](src_diff, coeff, diff_stride, &txfm_param); fwd_txfm_func[is_hbd](src_diff, coeff, diff_stride, &txfm_param);
#endif // CONFIG_TXMG
if (xform_quant_idx != AV1_XFORM_QUANT_SKIP_QUANT) { if (xform_quant_idx != AV1_XFORM_QUANT_SKIP_QUANT) {
if (LIKELY(!x->skip_block)) { if (LIKELY(!x->skip_block)) {
......
...@@ -339,6 +339,7 @@ EXPERIMENT_LIST=" ...@@ -339,6 +339,7 @@ EXPERIMENT_LIST="
lpf_direct lpf_direct
uv_lvl uv_lvl
no_frame_context_signaling no_frame_context_signaling
txmg
" "
CONFIG_LIST=" CONFIG_LIST="
dependency_tracking dependency_tracking
......
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