Commit 059a473b authored by Yaowu Xu's avatar Yaowu Xu
Browse files

Enable using Golden reference in choose_partition()

Choose_partition uses only the last frame as reference frame in making
partition decision, this commit adds the check on how well Golden
frame with (0,0) predicts the current block, and uses GF(0,0) as
basis for partition decision if it produces better prediction.

The commit improves rtc speed 6 and 7 encoding by 0.14% and 0.19%
respectively.

Change-Id: I156acf925bd6e0b586d48155d1940d27270a3915
parent 6eaca27d
......@@ -563,32 +563,51 @@ static void choose_partitioning(VP9_COMP *cpi,
if (!is_key_frame) {
MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
unsigned int uv_sad;
const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, LAST_FRAME);
#if GLOBAL_MOTION
unsigned int y_sad;
const YV12_BUFFER_CONFIG *yv12_g = get_ref_frame_buffer(cpi, GOLDEN_FRAME);
unsigned int y_sad, y_sad_g;
BLOCK_SIZE bsize;
if (mi_row + 4 < cm->mi_rows && mi_col + 4 < cm->mi_cols)
bsize = BLOCK_64X64;
else if (mi_row + 4 < cm->mi_rows && mi_col + 4 >= cm->mi_cols)
bsize = BLOCK_32X64;
else if (mi_row + 4 >= cm->mi_rows && mi_col + 4 < cm->mi_cols)
bsize = BLOCK_64X32;
else
bsize = BLOCK_32X32;
#endif
const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, LAST_FRAME);
assert(yv12 != NULL);
#if GLOBAL_MOTION
if (yv12_g && yv12_g != yv12) {
vp9_setup_pre_planes(xd, 0, yv12_g, mi_row, mi_col,
&cm->frame_refs[GOLDEN_FRAME - 1].sf);
y_sad_g = cpi->fn_ptr[bsize].sdf(x->plane[0].src.buf,
x->plane[0].src.stride,
xd->plane[0].pre[0].buf,
xd->plane[0].pre[0].stride);
} else {
y_sad_g = UINT_MAX;
}
#endif
vp9_setup_pre_planes(xd, 0, yv12, mi_row, mi_col,
&cm->frame_refs[LAST_FRAME - 1].sf);
&cm->frame_refs[LAST_FRAME - 1].sf);
mbmi->ref_frame[0] = LAST_FRAME;
mbmi->ref_frame[1] = NONE;
mbmi->sb_type = BLOCK_64X64;
mbmi->mv[0].as_int = 0;
mbmi->interp_filter = BILINEAR;
#if GLOBAL_MOTION
if (mi_row + 4 < cm->mi_rows && mi_col + 4 < cm->mi_cols)
bsize = BLOCK_64X64;
else if (mi_row + 4 < cm->mi_rows && mi_col + 4 >= cm->mi_cols)
bsize = BLOCK_32X64;
else if (mi_row + 4 >= cm->mi_rows && mi_col + 4 < cm->mi_cols)
bsize = BLOCK_64X32;
else
bsize = BLOCK_32X32;
y_sad = vp9_int_pro_motion_estimation(cpi, x, bsize);
x->pred_mv[LAST_FRAME] = mbmi->mv[0].as_mv;
if (y_sad_g < y_sad) {
vp9_setup_pre_planes(xd, 0, yv12_g, mi_row, mi_col,
&cm->frame_refs[GOLDEN_FRAME - 1].sf);
mbmi->ref_frame[0] = GOLDEN_FRAME;
mbmi->mv[0].as_int = 0;
y_sad = y_sad_g;
} else {
x->pred_mv[LAST_FRAME] = mbmi->mv[0].as_mv;
}
#endif
vp9_build_inter_predictors_sb(xd, mi_row, mi_col, BLOCK_64X64);
......
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