diff options
author | Yaowu Xu <yaowu@google.com> | 2015-03-10 10:48:52 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@gerrit.golo.chromium.org> | 2015-03-10 10:48:52 -0700 |
commit | 12943e722d1740bf38b5b2beec8bdb1f1604342a (patch) | |
tree | 017412751d44e1330a0c7d3fa4c58db145bd5fd2 /vp9 | |
parent | 4b01a2d350e362c8a7472d0ffe67f9fb34595af6 (diff) | |
parent | 059a473b353dd45b2f0c4a7cd61702417459fe51 (diff) | |
download | libvpx-12943e722d1740bf38b5b2beec8bdb1f1604342a.tar libvpx-12943e722d1740bf38b5b2beec8bdb1f1604342a.tar.gz libvpx-12943e722d1740bf38b5b2beec8bdb1f1604342a.tar.bz2 libvpx-12943e722d1740bf38b5b2beec8bdb1f1604342a.zip |
Merge "Enable using Golden reference in choose_partition()"
Diffstat (limited to 'vp9')
-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); |