summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJingning Han <jingning@google.com>2015-09-05 18:28:16 -0700
committerJingning Han <jingning@google.com>2015-09-08 11:09:30 -0700
commit42b0560319e1a88378678ac0701c53b849546337 (patch)
tree8d442af7f0f846f730d1b0e0093923553163ba3e
parent536a90970b7b7d0bf4a029ae1a61774088dc795a (diff)
downloadlibvpx-42b0560319e1a88378678ac0701c53b849546337.tar
libvpx-42b0560319e1a88378678ac0701c53b849546337.tar.gz
libvpx-42b0560319e1a88378678ac0701c53b849546337.tar.bz2
libvpx-42b0560319e1a88378678ac0701c53b849546337.zip
Fix the sub8x8 block inter prediction with scaled reference frame
Sync the encoder's buffer offset calculation for sub8x8 block motion compensated prediction with scaled reference frame to match the decoder's behavior. This resolves an enc/dec mismatch issue when sub8x8 inter mode with scaled is turned on. Change-Id: I4bab3672b007a5ae0c992f8a701341892d2458b0
-rw-r--r--vp9/common/vp9_reconinter.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/vp9/common/vp9_reconinter.c b/vp9/common/vp9_reconinter.c
index f83f8257a..d8c14ecc8 100644
--- a/vp9/common/vp9_reconinter.c
+++ b/vp9/common/vp9_reconinter.c
@@ -187,7 +187,19 @@ static void build_inter_predictors(MACROBLOCKD *xd, int plane, int block,
const int is_scaled = vp9_is_scaled(sf);
if (is_scaled) {
- pre = pre_buf->buf + scaled_buffer_offset(x, y, pre_buf->stride, sf);
+ // Co-ordinate of containing block to pixel precision.
+ const int x_start = (-xd->mb_to_left_edge >> (3 + pd->subsampling_x));
+ const int y_start = (-xd->mb_to_top_edge >> (3 + pd->subsampling_y));
+ if (plane == 0)
+ pre_buf->buf = xd->block_refs[ref]->buf->y_buffer;
+ else if (plane == 1)
+ pre_buf->buf = xd->block_refs[ref]->buf->u_buffer;
+ else
+ pre_buf->buf = xd->block_refs[ref]->buf->v_buffer;
+
+ pre_buf->buf += scaled_buffer_offset(x_start + x, y_start + y,
+ pre_buf->stride, sf);
+ pre = pre_buf->buf;
scaled_mv = vp9_scale_mv(&mv_q4, mi_x + x, mi_y + y, sf);
xs = sf->x_step_q4;
ys = sf->y_step_q4;