Commit c44009c1 authored by Jingning Han's avatar Jingning Han

Rework inter prediction process in cb4x4 mode

Use 2x2 inter prediction for chroma component. This improves the
compression performance by 0.6% for lowres.

Change-Id: If9d98e49cee63f40085b179652bfacc31ff462ea
parent b507bf19
This diff is collapsed.
......@@ -258,7 +258,7 @@ void build_compound_seg_mask_highbd(uint8_t *mask, SEG_MASK_TYPE mask_type,
#endif // CONFIG_COMPOUND_SEGMENT
#endif // CONFIG_EXT_INTER
void build_inter_predictors(MACROBLOCKD *xd, int plane,
void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd, int plane,
#if CONFIG_MOTION_VAR
int mi_col_offset, int mi_row_offset,
#endif // CONFIG_MOTION_VAR
......@@ -536,27 +536,32 @@ static INLINE MV average_split_mvs(const struct macroblockd_plane *pd,
return res;
}
void av1_build_inter_predictor_sub8x8(MACROBLOCKD *xd, int plane, int i, int ir,
int ic, int mi_row, int mi_col);
void av1_build_inter_predictor_sub8x8(const AV1_COMMON *cm, MACROBLOCKD *xd,
int plane, int i, int ir, int ic,
int mi_row, int mi_col);
void av1_build_inter_predictors_sby(MACROBLOCKD *xd, int mi_row, int mi_col,
BUFFER_SET *ctx, BLOCK_SIZE bsize);
void av1_build_inter_predictors_sby(const AV1_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col, BUFFER_SET *ctx,
BLOCK_SIZE bsize);
void av1_build_inter_predictors_sbuv(MACROBLOCKD *xd, int mi_row, int mi_col,
BUFFER_SET *ctx, BLOCK_SIZE bsize);
void av1_build_inter_predictors_sbuv(const AV1_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col, BUFFER_SET *ctx,
BLOCK_SIZE bsize);
void av1_build_inter_predictors_sb(MACROBLOCKD *xd, int mi_row, int mi_col,
BUFFER_SET *ctx, BLOCK_SIZE bsize);
void av1_build_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col, BUFFER_SET *ctx,
BLOCK_SIZE bsize);
#if CONFIG_SUPERTX
void av1_build_inter_predictors_sb_sub8x8_extend(MACROBLOCKD *xd,
void av1_build_inter_predictors_sb_sub8x8_extend(const AV1_COMMON *cm,
MACROBLOCKD *xd,
#if CONFIG_EXT_INTER
int mi_row_ori, int mi_col_ori,
#endif // CONFIG_EXT_INTER
int mi_row, int mi_col,
BLOCK_SIZE bsize, int block);
void av1_build_inter_predictors_sb_extend(MACROBLOCKD *xd,
void av1_build_inter_predictors_sb_extend(const AV1_COMMON *cm, MACROBLOCKD *xd,
#if CONFIG_EXT_INTER
int mi_row_ori, int mi_col_ori,
#endif // CONFIG_EXT_INTER
......
......@@ -875,13 +875,13 @@ static void dec_predict_b_extend(
(c >> xd->plane[2].subsampling_x);
if (!b_sub8x8)
av1_build_inter_predictors_sb_extend(xd,
av1_build_inter_predictors_sb_extend(&pbi->common, xd,
#if CONFIG_EXT_INTER
mi_row_ori, mi_col_ori,
#endif // CONFIG_EXT_INTER
mi_row_pred, mi_col_pred, bsize_pred);
else
av1_build_inter_predictors_sb_sub8x8_extend(xd,
av1_build_inter_predictors_sb_sub8x8_extend(&pbi->common, xd,
#if CONFIG_EXT_INTER
mi_row_ori, mi_col_ori,
#endif // CONFIG_EXT_INTER
......@@ -1645,7 +1645,7 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
}
} else {
// Prediction
av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL,
av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL,
AOMMAX(bsize, BLOCK_8X8));
// Reconstruction
......@@ -1755,9 +1755,9 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
}
#if CONFIG_CB4X4
av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL, bsize);
av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize);
#else
av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL,
av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL,
AOMMAX(bsize, BLOCK_8X8));
#endif
......
......@@ -952,7 +952,7 @@ static void choose_partitioning(AV1_COMP *const cpi, ThreadData *const td,
x->pred_mv[LAST_FRAME] = mbmi->mv[0].as_mv;
}
av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL, cm->sb_size);
av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, cm->sb_size);
ref = xd->plane[0].dst.buf;
ref_stride = xd->plane[0].dst.stride;
......@@ -5994,9 +5994,9 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
av1_setup_pre_planes(xd, ref, cfg, mi_row, mi_col,
&xd->block_refs[ref]->sf);
}
av1_build_inter_predictors_sby(xd, mi_row, mi_col, NULL, block_size);
av1_build_inter_predictors_sby(cm, xd, mi_row, mi_col, NULL, block_size);
av1_build_inter_predictors_sbuv(xd, mi_row, mi_col, NULL, block_size);
av1_build_inter_predictors_sbuv(cm, xd, mi_row, mi_col, NULL, block_size);
#if CONFIG_MOTION_VAR
if (mbmi->motion_mode == OBMC_CAUSAL) {
#if CONFIG_NCOBMC
......@@ -6281,13 +6281,13 @@ static void predict_superblock(const AV1_COMP *const cpi, ThreadData *td,
}
if (!b_sub8x8)
av1_build_inter_predictors_sb_extend(xd,
av1_build_inter_predictors_sb_extend(cm, xd,
#if CONFIG_EXT_INTER
mi_row_ori, mi_col_ori,
#endif // CONFIG_EXT_INTER
mi_row_pred, mi_col_pred, bsize_pred);
else
av1_build_inter_predictors_sb_sub8x8_extend(xd,
av1_build_inter_predictors_sb_sub8x8_extend(cm, xd,
#if CONFIG_EXT_INTER
mi_row_ori, mi_col_ori,
#endif // CONFIG_EXT_INTER
......
......@@ -884,7 +884,7 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) {
xd->mi[0]->mbmi.tx_size = TX_4X4;
xd->mi[0]->mbmi.ref_frame[0] = LAST_FRAME;
xd->mi[0]->mbmi.ref_frame[1] = NONE_FRAME;
av1_build_inter_predictors_sby(xd, mb_row * mb_scale,
av1_build_inter_predictors_sby(cm, xd, mb_row * mb_scale,
mb_col * mb_scale, NULL, bsize);
av1_encode_sby_pass1(cm, x, bsize);
sum_mvr += mv.row;
......
......@@ -71,7 +71,8 @@ static unsigned int do_16x16_motion_iteration(AV1_COMP *cpi, const MV *ref_mv,
xd->mi[0]->mbmi.ref_frame[1] = NONE_FRAME;
#endif // CONFIG_EXT_INTER
av1_build_inter_predictors_sby(xd, mb_row, mb_col, NULL, BLOCK_16X16);
av1_build_inter_predictors_sby(&cpi->common, xd, mb_row, mb_col, NULL,
BLOCK_16X16);
/* restore UMV window */
x->mv_limits = tmp_mv_limits;
......
......@@ -5181,7 +5181,7 @@ static int64_t encode_inter_mb_segment_sub8x8(
assert(tx_type == DCT_DCT);
av1_build_inter_predictor_sub8x8(xd, 0, i, ir, ic, mi_row, mi_col);
av1_build_inter_predictor_sub8x8(cm, xd, 0, i, ir, ic, mi_row, mi_col);
#if CONFIG_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
......@@ -6466,7 +6466,8 @@ static int64_t rd_pick_inter_best_sub8x8_mode(
const int txb_height = max_block_high(xd, plane_bsize, 0);
int idx_, idy_;
av1_build_inter_predictor_sub8x8(xd, 0, i, idy, idx, mi_row, mi_col);
av1_build_inter_predictor_sub8x8(cm, xd, 0, i, idy, idx, mi_row,
mi_col);
#if CONFIG_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
aom_highbd_subtract_block(
......@@ -7916,7 +7917,7 @@ int64_t interpolation_filter_search(
set_default_interp_filters(mbmi, assign_filter);
*switchable_rate = av1_get_switchable_rate(cpi, xd);
av1_build_inter_predictors_sb(xd, mi_row, mi_col, orig_dst, bsize);
av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, orig_dst, bsize);
model_rd_for_sb(cpi, bsize, x, xd, 0, MAX_MB_PLANE - 1, &tmp_rate, &tmp_dist,
skip_txfm_sb, skip_sse_sb);
*rd = RDCOST(x->rdmult, x->rddiv, *switchable_rate + tmp_rate, tmp_dist);
......@@ -7952,7 +7953,7 @@ int64_t interpolation_filter_search(
mbmi->interp_filter = (InterpFilter)i;
#endif // CONFIG_DUAL_FILTER
tmp_rs = av1_get_switchable_rate(cpi, xd);
av1_build_inter_predictors_sb(xd, mi_row, mi_col, orig_dst, bsize);
av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, orig_dst, bsize);
model_rd_for_sb(cpi, bsize, x, xd, 0, MAX_MB_PLANE - 1, &tmp_rate,
&tmp_dist, &tmp_skip_sb, &tmp_skip_sse);
tmp_rd = RDCOST(x->rdmult, x->rddiv, tmp_rs + tmp_rate, tmp_dist);
......@@ -8113,10 +8114,10 @@ static int64_t motion_mode_rd(
if (!has_subpel_mv_component(xd->mi[0], xd, 1))
mbmi->interp_filter[1] = EIGHTTAP_REGULAR;
#endif // CONFIG_DUAL_FILTER
av1_build_inter_predictors_sb(xd, mi_row, mi_col, orig_dst, bsize);
av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, orig_dst, bsize);
#if CONFIG_EXT_INTER
} else {
av1_build_inter_predictors_sb(xd, mi_row, mi_col, orig_dst, bsize);
av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, orig_dst, bsize);
#endif // CONFIG_EXT_INTER
}
av1_build_obmc_inter_prediction(
......@@ -8147,7 +8148,7 @@ static int64_t motion_mode_rd(
if (find_projection(mbmi->num_proj_ref[0], pts, pts_inref, bsize,
mbmi->mv[0].as_mv.row, mbmi->mv[0].as_mv.col,
&mbmi->wm_params[0], mi_row, mi_col) == 0) {
av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL, bsize);
av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize);
model_rd_for_sb(cpi, bsize, x, xd, 0, MAX_MB_PLANE - 1, &tmp_rate,
&tmp_dist, skip_txfm_sb, skip_sse_sb);
} else {
......@@ -8660,7 +8661,8 @@ static int64_t handle_inter_mode(
switch (cur_type) {
case COMPOUND_AVERAGE:
av1_build_inter_predictors_sby(xd, mi_row, mi_col, &orig_dst, bsize);
av1_build_inter_predictors_sby(cm, xd, mi_row, mi_col, &orig_dst,
bsize);
av1_subtract_plane(x, bsize, 0);
rd = estimate_yrd_for_sb(cpi, bsize, x, &rate_sum, &dist_sum,
&tmp_skip_txfm_sb, &tmp_skip_sse_sb,
......@@ -8914,7 +8916,7 @@ static int64_t handle_inter_mode(
if (pred_exists == 0) {
int tmp_rate;
int64_t tmp_dist;
av1_build_inter_predictors_sb(xd, mi_row, mi_col, &orig_dst, bsize);
av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, &orig_dst, bsize);
model_rd_for_sb(cpi, bsize, x, xd, 0, MAX_MB_PLANE - 1, &tmp_rate,
&tmp_dist, &skip_txfm_sb, &skip_sse_sb);
rd = RDCOST(x->rdmult, x->rddiv, rs + tmp_rate, tmp_dist);
......@@ -9049,7 +9051,7 @@ static int64_t rd_pick_intrabc_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
#endif
mbmi->skip = 0;
x->skip = 0;
av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL, bsize);
av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize);
int rate_mv = av1_mv_bit_cost(&dv, &dv_ref.as_mv, x->nmvjointcost, x->mvcost,
MV_COST_WEIGHT);
......@@ -10794,7 +10796,7 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
}
if (is_inter_mode(mbmi->mode)) {
av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL, bsize);
av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize);
#if CONFIG_MOTION_VAR
if (mbmi->motion_mode == OBMC_CAUSAL) {
av1_build_obmc_inter_prediction(
......@@ -11973,7 +11975,7 @@ void av1_rd_pick_inter_mode_sub8x8(const struct AV1_COMP *cpi,
// then dont bother looking at UV
int is_cost_valid_uv;
RD_STATS rd_stats_uv;
av1_build_inter_predictors_sbuv(&x->e_mbd, mi_row, mi_col, NULL,
av1_build_inter_predictors_sbuv(cm, &x->e_mbd, mi_row, mi_col, NULL,
BLOCK_8X8);
#if CONFIG_VAR_TX
is_cost_valid_uv =
......@@ -12454,7 +12456,7 @@ void av1_check_ncobmc_rd(const struct AV1_COMP *cpi, struct macroblock *x,
av1_setup_dst_planes(x->e_mbd.plane, bsize,
get_frame_new_buffer(&cpi->common), mi_row, mi_col);
av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL, bsize);
av1_build_inter_predictors_sb(cm, xd, mi_row, mi_col, NULL, bsize);
av1_subtract_plane(x, bsize, 0);
super_block_yrd(cpi, x, &rd_stats_y, bsize, INT64_MAX);
......
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