From c4048dbdd39dbd4763852a6d0a27f183677c4225 Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Sat, 10 Aug 2013 15:04:02 -0700 Subject: [PATCH] Change to limit the mv search range As the pixel values beyond image border are duplicates of pixels on edge, the change limits the mv search range, any mv beyond the limits no longer produce new/different prediction values as entire block with pixels used for subpel interpolation are outside image border. Change-Id: I4c6fdf06e33c1cef1489f5470ce0fb4e5e01fb79 --- vp9/common/vp9_enums.h | 2 ++ vp9/encoder/vp9_encodeframe.c | 14 ++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/vp9/common/vp9_enums.h b/vp9/common/vp9_enums.h index 435460e89..2720386aa 100644 --- a/vp9/common/vp9_enums.h +++ b/vp9/common/vp9_enums.h @@ -16,11 +16,13 @@ #define LOG2_MI_SIZE 3 #define LOG2_MI_BLOCK_SIZE (6 - LOG2_MI_SIZE) // 64 = 2^6 +#define MAX_BLOCK_SIZE (1 << 6) // max block size in pixel #define MI_SIZE (1 << LOG2_MI_SIZE) // pixels per mi-unit #define MI_BLOCK_SIZE (1 << LOG2_MI_BLOCK_SIZE) // mi-units per max block #define MI_MASK (MI_BLOCK_SIZE - 1) + typedef enum BLOCK_SIZE_TYPE { BLOCK_4X4, BLOCK_4X8, diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 65725bf1f..932ca6276 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -516,14 +516,12 @@ static void set_offsets(VP9_COMP *cpi, int mi_row, int mi_col, // Set up destination pointers setup_dst_planes(xd, &cm->yv12_fb[dst_fb_idx], mi_row, mi_col); - /* Set up limit values for MV components to prevent them from - * extending beyond the UMV borders assuming 16x16 block size */ - x->mv_row_min = -((mi_row * MI_SIZE)+ VP9BORDERINPIXELS - VP9_INTERP_EXTEND); - x->mv_col_min = -((mi_col * MI_SIZE)+ VP9BORDERINPIXELS - VP9_INTERP_EXTEND); - x->mv_row_max = ((cm->mi_rows - mi_row) * MI_SIZE - + (VP9BORDERINPIXELS - MI_SIZE * mi_height - VP9_INTERP_EXTEND)); - x->mv_col_max = ((cm->mi_cols - mi_col) * MI_SIZE - + (VP9BORDERINPIXELS - MI_SIZE * mi_width - VP9_INTERP_EXTEND)); + // Set up limit values for MV components + // mv beyond the range do not produce new/different prediction block + x->mv_row_min = -((mi_row * MI_SIZE) + MAX_BLOCK_SIZE + VP9_INTERP_EXTEND); + x->mv_col_min = -((mi_col * MI_SIZE) + MAX_BLOCK_SIZE + VP9_INTERP_EXTEND); + x->mv_row_max = (cm->mi_rows - mi_row) * MI_SIZE + VP9_INTERP_EXTEND; + x->mv_col_max = (cm->mi_cols - mi_col) * MI_SIZE + VP9_INTERP_EXTEND; // Set up distance of MB to edge of frame in 1/8th pel units assert(!(mi_col & (mi_width - 1)) && !(mi_row & (mi_height - 1)));