From: hui su Date: Mon, 24 Aug 2015 21:37:54 +0000 (-0700) Subject: Enable ADST for UV channel X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b3cc3a07b0d746df8c7e912db5b7623e61d62af6;p=libvpx Enable ADST for UV channel derflr +0.202% hevclf +0.207% hevcmr +0.095% hevchr +0.077% Tested locally on several derf sequences, speed (encoder + decoder) is slower by less than 1%. It is part of the EXT_TX experiment, which is to be continued to explore different transform variants. Change-Id: I05d44994a62106538a9a241ed8d89bd7c5d14761 --- diff --git a/configure b/configure index ac196dacb..6bb90e386 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ EXPERIMENT_LIST=" spatial_svc fp_mb_stats emulate_hardware + ext_tx " CONFIG_LIST=" dependency_tracking diff --git a/vp10/common/blockd.h b/vp10/common/blockd.h index 26703d167..09406a32a 100644 --- a/vp10/common/blockd.h +++ b/vp10/common/blockd.h @@ -219,15 +219,21 @@ static const TX_TYPE intra_mode_to_tx_type_lookup[INTRA_MODES] = { }; static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd, - int block_idx) { + int block_idx, TX_SIZE tx_size) { const MODE_INFO *const mi = xd->mi[0]; const MB_MODE_INFO *const mbmi = &mi->mbmi; +#if CONFIG_EXT_TX + if (xd->lossless || is_inter_block(mbmi) || tx_size >= TX_32X32) + return DCT_DCT; + return intra_mode_to_tx_type_lookup[plane_type == PLANE_TYPE_Y ? + get_y_mode(mi, block_idx) : mbmi->uv_mode]; +#else if (plane_type != PLANE_TYPE_Y || xd->lossless || is_inter_block(mbmi) || - mbmi->tx_size >= TX_32X32) + tx_size >= TX_32X32) return DCT_DCT; - return intra_mode_to_tx_type_lookup[get_y_mode(mi, block_idx)]; +#endif // CONFIG_EXT_TX } void vp10_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y); diff --git a/vp10/decoder/decodeframe.c b/vp10/decoder/decodeframe.c index 6cb2ff54c..e113cdbe2 100644 --- a/vp10/decoder/decodeframe.c +++ b/vp10/decoder/decodeframe.c @@ -188,7 +188,7 @@ static void inverse_transform_block_inter(MACROBLOCKD* xd, int plane, uint8_t *dst, int stride, int eob, int block) { struct macroblockd_plane *const pd = &xd->plane[plane]; - TX_TYPE tx_type = get_tx_type(pd->plane_type, xd, block); + TX_TYPE tx_type = get_tx_type(pd->plane_type, xd, block, tx_size); if (eob > 0) { tran_low_t *const dqcoeff = pd->dqcoeff; #if CONFIG_VP9_HIGHBITDEPTH @@ -347,7 +347,7 @@ static void predict_and_reconstruct_intra_block(MACROBLOCKD *const xd, col, row, plane); if (!mbmi->skip) { - TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx); + TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx, tx_size); const scan_order *sc = get_scan(tx_size, tx_type); const int eob = vp10_decode_block_tokens(xd, plane, sc, col, row, tx_size, r, mbmi->segment_id); @@ -362,7 +362,7 @@ static int reconstruct_inter_block(MACROBLOCKD *const xd, vpx_reader *r, struct macroblockd_plane *const pd = &xd->plane[plane]; PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV; int block_idx = (row << 1) + col; - TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx); + TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx, tx_size); const scan_order *sc = get_scan(tx_size, tx_type); const int eob = vp10_decode_block_tokens(xd, plane, sc, col, row, tx_size, r, mbmi->segment_id); diff --git a/vp10/encoder/encodemb.c b/vp10/encoder/encodemb.c index fbc9848c5..51b47c9fe 100644 --- a/vp10/encoder/encodemb.c +++ b/vp10/encoder/encodemb.c @@ -104,7 +104,7 @@ static int optimize_b(MACROBLOCK *mb, int plane, int block, const int mul = 1 + (tx_size == TX_32X32); const int16_t *dequant_ptr = pd->dequant; const uint8_t *const band_translate = get_band_translate(tx_size); - TX_TYPE tx_type = get_tx_type(type, xd, block); + TX_TYPE tx_type = get_tx_type(type, xd, block, tx_size); const scan_order *const so = get_scan(tx_size, tx_type); const int16_t *const scan = so->scan; const int16_t *const nb = so->neighbors; @@ -329,7 +329,7 @@ void vp10_xform_quant_fp(MACROBLOCK *x, int plane, int block, const struct macroblock_plane *const p = &x->plane[plane]; const struct macroblockd_plane *const pd = &xd->plane[plane]; PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV; - TX_TYPE tx_type = get_tx_type(plane_type, xd, block); + TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size); const scan_order *const scan_order = get_scan(tx_size, tx_type); tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block); tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block); @@ -642,7 +642,7 @@ void vp10_xform_quant(MACROBLOCK *x, int plane, int block, const struct macroblock_plane *const p = &x->plane[plane]; const struct macroblockd_plane *const pd = &xd->plane[plane]; PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV; - TX_TYPE tx_type = get_tx_type(plane_type, xd, block); + TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size); const scan_order *const scan_order = get_scan(tx_size, tx_type); tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block); tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block); @@ -741,7 +741,7 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize, int i, j; uint8_t *dst; ENTROPY_CONTEXT *a, *l; - TX_TYPE tx_type = get_tx_type(pd->plane_type, xd, block); + TX_TYPE tx_type = get_tx_type(pd->plane_type, xd, block, tx_size); txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j); dst = &pd->dst.buf[4 * j * pd->dst.stride + 4 * i]; a = &ctx->ta[plane][i]; @@ -928,7 +928,7 @@ void vp10_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, tran_low_t *qcoeff = BLOCK_OFFSET(p->qcoeff, block); tran_low_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block); PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV; - TX_TYPE tx_type = get_tx_type(plane_type, xd, block); + TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size); const scan_order *const scan_order = get_scan(tx_size, tx_type); PREDICTION_MODE mode; const int bwl = b_width_log2_lookup[plane_bsize]; diff --git a/vp10/encoder/pickmode.c b/vp10/encoder/pickmode.c index ef1a06061..3a542b939 100644 --- a/vp10/encoder/pickmode.c +++ b/vp10/encoder/pickmode.c @@ -601,7 +601,7 @@ static void block_yrd(VP10_COMP *cpi, MACROBLOCK *x, int *rate, int64_t *dist, for (c = 0; c < num_4x4_w; c += block_step) { if (c < max_blocks_wide) { PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV; - TX_TYPE tx_type = get_tx_type(plane_type, xd, block); + TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size); const scan_order *const scan_order = get_scan(tx_size, tx_type); tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block); tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block); diff --git a/vp10/encoder/rdopt.c b/vp10/encoder/rdopt.c index 14efe0ef0..ea4dce5b1 100644 --- a/vp10/encoder/rdopt.c +++ b/vp10/encoder/rdopt.c @@ -570,7 +570,7 @@ static void txfm_rd_in_plane(MACROBLOCK *x, vp10_get_entropy_contexts(bsize, tx_size, pd, args.t_above, args.t_left); - tx_type = get_tx_type(pd->plane_type, xd, 0); + tx_type = get_tx_type(pd->plane_type, xd, 0, tx_size); args.so = get_scan(tx_size, tx_type); vp10_foreach_transformed_block_in_plane(xd, bsize, plane, @@ -804,7 +804,7 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x, vpx_highbd_subtract_block(4, 4, src_diff, 8, src, src_stride, dst, dst_stride, xd->bd); if (xd->lossless) { - TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block); + TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block, TX_4X4); const scan_order *so = get_scan(TX_4X4, tx_type); vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, vp10_highbd_fwht4x4); @@ -820,7 +820,7 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x, vp10_highbd_iwht4x4_add); } else { int64_t unused; - TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block); + TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block, TX_4X4); const scan_order *so = get_scan(TX_4X4, tx_type); vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, tx_type, vpx_highbd_fdct4x4); @@ -909,7 +909,7 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x, vpx_subtract_block(4, 4, src_diff, 8, src, src_stride, dst, dst_stride); if (xd->lossless) { - TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block); + TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block, TX_4X4); const scan_order *so = get_scan(TX_4X4, tx_type); vp10_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, vp10_fwht4x4); vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan); @@ -923,7 +923,7 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x, vp10_iwht4x4_add); } else { int64_t unused; - TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block); + TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block, TX_4X4); const scan_order *so = get_scan(TX_4X4, tx_type); vp10_fwd_txfm_4x4(src_diff, coeff, 8, tx_type, vpx_fdct4x4); vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan); @@ -1316,7 +1316,7 @@ static int64_t encode_inter_mb_segment(VP10_COMP *cpi, pd->dst.stride)]; int64_t thisdistortion = 0, thissse = 0; int thisrate = 0, ref; - TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, i); + TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, i, TX_4X4); const scan_order *so = get_scan(TX_4X4, tx_type); const int is_compound = has_second_ref(&mi->mbmi); const InterpKernel *kernel = vp10_filter_kernels[mi->mbmi.interp_filter]; diff --git a/vp10/encoder/tokenize.c b/vp10/encoder/tokenize.c index af915feed..b2ee95e7f 100644 --- a/vp10/encoder/tokenize.c +++ b/vp10/encoder/tokenize.c @@ -507,7 +507,7 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize, const tran_low_t *qcoeff = BLOCK_OFFSET(p->qcoeff, block); const int segment_id = mbmi->segment_id; const int16_t *scan, *nb; - const TX_TYPE tx_type = get_tx_type(type, xd, block); + const TX_TYPE tx_type = get_tx_type(type, xd, block, tx_size); const scan_order *const so = get_scan(tx_size, tx_type); const int ref = is_inter_block(mbmi); unsigned int (*const counts)[COEFF_CONTEXTS][ENTROPY_TOKENS] =