Commit 00cd5de5 authored by Jingning Han's avatar Jingning Han

Remove skip_recode speed feature

The inter modes now support and test multiple transform types. The
assumption of skip_recode mode no longer exist. Remove this speed
feature.

Change-Id: I2e6798fc841d8ca3838dabed7741950552961a13
parent 7056e3a0
......@@ -68,7 +68,6 @@ struct macroblock {
MB_MODE_INFO_EXT *mbmi_ext;
int skip_block;
int select_tx_size;
int skip_recode;
int skip_optimize;
int q_index;
......
......@@ -1105,7 +1105,6 @@ static void rd_pick_sb_modes(AV1_COMP *cpi, TileDataEnc *tile_data,
ctx->is_coded = 0;
ctx->skippable = 0;
ctx->pred_pixel_ready = 0;
x->skip_recode = 0;
// Set to zero to make sure we do not use the previous encoded frame stats
mbmi->skip = 0;
......@@ -2921,12 +2920,7 @@ static void encode_superblock(AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t,
const int mi_width = num_8x8_blocks_wide_lookup[bsize];
const int mi_height = num_8x8_blocks_high_lookup[bsize];
x->skip_recode = !x->select_tx_size && mbmi->sb_type >= BLOCK_8X8 &&
cpi->oxcf.aq_mode != COMPLEXITY_AQ &&
cpi->oxcf.aq_mode != CYCLIC_REFRESH_AQ &&
cpi->sf.allow_skip_recode;
if (!x->skip_recode) memset(x->skip_txfm, 0, sizeof(x->skip_txfm));
memset(x->skip_txfm, 0, sizeof(x->skip_txfm));
x->skip_optimize = ctx->is_coded;
ctx->is_coded = 1;
......
......@@ -863,43 +863,40 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
return;
}
if (!x->skip_recode) {
if (x->quant_fp) {
// Encoding process for rtc mode
if (x->skip_txfm[0] == SKIP_TXFM_AC_DC && plane == 0) {
if (x->quant_fp) {
// Encoding process for rtc mode
if (x->skip_txfm[0] == SKIP_TXFM_AC_DC && plane == 0) {
// skip forward transform
p->eobs[block] = 0;
*a = *l = 0;
return;
} else {
av1_xform_quant_fp(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size);
}
} else {
if (max_txsize_lookup[plane_bsize] == tx_size) {
int txfm_blk_index = (plane << 2) + (block >> (tx_size << 1));
if (x->skip_txfm[txfm_blk_index] == SKIP_TXFM_NONE) {
// full forward transform and quantization
av1_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size);
} else if (x->skip_txfm[txfm_blk_index] == SKIP_TXFM_AC_ONLY) {
// fast path forward transform and quantization
av1_xform_quant_dc(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size);
} else {
// skip forward transform
p->eobs[block] = 0;
*a = *l = 0;
return;
} else {
av1_xform_quant_fp(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size);
}
} else {
if (max_txsize_lookup[plane_bsize] == tx_size) {
int txfm_blk_index = (plane << 2) + (block >> (tx_size << 1));
if (x->skip_txfm[txfm_blk_index] == SKIP_TXFM_NONE) {
// full forward transform and quantization
av1_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size);
} else if (x->skip_txfm[txfm_blk_index] == SKIP_TXFM_AC_ONLY) {
// fast path forward transform and quantization
av1_xform_quant_dc(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size);
} else {
// skip forward transform
p->eobs[block] = 0;
*a = *l = 0;
return;
}
} else {
av1_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize,
tx_size);
}
av1_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize, tx_size);
}
}
if (x->optimize && (!x->skip_recode || !x->skip_optimize)) {
if (x->optimize) {
const int ctx = combine_entropy_contexts(*a, *l);
*a = *l = optimize_b(x, plane, block, tx_size, ctx) > 0;
} else {
......@@ -1015,9 +1012,9 @@ void av1_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) {
if (x->skip) return;
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
if (!x->skip_recode) av1_subtract_plane(x, bsize, plane);
av1_subtract_plane(x, bsize, plane);
if (x->optimize && (!x->skip_recode || !x->skip_optimize)) {
if (x->optimize) {
const struct macroblockd_plane *const pd = &xd->plane[plane];
const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
av1_get_entropy_contexts(bsize, tx_size, pd, ctx.ta[plane],
......@@ -1071,77 +1068,67 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
switch (tx_size) {
case TX_32X32:
if (!x->skip_recode) {
aom_highbd_subtract_block(32, 32, src_diff, diff_stride, src,
src_stride, dst, dst_stride, xd->bd);
highbd_fwd_txfm_32x32(x->use_lp32x32fdct, src_diff, coeff,
diff_stride, tx_type);
aom_highbd_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin,
p->round, p->quant, p->quant_shift,
qcoeff, dqcoeff, pd->dequant, eob,
scan_order->scan,
aom_highbd_subtract_block(32, 32, src_diff, diff_stride, src,
src_stride, dst, dst_stride, xd->bd);
highbd_fwd_txfm_32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride,
tx_type);
aom_highbd_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin,
p->round, p->quant, p->quant_shift, qcoeff,
dqcoeff, pd->dequant, eob, scan_order->scan,
#if !CONFIG_AOM_QM
scan_order->iscan);
scan_order->iscan);
#else
scan_order->iscan, qmatrix, iqmatrix);
scan_order->iscan, qmatrix, iqmatrix);
#endif
}
if (*eob)
av1_highbd_inv_txfm_add_32x32(dqcoeff, dst, dst_stride, *eob, xd->bd,
tx_type);
break;
case TX_16X16:
if (!x->skip_recode) {
aom_highbd_subtract_block(16, 16, src_diff, diff_stride, src,
src_stride, dst, dst_stride, xd->bd);
highbd_fwd_txfm_16x16(src_diff, coeff, diff_stride, tx_type);
aom_highbd_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
aom_highbd_subtract_block(16, 16, src_diff, diff_stride, src,
src_stride, dst, dst_stride, xd->bd);
highbd_fwd_txfm_16x16(src_diff, coeff, diff_stride, tx_type);
aom_highbd_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
#if !CONFIG_AOM_QM
scan_order->iscan);
scan_order->iscan);
#else
scan_order->iscan, qmatrix, iqmatrix);
scan_order->iscan, qmatrix, iqmatrix);
#endif
}
if (*eob)
av1_highbd_inv_txfm_add_16x16(dqcoeff, dst, dst_stride, *eob, xd->bd,
tx_type);
break;
case TX_8X8:
if (!x->skip_recode) {
aom_highbd_subtract_block(8, 8, src_diff, diff_stride, src,
src_stride, dst, dst_stride, xd->bd);
highbd_fwd_txfm_8x8(src_diff, coeff, diff_stride, tx_type);
aom_highbd_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
aom_highbd_subtract_block(8, 8, src_diff, diff_stride, src, src_stride,
dst, dst_stride, xd->bd);
highbd_fwd_txfm_8x8(src_diff, coeff, diff_stride, tx_type);
aom_highbd_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
#if !CONFIG_AOM_QM
scan_order->iscan);
scan_order->iscan);
#else
scan_order->iscan, qmatrix, iqmatrix);
scan_order->iscan, qmatrix, iqmatrix);
#endif
}
if (*eob)
av1_highbd_inv_txfm_add_8x8(dqcoeff, dst, dst_stride, *eob, xd->bd,
tx_type);
break;
case TX_4X4:
if (!x->skip_recode) {
aom_highbd_subtract_block(4, 4, src_diff, diff_stride, src,
src_stride, dst, dst_stride, xd->bd);
av1_highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type,
xd->lossless[seg_id]);
aom_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
aom_highbd_subtract_block(4, 4, src_diff, diff_stride, src, src_stride,
dst, dst_stride, xd->bd);
av1_highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type,
xd->lossless[seg_id]);
aom_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
#if !CONFIG_AOM_QM
scan_order->iscan);
scan_order->iscan);
#else
scan_order->iscan, qmatrix, iqmatrix);
scan_order->iscan, qmatrix, iqmatrix);
#endif
}
if (*eob)
// this is like av1_short_idct4x4 but has a special case around
// eob<=1 which is significant (not just an optimization) for the
......@@ -1158,69 +1145,60 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
switch (tx_size) {
case TX_32X32:
if (!x->skip_recode) {
aom_subtract_block(32, 32, src_diff, diff_stride, src, src_stride, dst,
dst_stride);
fwd_txfm_32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride,
tx_type);
aom_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
aom_subtract_block(32, 32, src_diff, diff_stride, src, src_stride, dst,
dst_stride);
fwd_txfm_32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride, tx_type);
aom_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
#if !CONFIG_AOM_QM
scan_order->iscan);
scan_order->iscan);
#else
scan_order->iscan, qmatrix, iqmatrix);
scan_order->iscan, qmatrix, iqmatrix);
#endif
}
if (*eob) av1_inv_txfm_add_32x32(dqcoeff, dst, dst_stride, *eob, tx_type);
break;
case TX_16X16:
if (!x->skip_recode) {
aom_subtract_block(16, 16, src_diff, diff_stride, src, src_stride, dst,
dst_stride);
fwd_txfm_16x16(src_diff, coeff, diff_stride, tx_type);
aom_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, p->quant,
p->quant_shift, qcoeff, dqcoeff, pd->dequant, eob,
scan_order->scan,
aom_subtract_block(16, 16, src_diff, diff_stride, src, src_stride, dst,
dst_stride);
fwd_txfm_16x16(src_diff, coeff, diff_stride, tx_type);
aom_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, p->quant,
p->quant_shift, qcoeff, dqcoeff, pd->dequant, eob,
scan_order->scan,
#if !CONFIG_AOM_QM
scan_order->iscan);
scan_order->iscan);
#else
scan_order->iscan, qmatrix, iqmatrix);
scan_order->iscan, qmatrix, iqmatrix);
#endif
}
if (*eob) av1_inv_txfm_add_16x16(dqcoeff, dst, dst_stride, *eob, tx_type);
break;
case TX_8X8:
if (!x->skip_recode) {
aom_subtract_block(8, 8, src_diff, diff_stride, src, src_stride, dst,
dst_stride);
fwd_txfm_8x8(src_diff, coeff, diff_stride, tx_type);
aom_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, p->quant,
p->quant_shift, qcoeff, dqcoeff, pd->dequant, eob,
scan_order->scan,
aom_subtract_block(8, 8, src_diff, diff_stride, src, src_stride, dst,
dst_stride);
fwd_txfm_8x8(src_diff, coeff, diff_stride, tx_type);
aom_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, p->quant,
p->quant_shift, qcoeff, dqcoeff, pd->dequant, eob,
scan_order->scan,
#if !CONFIG_AOM_QM
scan_order->iscan);
scan_order->iscan);
#else
scan_order->iscan, qmatrix, iqmatrix);
scan_order->iscan, qmatrix, iqmatrix);
#endif
}
if (*eob) av1_inv_txfm_add_8x8(dqcoeff, dst, dst_stride, *eob, tx_type);
break;
case TX_4X4:
if (!x->skip_recode) {
aom_subtract_block(4, 4, src_diff, diff_stride, src, src_stride, dst,
dst_stride);
av1_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type,
xd->lossless[seg_id]);
aom_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, p->quant,
p->quant_shift, qcoeff, dqcoeff, pd->dequant, eob,
scan_order->scan,
aom_subtract_block(4, 4, src_diff, diff_stride, src, src_stride, dst,
dst_stride);
av1_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type,
xd->lossless[seg_id]);
aom_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, p->quant,
p->quant_shift, qcoeff, dqcoeff, pd->dequant, eob,
scan_order->scan,
#if !CONFIG_AOM_QM
scan_order->iscan);
scan_order->iscan);
#else
scan_order->iscan, qmatrix, iqmatrix);
scan_order->iscan, qmatrix, iqmatrix);
#endif
}
if (*eob) {
// this is like av1_short_idct4x4 but has a special case around eob<=1
......
......@@ -525,7 +525,6 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) {
pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][1];
p[i].eobs = ctx->eobs_pbuf[i][1];
}
x->skip_recode = 0;
av1_init_mv_probs(cm);
av1_initialize_rd_consts(cpi);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment