diff options
Diffstat (limited to 'vp9/common')
-rw-r--r-- | vp9/common/vp9_alloccommon.c | 7 | ||||
-rw-r--r-- | vp9/common/vp9_onyxc_int.h | 24 |
2 files changed, 28 insertions, 3 deletions
diff --git a/vp9/common/vp9_alloccommon.c b/vp9/common/vp9_alloccommon.c index 496096373..10bf77667 100644 --- a/vp9/common/vp9_alloccommon.c +++ b/vp9/common/vp9_alloccommon.c @@ -74,7 +74,7 @@ static void set_mb_mi(VP9_COMMON *cm, int aligned_width, int aligned_height) { cm->mi_cols = aligned_width >> LOG2_MI_SIZE; cm->mi_rows = aligned_height >> LOG2_MI_SIZE; - cm->mode_info_stride = cm->mi_cols + 1; + cm->mode_info_stride = cm->mi_cols + 64 / MI_SIZE; } static void setup_mi(VP9_COMMON *cm) { @@ -131,12 +131,13 @@ int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height) { set_mb_mi(oci, aligned_width, aligned_height); // Allocation - oci->mip = vpx_calloc(oci->mode_info_stride * (oci->mi_rows + 1), + oci->mip = vpx_calloc(oci->mode_info_stride * (oci->mi_rows + 64 / MI_SIZE), sizeof(MODE_INFO)); if (!oci->mip) goto fail; - oci->prev_mip = vpx_calloc(oci->mode_info_stride * (oci->mi_rows + 1), + oci->prev_mip = vpx_calloc(oci->mode_info_stride * + (oci->mi_rows + 64 / MI_SIZE), sizeof(MODE_INFO)); if (!oci->prev_mip) goto fail; diff --git a/vp9/common/vp9_onyxc_int.h b/vp9/common/vp9_onyxc_int.h index 791dbb948..d91483d31 100644 --- a/vp9/common/vp9_onyxc_int.h +++ b/vp9/common/vp9_onyxc_int.h @@ -310,6 +310,30 @@ static INLINE void set_partition_seg_context(VP9_COMMON *cm, xd->left_seg_context = cm->left_seg_context + (mi_row & MI_MASK); } +static int check_bsize_coverage(VP9_COMMON *cm, MACROBLOCKD *xd, + int mi_row, int mi_col, + BLOCK_SIZE_TYPE bsize) { + int bsl = mi_width_log2(bsize), bs = 1 << bsl; + int ms = bs / 2; + + if ((mi_row + bs <= cm->mi_rows) && (mi_col + ms < cm->mi_cols)) + return 0; + if ((mi_col + bs <= cm->mi_cols) && (mi_row + ms < cm->mi_rows)) + return 0; + + // frame width/height are multiples of 8, hence 8x8 block should always + // pass the above check + assert(bsize > BLOCK_SIZE_SB8X8); + + // return the node index in the prob tree for binary coding + if ((mi_col + bs <= cm->mi_cols) && (mi_row + ms >= cm->mi_rows)) + return 1; + if ((mi_row + bs <= cm->mi_rows) && (mi_col + ms >= cm->mi_cols)) + return 2; + + return -1; +} + static void set_mi_row_col(VP9_COMMON *cm, MACROBLOCKD *xd, int mi_row, int bh, int mi_col, int bw) { |