From: Jingning Han Date: Wed, 11 Mar 2015 22:44:26 +0000 (-0700) Subject: Refactor to remove GLOBAL_MOTION X-Git-Tag: v1.4.0~41^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1ca4d51b2e1a370b807919e567f6d7796885c40f;p=platform%2Fupstream%2Flibvpx.git Refactor to remove GLOBAL_MOTION Make the vp9_int_pro_motion_estimation() function return zero motion vector if high bit depth is turned on, instead of removing it from compiled codes. Change-Id: Ia48f010eb590b2d517d5678c394110b326a1a95e --- diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 5c841cf..26c5e6a 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -514,12 +514,6 @@ void vp9_set_vbp_thresholds(VP9_COMP *cpi, int q) { } } -#if CONFIG_VP9_HIGHBITDEPTH -#define GLOBAL_MOTION 0 -#else -#define GLOBAL_MOTION 1 -#endif - // This function chooses partitioning based on the variance between source and // reconstructed last, where variance is computed for down-sampled inputs. static void choose_partitioning(VP9_COMP *cpi, @@ -564,7 +558,7 @@ static void choose_partitioning(VP9_COMP *cpi, 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 + const YV12_BUFFER_CONFIG *yv12_g = get_ref_frame_buffer(cpi, GOLDEN_FRAME); unsigned int y_sad, y_sad_g; BLOCK_SIZE bsize; @@ -576,9 +570,9 @@ static void choose_partitioning(VP9_COMP *cpi, bsize = BLOCK_64X32; else bsize = BLOCK_32X32; -#endif + 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); @@ -589,7 +583,7 @@ static void choose_partitioning(VP9_COMP *cpi, } 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); mbmi->ref_frame[0] = LAST_FRAME; @@ -597,7 +591,7 @@ static void choose_partitioning(VP9_COMP *cpi, mbmi->sb_type = BLOCK_64X64; mbmi->mv[0].as_int = 0; mbmi->interp_filter = BILINEAR; -#if GLOBAL_MOTION + y_sad = vp9_int_pro_motion_estimation(cpi, x, bsize); if (y_sad_g < y_sad) { vp9_setup_pre_planes(xd, 0, yv12_g, mi_row, mi_col, @@ -608,29 +602,21 @@ static void choose_partitioning(VP9_COMP *cpi, } else { x->pred_mv[LAST_FRAME] = mbmi->mv[0].as_mv; } -#endif vp9_build_inter_predictors_sb(xd, mi_row, mi_col, BLOCK_64X64); for (i = 1; i <= 2; ++i) { struct macroblock_plane *p = &x->plane[i]; struct macroblockd_plane *pd = &xd->plane[i]; -#if GLOBAL_MOTION const BLOCK_SIZE bs = get_plane_block_size(bsize, pd); -#else - const BLOCK_SIZE bs = get_plane_block_size(BLOCK_64X64, pd); -#endif + if (bs == BLOCK_INVALID) uv_sad = INT_MAX; else uv_sad = cpi->fn_ptr[bs].sdf(p->src.buf, p->src.stride, pd->dst.buf, pd->dst.stride); -#if GLOBAL_MOTION x->color_sensitivity[i - 1] = uv_sad * 4 > y_sad; -#else - x->color_sensitivity[i - 1] = (uv_sad > 512); -#endif } d = xd->plane[0].dst.buf; diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c index 0730467..12882e4 100644 --- a/vp9/encoder/vp9_mcomp.c +++ b/vp9/encoder/vp9_mcomp.c @@ -1807,6 +1807,13 @@ unsigned int vp9_int_pro_motion_estimation(const VP9_COMP *cpi, MACROBLOCK *x, int best_sad; MV this_mv; +#if CONFIG_VP9_HIGHBITDEPTH + tmp_mv->row = 0; + tmp_mv->col = 0; + return cpi->fn_ptr[bsize].sdf(x->plane[0].src.buf, src_stride, + xd->plane[0].pre[0].buf, ref_stride); +#endif + // Set up prediction 1-D reference set ref_buf = xd->plane[0].pre[0].buf - (bw >> 1); for (idx = 0; idx < search_width; idx += 16) {