From 46af01d719b2cc3c33fae476239ed03bda05538e Mon Sep 17 00:00:00 2001 From: Dmitry Kovalev Date: Thu, 27 Feb 2014 15:46:48 -0800 Subject: [PATCH] Adding get_tx_type() instead of get_tx_type_{8x8, 16x16}. Change-Id: I4a54b12e5229705222c5a101258b9d1f81e2948d --- vp9/common/vp9_blockd.h | 23 ++++++++++------------- vp9/common/vp9_reconintra.c | 26 +++++++++++--------------- vp9/decoder/vp9_decodeframe.c | 4 ++-- vp9/encoder/vp9_encodemb.c | 4 ++-- 4 files changed, 25 insertions(+), 32 deletions(-) diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h index 2a0ebfba0..84403ae15 100644 --- a/vp9/common/vp9_blockd.h +++ b/vp9/common/vp9_blockd.h @@ -255,7 +255,16 @@ static INLINE BLOCK_SIZE get_subsize(BLOCK_SIZE bsize, return subsize; } -extern const TX_TYPE mode2txfm_map[MB_MODE_COUNT]; +extern const TX_TYPE mode2txfm_map[INTRA_MODES]; + +static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, + const MACROBLOCKD *xd) { + const MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi; + + if (plane_type != PLANE_TYPE_Y || is_inter_block(mbmi)) + return DCT_DCT; + return mode2txfm_map[mbmi->mode]; +} static INLINE TX_TYPE get_tx_type_4x4(PLANE_TYPE plane_type, const MACROBLOCKD *xd, int ib) { @@ -267,18 +276,6 @@ static INLINE TX_TYPE get_tx_type_4x4(PLANE_TYPE plane_type, return mode2txfm_map[get_y_mode(mi, ib)]; } -static INLINE TX_TYPE get_tx_type_8x8(PLANE_TYPE plane_type, - const MACROBLOCKD *xd) { - return plane_type == PLANE_TYPE_Y ? mode2txfm_map[xd->mi_8x8[0]->mbmi.mode] - : DCT_DCT; -} - -static INLINE TX_TYPE get_tx_type_16x16(PLANE_TYPE plane_type, - const MACROBLOCKD *xd) { - return plane_type == PLANE_TYPE_Y ? mode2txfm_map[xd->mi_8x8[0]->mbmi.mode] - : DCT_DCT; -} - void vp9_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y); static INLINE TX_SIZE get_uv_tx_size_impl(TX_SIZE y_tx_size, BLOCK_SIZE bsize) { diff --git a/vp9/common/vp9_reconintra.c b/vp9/common/vp9_reconintra.c index 71a41a9de..86f4f3578 100644 --- a/vp9/common/vp9_reconintra.c +++ b/vp9/common/vp9_reconintra.c @@ -18,21 +18,17 @@ #include "vp9/common/vp9_reconintra.h" #include "vp9/common/vp9_onyxc_int.h" -const TX_TYPE mode2txfm_map[MB_MODE_COUNT] = { - DCT_DCT, // DC - ADST_DCT, // V - DCT_ADST, // H - DCT_DCT, // D45 - ADST_ADST, // D135 - ADST_DCT, // D117 - DCT_ADST, // D153 - DCT_ADST, // D207 - ADST_DCT, // D63 - ADST_ADST, // TM - DCT_DCT, // NEARESTMV - DCT_DCT, // NEARMV - DCT_DCT, // ZEROMV - DCT_DCT // NEWMV +const TX_TYPE mode2txfm_map[INTRA_MODES] = { + DCT_DCT, // DC + ADST_DCT, // V + DCT_ADST, // H + DCT_DCT, // D45 + ADST_ADST, // D135 + ADST_DCT, // D117 + DCT_ADST, // D153 + DCT_ADST, // D207 + ADST_DCT, // D63 + ADST_ADST, // TM }; #define intra_pred_sized(type, size) \ diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c index 8bebca51a..54a14f381 100644 --- a/vp9/decoder/vp9_decodeframe.c +++ b/vp9/decoder/vp9_decodeframe.c @@ -245,11 +245,11 @@ static void inverse_transform_block(MACROBLOCKD* xd, int plane, int block, vp9_iht4x4_16_add(dqcoeff, dst, stride, tx_type); break; case TX_8X8: - tx_type = get_tx_type_8x8(plane_type, xd); + tx_type = get_tx_type(plane_type, xd); vp9_iht8x8_add(tx_type, dqcoeff, dst, stride, eob); break; case TX_16X16: - tx_type = get_tx_type_16x16(plane_type, xd); + tx_type = get_tx_type(plane_type, xd); vp9_iht16x16_add(tx_type, dqcoeff, dst, stride, eob); break; case TX_32X32: diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c index 513730e43..19dee0ef8 100644 --- a/vp9/encoder/vp9_encodemb.c +++ b/vp9/encoder/vp9_encodemb.c @@ -526,7 +526,7 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, vp9_idct32x32_add(dqcoeff, dst, dst_stride, *eob); break; case TX_16X16: - tx_type = get_tx_type_16x16(pd->plane_type, xd); + tx_type = get_tx_type(pd->plane_type, xd); scan_order = &vp9_scan_orders[TX_16X16][tx_type]; mode = plane == 0 ? mbmi->mode : mbmi->uv_mode; vp9_predict_intra_block(xd, block >> 4, bwl, TX_16X16, mode, @@ -546,7 +546,7 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, vp9_iht16x16_add(tx_type, dqcoeff, dst, dst_stride, *eob); break; case TX_8X8: - tx_type = get_tx_type_8x8(pd->plane_type, xd); + tx_type = get_tx_type(pd->plane_type, xd); scan_order = &vp9_scan_orders[TX_8X8][tx_type]; mode = plane == 0 ? mbmi->mode : mbmi->uv_mode; vp9_predict_intra_block(xd, block >> 2, bwl, TX_8X8, mode,