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)));