From 5241acf6e2d9f75c2f53bb230df9d2c301f309cc Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Wed, 24 Jun 2015 11:17:50 -0700 Subject: [PATCH] intrabc: Allow odd pel displacement for non-444 intrabc: screen_content: -0.618 derflr: +0.015 intrabc+tx_skip+palette: screen_content: -0.124 derflr: -0.048 Change-Id: Iabea4be19dce2f6fdab8f639e585a424c90c81b4 --- vp9/encoder/vp9_rdopt.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index e1c410df7..625b1f9cf 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -1455,7 +1455,6 @@ static INLINE int mv_check_bounds(const MACROBLOCK *x, const MV *mv) { } #if CONFIG_INTRABC -#define ODD_PEL_DV 0 // Allow odd pel displacemnt vectors static void intrabc_search(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, int mi_row, int mi_col, @@ -1523,23 +1522,28 @@ static void intrabc_search(VP9_COMP *cpi, MACROBLOCK *x, assert(tmp_mv->as_int != 0); if (bestsme < INT_MAX) { - if (pd[1].subsampling_x != 0 || pd[1].subsampling_y != 0) { -#if ODD_PEL_DV + // Check that the vector doesn't require uv subpel interpolation pixels + // from outside of the coded area. + if (pd[1].subsampling_y != 0) { if (tmp_mv->as_mv.col > -w) { assert(tmp_mv->as_mv.row <= -h); if (tmp_mv->as_mv.row == -h - 1) { tmp_mv->as_mv.row = tmp_mv->as_mv.row / 2 * 2; } } else { - assert(tmp_mv->as_mv.row <= 8 * 8 - h); - if (tmp_mv->as_mv.row == 8 * 8 - h - 1) { + assert(tmp_mv->as_mv.row <= (sb_mi_row + 8 - mi_row) * 8 - h); + if (tmp_mv->as_mv.row == (sb_mi_row + 8 - mi_row) * 8 - h - 1) { tmp_mv->as_mv.row = tmp_mv->as_mv.row / 2 * 2; } } -#else - tmp_mv->as_mv.row = tmp_mv->as_mv.row / 2 * 2; - tmp_mv->as_mv.col = tmp_mv->as_mv.col / 2 * 2; -#endif // ODD_PEL_DV + } + if (pd[1].subsampling_x != 0) { + if (tmp_mv->as_mv.row > -h) { + assert(tmp_mv->as_mv.col <= -(mi_col - sb_mi_col) * 8 - w); + if (tmp_mv->as_mv.col == -(mi_col - sb_mi_col) * 8 - w - 1) { + tmp_mv->as_mv.col = tmp_mv->as_mv.col / 2 * 2; + } + } } tmp_mv->as_mv.row *= 8; tmp_mv->as_mv.col *= 8; -- 2.49.0