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
This commit is contained in:
1
configure
vendored
1
configure
vendored
@@ -264,6 +264,7 @@ EXPERIMENT_LIST="
|
||||
spatial_svc
|
||||
fp_mb_stats
|
||||
emulate_hardware
|
||||
ext_tx
|
||||
"
|
||||
CONFIG_LIST="
|
||||
dependency_tracking
|
||||
|
@@ -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 (plane_type != PLANE_TYPE_Y || xd->lossless || is_inter_block(mbmi) ||
|
||||
mbmi->tx_size >= TX_32X32)
|
||||
#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) ||
|
||||
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);
|
||||
|
@@ -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);
|
||||
|
@@ -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];
|
||||
|
@@ -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);
|
||||
|
@@ -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];
|
||||
|
@@ -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] =
|
||||
|
Reference in New Issue
Block a user