From c53a95ad1d7f8171f66c512b54da05a09552f615 Mon Sep 17 00:00:00 2001 From: hkuang <hkuang@google.com> Date: Thu, 25 Sep 2014 11:47:29 -0700 Subject: [PATCH] Avoid calling vp9_is_scaled two times in a function. Use a local variable to hold the result of vp9_is_scaled. Change-Id: I5e203909805923e20eefef596bc84424da47dbe2 --- vp9/common/vp9_reconinter.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vp9/common/vp9_reconinter.c b/vp9/common/vp9_reconinter.c index 513630bc0e..9c4e32321d 100644 --- a/vp9/common/vp9_reconinter.c +++ b/vp9/common/vp9_reconinter.c @@ -288,8 +288,9 @@ static void build_inter_predictors(MACROBLOCKD *xd, int plane, int block, uint8_t *pre; MV32 scaled_mv; int xs, ys, subpel_x, subpel_y; + const int is_scaled = vp9_is_scaled(sf); - if (vp9_is_scaled(sf)) { + if (is_scaled) { pre = pre_buf->buf + scaled_buffer_offset(x, y, pre_buf->stride, sf); scaled_mv = vp9_scale_mv(&mv_q4, mi_x + x, mi_y + y, sf); xs = sf->x_step_q4; @@ -394,6 +395,7 @@ static void dec_build_inter_predictors(MACROBLOCKD *xd, int plane, int block, subpel_x, subpel_y; uint8_t *ref_frame, *buf_ptr; const YV12_BUFFER_CONFIG *ref_buf = xd->block_refs[ref]->buf; + const int is_scaled = vp9_is_scaled(sf); // Get reference frame pointer, width and height. if (plane == 0) { @@ -406,7 +408,7 @@ static void dec_build_inter_predictors(MACROBLOCKD *xd, int plane, int block, ref_frame = plane == 1 ? ref_buf->u_buffer : ref_buf->v_buffer; } - if (vp9_is_scaled(sf)) { + if (is_scaled) { // Co-ordinate of containing block to pixel precision. int x_start = (-xd->mb_to_left_edge >> (3 + pd->subsampling_x)); int y_start = (-xd->mb_to_top_edge >> (3 + pd->subsampling_y)); @@ -458,7 +460,7 @@ static void dec_build_inter_predictors(MACROBLOCKD *xd, int plane, int block, // Do border extension if there is motion or the // width/height is not a multiple of 8 pixels. - if (vp9_is_scaled(sf) || scaled_mv.col || scaled_mv.row || + if (is_scaled || scaled_mv.col || scaled_mv.row || (frame_width & 0x7) || (frame_height & 0x7)) { // Get reference block bottom right coordinate. int x1 = ((x0_16 + (w - 1) * xs) >> SUBPEL_BITS) + 1; -- GitLab