diff options
author | Yaowu Xu <yaowu@google.com> | 2015-03-06 13:45:39 -0800 |
---|---|---|
committer | Yaowu Xu <yaowu@google.com> | 2015-03-10 08:57:28 -0700 |
commit | 059a473b353dd45b2f0c4a7cd61702417459fe51 (patch) | |
tree | 021eeb5b506fa756fa5c966947af9b2bba7bebf6 /vp9/encoder | |
parent | 6eaca27df21d2bd8da1c063c484b5f5c28621d3a (diff) | |
download | libvpx-059a473b353dd45b2f0c4a7cd61702417459fe51.tar libvpx-059a473b353dd45b2f0c4a7cd61702417459fe51.tar.gz libvpx-059a473b353dd45b2f0c4a7cd61702417459fe51.tar.bz2 libvpx-059a473b353dd45b2f0c4a7cd61702417459fe51.zip |
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
Diffstat (limited to 'vp9/encoder')
-rw-r--r-- | vp9/encoder/vp9_encodeframe.c | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 933b049d4..5c841cfdc 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -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); |