diff options
author | hui su <huisu@google.com> | 2015-08-13 16:27:19 -0700 |
---|---|---|
committer | hui su <huisu@google.com> | 2015-08-24 10:47:25 -0700 |
commit | d76e5b3652fc7022141171cb7bb123607559104f (patch) | |
tree | a6152a5ef5f462f0fae2c75cb94c413e7ed3f6a5 /vp10/decoder/decodeframe.c | |
parent | 41be09afee1cf24494776f9bc44ae71aeb8707e9 (diff) | |
download | libvpx-d76e5b3652fc7022141171cb7bb123607559104f.tar libvpx-d76e5b3652fc7022141171cb7bb123607559104f.tar.gz libvpx-d76e5b3652fc7022141171cb7bb123607559104f.tar.bz2 libvpx-d76e5b3652fc7022141171cb7bb123607559104f.zip |
Refactoring on transform types
Prepare for adding more transform varieties (EXT_TX and TX_SKIP in nextgen).
Change-Id: I2dfe024f6be7a92078775917092ed62abc2e7d1e
Diffstat (limited to 'vp10/decoder/decodeframe.c')
-rw-r--r-- | vp10/decoder/decodeframe.c | 165 |
1 files changed, 65 insertions, 100 deletions
diff --git a/vp10/decoder/decodeframe.c b/vp10/decoder/decodeframe.c index e8712c2be..4d8ff5768 100644 --- a/vp10/decoder/decodeframe.c +++ b/vp10/decoder/decodeframe.c @@ -186,76 +186,59 @@ static void read_mv_probs(nmv_context *ctx, int allow_hp, vpx_reader *r) { static void inverse_transform_block_inter(MACROBLOCKD* xd, int plane, const TX_SIZE tx_size, uint8_t *dst, int stride, - int eob) { + int eob, int block) { struct macroblockd_plane *const pd = &xd->plane[plane]; + TX_TYPE tx_type = get_tx_type(pd->plane_type, xd, block); if (eob > 0) { tran_low_t *const dqcoeff = pd->dqcoeff; #if CONFIG_VP9_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { - if (xd->lossless) { - vp10_highbd_iwht4x4_add(dqcoeff, dst, stride, eob, xd->bd); - } else { - switch (tx_size) { - case TX_4X4: - vp10_highbd_idct4x4_add(dqcoeff, dst, stride, eob, xd->bd); - break; - case TX_8X8: - vp10_highbd_idct8x8_add(dqcoeff, dst, stride, eob, xd->bd); - break; - case TX_16X16: - vp10_highbd_idct16x16_add(dqcoeff, dst, stride, eob, xd->bd); - break; - case TX_32X32: - vp10_highbd_idct32x32_add(dqcoeff, dst, stride, eob, xd->bd); - break; - default: - assert(0 && "Invalid transform size"); - } - } - } else { - if (xd->lossless) { - vp10_iwht4x4_add(dqcoeff, dst, stride, eob); - } else { - switch (tx_size) { - case TX_4X4: - vp10_idct4x4_add(dqcoeff, dst, stride, eob); - break; - case TX_8X8: - vp10_idct8x8_add(dqcoeff, dst, stride, eob); - break; - case TX_16X16: - vp10_idct16x16_add(dqcoeff, dst, stride, eob); - break; - case TX_32X32: - vp10_idct32x32_add(dqcoeff, dst, stride, eob); - break; - default: - assert(0 && "Invalid transform size"); - return; - } + switch (tx_size) { + case TX_4X4: + vp10_highbd_inv_txfm_add_4x4(dqcoeff, dst, stride, eob, xd->bd, + tx_type, xd->lossless ? + vp10_highbd_iwht4x4_add : + vp10_highbd_idct4x4_add); + 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; } - } -#else - if (xd->lossless) { - vp10_iwht4x4_add(dqcoeff, dst, stride, eob); } else { +#else // CONFIG_VP9_HIGHBITDEPTH switch (tx_size) { case TX_4X4: - vp10_idct4x4_add(dqcoeff, dst, stride, eob); + vp10_inv_txfm_add_4x4(dqcoeff, dst, stride, eob, tx_type, + xd->lossless ? vp10_iwht4x4_add : + vp10_idct4x4_add); break; case TX_8X8: - vp10_idct8x8_add(dqcoeff, dst, stride, eob); + vp10_inv_txfm_add_8x8(dqcoeff, dst, stride, eob, tx_type); break; case TX_16X16: - vp10_idct16x16_add(dqcoeff, dst, stride, eob); + vp10_inv_txfm_add_16x16(dqcoeff, dst, stride, eob, tx_type); break; case TX_32X32: - vp10_idct32x32_add(dqcoeff, dst, stride, eob); + vp10_inv_txfm_add_32x32(dqcoeff, dst, stride, eob, tx_type); break; default: assert(0 && "Invalid transform size"); return; } +#endif // CONFIG_VP9_HIGHBITDEPTH +#if CONFIG_VP9_HIGHBITDEPTH } #endif // CONFIG_VP9_HIGHBITDEPTH @@ -282,70 +265,52 @@ static void inverse_transform_block_intra(MACROBLOCKD* xd, int plane, tran_low_t *const dqcoeff = pd->dqcoeff; #if CONFIG_VP9_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { - if (xd->lossless) { - vp10_highbd_iwht4x4_add(dqcoeff, dst, stride, eob, xd->bd); - } else { - switch (tx_size) { - case TX_4X4: - vp10_highbd_iht4x4_add(tx_type, dqcoeff, dst, stride, eob, xd->bd); - break; - case TX_8X8: - vp10_highbd_iht8x8_add(tx_type, dqcoeff, dst, stride, eob, xd->bd); - break; - case TX_16X16: - vp10_highbd_iht16x16_add(tx_type, dqcoeff, dst, stride, eob, xd->bd); - break; - case TX_32X32: - vp10_highbd_idct32x32_add(dqcoeff, dst, stride, eob, xd->bd); - break; - default: - assert(0 && "Invalid transform size"); - } - } - } else { - if (xd->lossless) { - vp10_iwht4x4_add(dqcoeff, dst, stride, eob); - } else { - switch (tx_size) { - case TX_4X4: - vp10_iht4x4_add(tx_type, dqcoeff, dst, stride, eob); - break; - case TX_8X8: - vp10_iht8x8_add(tx_type, dqcoeff, dst, stride, eob); - break; - case TX_16X16: - vp10_iht16x16_add(tx_type, dqcoeff, dst, stride, eob); - break; - case TX_32X32: - vp10_idct32x32_add(dqcoeff, dst, stride, eob); - break; - default: - assert(0 && "Invalid transform size"); - return; - } + switch (tx_size) { + case TX_4X4: + vp10_highbd_inv_txfm_add_4x4(dqcoeff, dst, stride, eob, xd->bd, + tx_type, xd->lossless ? + vp10_highbd_iwht4x4_add : + vp10_highbd_idct4x4_add); + 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; } - } -#else - if (xd->lossless) { - vp10_iwht4x4_add(dqcoeff, dst, stride, eob); } else { +#else // CONFIG_VP9_HIGHBITDEPTH switch (tx_size) { case TX_4X4: - vp10_iht4x4_add(tx_type, dqcoeff, dst, stride, eob); + vp10_inv_txfm_add_4x4(dqcoeff, dst, stride, eob, tx_type, + xd->lossless ? vp10_iwht4x4_add : + vp10_idct4x4_add); break; case TX_8X8: - vp10_iht8x8_add(tx_type, dqcoeff, dst, stride, eob); + vp10_inv_txfm_add_8x8(dqcoeff, dst, stride, eob, tx_type); break; case TX_16X16: - vp10_iht16x16_add(tx_type, dqcoeff, dst, stride, eob); + vp10_inv_txfm_add_16x16(dqcoeff, dst, stride, eob, tx_type); break; case TX_32X32: - vp10_idct32x32_add(dqcoeff, dst, stride, eob); + vp10_inv_txfm_add_32x32(dqcoeff, dst, stride, eob, tx_type); break; default: assert(0 && "Invalid transform size"); return; } +#endif // CONFIG_VP9_HIGHBITDEPTH +#if CONFIG_VP9_HIGHBITDEPTH } #endif // CONFIG_VP9_HIGHBITDEPTH @@ -406,7 +371,7 @@ static int reconstruct_inter_block(MACROBLOCKD *const xd, vpx_reader *r, inverse_transform_block_inter(xd, plane, tx_size, &pd->dst.buf[4 * row * pd->dst.stride + 4 * col], - pd->dst.stride, eob); + pd->dst.stride, eob, block_idx); return eob; } |