Commit b8aa399a authored by Yue Chen's avatar Yue Chen

Refactor and speed-up interintra RDO

Interintra RDO is moved into motion_mode_rd instead of calling
handle_inter_mode() separately. This will save time on interp
filter and new mv search, also skips interintra modes if the base
inter predictors are not good enough.

Speedup: LL ~20% HL < 1%
Tiny performnace improvements (<0.05%).

Change-Id: If5b1ad22396df7590fbc1060e26b61734a205830
parent e2165dff
......@@ -1094,6 +1094,7 @@ void av1_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
int plane, TX_SIZE tx_size, int has_eob, int aoff,
int loff);
#define MAX_INTERINTRA_SB_SQUARE 32 * 32
static INLINE int is_interintra_allowed_bsize(const BLOCK_SIZE bsize) {
return (bsize >= BLOCK_8X8) && (bsize <= BLOCK_32X32);
}
......@@ -1124,7 +1125,8 @@ static INLINE int is_interintra_allowed_bsize_group(int group) {
}
static INLINE int is_interintra_pred(const MB_MODE_INFO *mbmi) {
return (mbmi->ref_frame[1] == INTRA_FRAME) && is_interintra_allowed(mbmi);
return mbmi->ref_frame[0] > INTRA_FRAME &&
mbmi->ref_frame[1] == INTRA_FRAME && is_interintra_allowed(mbmi);
}
static INLINE int get_vartx_max_txsize(const MACROBLOCKD *xd, BLOCK_SIZE bsize,
......
......@@ -1909,6 +1909,16 @@ void av1_build_intra_predictors_for_interintra(const AV1_COMMON *cm,
BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, &xd->plane[plane]);
PREDICTION_MODE mode =
interintra_to_intra_mode[xd->mi[0]->mbmi.interintra_mode];
#if CONFIG_EXT_INTRA
xd->mi[0]->mbmi.angle_delta[0] = 0;
xd->mi[0]->mbmi.angle_delta[1] = 0;
#endif // CONFIG_EXT_INTRA
#if CONFIG_FILTER_INTRA
xd->mi[0]->mbmi.filter_intra_mode_info.use_filter_intra = 0;
#endif // CONFIG_FILTER_INTRA
#if CONFIG_INTRABC
xd->mi[0]->mbmi.use_intrabc = 0;
#endif
av1_predict_intra_block(
cm, xd, pd->width, pd->height, get_max_rect_tx_size(plane_bsize, 0), mode,
......
......@@ -1189,41 +1189,6 @@ void av1_set_rd_speed_thresholds(AV1_COMP *cpi) {
rd->thresh_mult[THR_D117_PRED] += 2500;
rd->thresh_mult[THR_D45_PRED] += 2500;
rd->thresh_mult[THR_COMP_INTERINTRA_GLOBALL] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEARESTL] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEARL] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEWL] += 2000;
rd->thresh_mult[THR_COMP_INTERINTRA_GLOBALL2] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEARESTL2] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEARL2] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEWL2] += 2000;
rd->thresh_mult[THR_COMP_INTERINTRA_GLOBALL3] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEARESTL3] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEARL3] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEWL3] += 2000;
rd->thresh_mult[THR_COMP_INTERINTRA_GLOBALG] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEARESTG] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEARG] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEWG] += 2000;
rd->thresh_mult[THR_COMP_INTERINTRA_GLOBALB] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEARESTB] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEARB] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEWB] += 2000;
rd->thresh_mult[THR_COMP_INTERINTRA_GLOBALA2] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEARESTA2] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEARA2] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEWA2] += 2000;
rd->thresh_mult[THR_COMP_INTERINTRA_GLOBALA] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEARESTA] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEARA] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEWA] += 2000;
#if CONFIG_EXT_COMP_REFS
rd->thresh_mult[THR_COMP_NEAR_NEARLL2] += 1600;
rd->thresh_mult[THR_COMP_NEAREST_NEWLL2] += 2000;
......
......@@ -210,41 +210,6 @@ typedef enum {
THR_D117_PRED,
THR_D45_PRED,
THR_COMP_INTERINTRA_GLOBALL,
THR_COMP_INTERINTRA_NEARESTL,
THR_COMP_INTERINTRA_NEARL,
THR_COMP_INTERINTRA_NEWL,
THR_COMP_INTERINTRA_GLOBALL2,
THR_COMP_INTERINTRA_NEARESTL2,
THR_COMP_INTERINTRA_NEARL2,
THR_COMP_INTERINTRA_NEWL2,
THR_COMP_INTERINTRA_GLOBALL3,
THR_COMP_INTERINTRA_NEARESTL3,
THR_COMP_INTERINTRA_NEARL3,
THR_COMP_INTERINTRA_NEWL3,
THR_COMP_INTERINTRA_GLOBALG,
THR_COMP_INTERINTRA_NEARESTG,
THR_COMP_INTERINTRA_NEARG,
THR_COMP_INTERINTRA_NEWG,
THR_COMP_INTERINTRA_GLOBALB,
THR_COMP_INTERINTRA_NEARESTB,
THR_COMP_INTERINTRA_NEARB,
THR_COMP_INTERINTRA_NEWB,
THR_COMP_INTERINTRA_GLOBALA2,
THR_COMP_INTERINTRA_NEARESTA2,
THR_COMP_INTERINTRA_NEARA2,
THR_COMP_INTERINTRA_NEWA2,
THR_COMP_INTERINTRA_GLOBALA,
THR_COMP_INTERINTRA_NEARESTA,
THR_COMP_INTERINTRA_NEARA,
THR_COMP_INTERINTRA_NEWA,
#if CONFIG_EXT_COMP_REFS
THR_COMP_NEAR_NEARLL2,
THR_COMP_NEW_NEARESTLL2,
......
This diff is collapsed.
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