Refactor: call inv_txfm_add
Change-Id: I52c209a5db1b4a6525c04b70291a08ab5a68c6fe
diff --git a/vp10/decoder/decodeframe.c b/vp10/decoder/decodeframe.c
index f094d54..d4ac688 100644
--- a/vp10/decoder/decodeframe.c
+++ b/vp10/decoder/decodeframe.c
@@ -224,49 +224,19 @@
const int seg_id = xd->mi[0]->mbmi.segment_id;
if (eob > 0) {
tran_low_t *const dqcoeff = pd->dqcoeff;
+ INV_TXFM_PARAM inv_txfm_param;
+ inv_txfm_param.tx_type = tx_type;
+ inv_txfm_param.tx_size = tx_size;
+ inv_txfm_param.eob = eob;
+ inv_txfm_param.lossless = xd->lossless[seg_id];
+
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
- switch (tx_size) {
- case TX_4X4:
- vp10_highbd_inv_txfm_add_4x4(dqcoeff, dst, stride, eob, xd->bd,
- tx_type, xd->lossless[seg_id]);
- break;
- case TX_8X8:
- vp10_highbd_inv_txfm_add_8x8(dqcoeff, dst, stride, eob, xd->bd,
- tx_type);
- break;
- case TX_16X16:
- vp10_highbd_inv_txfm_add_16x16(dqcoeff, dst, stride, eob, xd->bd,
- tx_type);
- break;
- case TX_32X32:
- vp10_highbd_inv_txfm_add_32x32(dqcoeff, dst, stride, eob, xd->bd,
- tx_type);
- break;
- default:
- assert(0 && "Invalid transform size");
- return;
- }
+ inv_txfm_param.bd = xd->bd;
+ highbd_inv_txfm_add(dqcoeff, dst, stride, &inv_txfm_param);
} else {
#endif // CONFIG_VP9_HIGHBITDEPTH
- switch (tx_size) {
- case TX_4X4:
- vp10_inv_txfm_add_4x4(dqcoeff, dst, stride, eob, tx_type,
- xd->lossless[seg_id]);
- break;
- case TX_8X8:
- vp10_inv_txfm_add_8x8(dqcoeff, dst, stride, eob, tx_type);
- break;
- case TX_16X16:
- vp10_inv_txfm_add_16x16(dqcoeff, dst, stride, eob, tx_type);
- break;
- case TX_32X32:
- vp10_inv_txfm_add_32x32(dqcoeff, dst, stride, eob, tx_type);
- break;
- default:
- assert(0 && "Invalid transform size");
- return;
- }
+ inv_txfm_add(dqcoeff, dst, stride, &inv_txfm_param);
#if CONFIG_VP9_HIGHBITDEPTH
}
#endif // CONFIG_VP9_HIGHBITDEPTH
diff --git a/vp10/encoder/rdopt.c b/vp10/encoder/rdopt.c
index 2b7d8f5..564416b 100644
--- a/vp10/encoder/rdopt.c
+++ b/vp10/encoder/rdopt.c
@@ -2846,57 +2846,21 @@
*bsse += tmp * 16;
if (p->eobs[block] > 0) {
- const int lossless = xd->lossless[xd->mi[0]->mbmi.segment_id];
+ INV_TXFM_PARAM inv_txfm_param;
+ inv_txfm_param.tx_type = tx_type;
+ inv_txfm_param.tx_size = tx_size;
+ inv_txfm_param.eob = p->eobs[block];
+ inv_txfm_param.lossless = xd->lossless[xd->mi[0]->mbmi.segment_id];
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
- const int bd = xd->bd;
- switch (tx_size) {
- case TX_32X32:
- vp10_highbd_inv_txfm_add_32x32(dqcoeff, rec_buffer, 32,
- p->eobs[block], bd, tx_type);
- break;
- case TX_16X16:
- vp10_highbd_inv_txfm_add_16x16(dqcoeff, rec_buffer, 32,
- p->eobs[block], bd, tx_type);
- break;
- case TX_8X8:
- vp10_highbd_inv_txfm_add_8x8(dqcoeff, rec_buffer, 32,
- p->eobs[block], bd, tx_type);
- break;
- case TX_4X4:
- vp10_highbd_inv_txfm_add_4x4(dqcoeff, rec_buffer, 32,
- p->eobs[block], bd, tx_type, lossless);
- break;
- default:
- assert(0 && "Invalid transform size");
- break;
- }
+ inv_txfm_param.bd = xd->bd;
+ highbd_inv_txfm_add(dqcoeff, rec_buffer, 32, &inv_txfm_param);
} else {
-#else
- {
-#endif // CONFIG_VP9_HIGHBITDEPTH
- switch (tx_size) {
- case TX_32X32:
- vp10_inv_txfm_add_32x32(dqcoeff, rec_buffer, 32, p->eobs[block],
- tx_type);
- break;
- case TX_16X16:
- vp10_inv_txfm_add_16x16(dqcoeff, rec_buffer, 32, p->eobs[block],
- tx_type);
- break;
- case TX_8X8:
- vp10_inv_txfm_add_8x8(dqcoeff, rec_buffer, 32, p->eobs[block],
- tx_type);
- break;
- case TX_4X4:
- vp10_inv_txfm_add_4x4(dqcoeff, rec_buffer, 32, p->eobs[block],
- tx_type, lossless);
- break;
- default:
- assert(0 && "Invalid transform size");
- break;
- }
+ inv_txfm_add(dqcoeff, rec_buffer, 32, &inv_txfm_param);
}
+#else // CONFIG_VP9_HIGHBITDEPTH
+ inv_txfm_add(dqcoeff, rec_buffer, 32, &inv_txfm_param);
+#endif // CONFIG_VP9_HIGHBITDEPTH
if ((bh >> 2) + blk_col > max_blocks_wide ||
(bh >> 2) + blk_row > max_blocks_high) {