Enable optimize_b for intra blocks
Coding gain: lowres 0.05% midres 0.10% hdres 0.18% Change-Id: I508b150c02588f911a8ddddfe73c770f0819fe10
This commit is contained in:
@@ -4834,7 +4834,7 @@ static void encode_superblock(VP10_COMP *cpi, ThreadData *td,
|
|||||||
int plane;
|
int plane;
|
||||||
mbmi->skip = 1;
|
mbmi->skip = 1;
|
||||||
for (plane = 0; plane < MAX_MB_PLANE; ++plane)
|
for (plane = 0; plane < MAX_MB_PLANE; ++plane)
|
||||||
vp10_encode_intra_block_plane(x, VPXMAX(bsize, BLOCK_8X8), plane);
|
vp10_encode_intra_block_plane(x, VPXMAX(bsize, BLOCK_8X8), plane, 1);
|
||||||
if (output_enabled)
|
if (output_enabled)
|
||||||
sum_intra_stats(td->counts, mi, xd->above_mi, xd->left_mi,
|
sum_intra_stats(td->counts, mi, xd->above_mi, xd->left_mi,
|
||||||
frame_is_intra_only(cm));
|
frame_is_intra_only(cm));
|
||||||
|
|||||||
@@ -773,6 +773,20 @@ void vp10_encode_block_intra(int plane, int block, int blk_row, int blk_col,
|
|||||||
VP10_XFORM_QUANT_SKIP_QUANT);
|
VP10_XFORM_QUANT_SKIP_QUANT);
|
||||||
#endif // CONFIG_EXT_INTRA
|
#endif // CONFIG_EXT_INTRA
|
||||||
|
|
||||||
|
if (args->ctx != NULL) {
|
||||||
|
struct optimize_ctx *const ctx = args->ctx;
|
||||||
|
ENTROPY_CONTEXT *a, *l;
|
||||||
|
a = &ctx->ta[plane][blk_col];
|
||||||
|
l = &ctx->tl[plane][blk_row];
|
||||||
|
if (x->optimize && (!x->skip_recode || !x->skip_optimize)) {
|
||||||
|
int ctx;
|
||||||
|
ctx = combine_entropy_contexts(*a, *l);
|
||||||
|
*a = *l = optimize_b(x, plane, block, tx_size, ctx) > 0;
|
||||||
|
} else {
|
||||||
|
*a = *l = p->eobs[block] > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (*eob) {
|
if (*eob) {
|
||||||
// inverse transform
|
// inverse transform
|
||||||
inv_txfm_param.tx_type = tx_type;
|
inv_txfm_param.tx_type = tx_type;
|
||||||
@@ -794,10 +808,22 @@ void vp10_encode_block_intra(int plane, int block, int blk_row, int blk_col,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void vp10_encode_intra_block_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {
|
void vp10_encode_intra_block_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane,
|
||||||
|
int enable_optimize_b) {
|
||||||
const MACROBLOCKD *const xd = &x->e_mbd;
|
const MACROBLOCKD *const xd = &x->e_mbd;
|
||||||
struct encode_b_args arg = {x, NULL, &xd->mi[0]->mbmi.skip};
|
struct optimize_ctx ctx;
|
||||||
|
struct encode_b_args arg = {x, &ctx, &xd->mi[0]->mbmi.skip};
|
||||||
|
|
||||||
|
if (enable_optimize_b && x->optimize &&
|
||||||
|
(!x->skip_recode || !x->skip_optimize)) {
|
||||||
|
const struct macroblockd_plane* const pd = &xd->plane[plane];
|
||||||
|
const TX_SIZE tx_size = plane ? get_uv_tx_size(&xd->mi[0]->mbmi, pd) :
|
||||||
|
xd->mi[0]->mbmi.tx_size;
|
||||||
|
vp10_get_entropy_contexts(bsize, tx_size, pd,
|
||||||
|
ctx.ta[plane], ctx.tl[plane]);
|
||||||
|
} else {
|
||||||
|
arg.ctx = NULL;
|
||||||
|
}
|
||||||
vp10_foreach_transformed_block_in_plane(xd, bsize, plane,
|
vp10_foreach_transformed_block_in_plane(xd, bsize, plane,
|
||||||
vp10_encode_block_intra, &arg);
|
vp10_encode_block_intra, &arg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ void vp10_encode_block_intra(int plane, int block, int blk_row, int blk_col,
|
|||||||
BLOCK_SIZE plane_bsize,
|
BLOCK_SIZE plane_bsize,
|
||||||
TX_SIZE tx_size, void *arg);
|
TX_SIZE tx_size, void *arg);
|
||||||
|
|
||||||
void vp10_encode_intra_block_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
|
void vp10_encode_intra_block_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane,
|
||||||
|
int enable_optimize_b);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|||||||
@@ -619,7 +619,7 @@ void vp10_first_pass(VP10_COMP *cpi, const struct lookahead_entry *source) {
|
|||||||
xd->mi[0]->mbmi.mode = DC_PRED;
|
xd->mi[0]->mbmi.mode = DC_PRED;
|
||||||
xd->mi[0]->mbmi.tx_size = use_dc_pred ?
|
xd->mi[0]->mbmi.tx_size = use_dc_pred ?
|
||||||
(bsize >= BLOCK_16X16 ? TX_16X16 : TX_8X8) : TX_4X4;
|
(bsize >= BLOCK_16X16 ? TX_16X16 : TX_8X8) : TX_4X4;
|
||||||
vp10_encode_intra_block_plane(x, bsize, 0);
|
vp10_encode_intra_block_plane(x, bsize, 0, 0);
|
||||||
this_error = vpx_get_mb_ss(x->plane[0].src_diff);
|
this_error = vpx_get_mb_ss(x->plane[0].src_diff);
|
||||||
|
|
||||||
// Keep a record of blocks that have almost no intra error residual
|
// Keep a record of blocks that have almost no intra error residual
|
||||||
|
|||||||
@@ -8243,7 +8243,7 @@ void vp10_rd_pick_inter_mode_sb(VP10_COMP *cpi,
|
|||||||
if (this_mode != DC_PRED && this_mode != TM_PRED)
|
if (this_mode != DC_PRED && this_mode != TM_PRED)
|
||||||
rate2 += intra_cost_penalty;
|
rate2 += intra_cost_penalty;
|
||||||
distortion2 = distortion_y + distortion_uv;
|
distortion2 = distortion_y + distortion_uv;
|
||||||
vp10_encode_intra_block_plane(x, bsize, 0);
|
vp10_encode_intra_block_plane(x, bsize, 0, 0);
|
||||||
#if CONFIG_VP9_HIGHBITDEPTH
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||||
x->recon_variance =
|
x->recon_variance =
|
||||||
|
|||||||
Reference in New Issue
Block a user