From 2ad62c93129e363a6c7a916f656d807dfefce8e6 Mon Sep 17 00:00:00 2001 From: Dmitry Kovalev Date: Wed, 3 Jul 2013 11:15:58 -0700 Subject: [PATCH] Calling set_partition_seg_context() instead of code duplication. Change-Id: I65be6acc54c99688fd1f0c946cec3511514b8555 --- vp9/common/vp9_onyxc_int.h | 5 ++--- vp9/decoder/vp9_decodframe.c | 10 ++++------ vp9/encoder/vp9_bitstream.c | 5 ++--- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/vp9/common/vp9_onyxc_int.h b/vp9/common/vp9_onyxc_int.h index abbf73f19..9d700cda4 100644 --- a/vp9/common/vp9_onyxc_int.h +++ b/vp9/common/vp9_onyxc_int.h @@ -305,11 +305,10 @@ static int mi_cols_aligned_to_sb(VP9_COMMON *cm) { return 2 * ((cm->mb_cols + 3) & ~3); } -static INLINE void set_partition_seg_context(VP9_COMMON *cm, - MACROBLOCKD *xd, +static INLINE void set_partition_seg_context(VP9_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col) { xd->above_seg_context = cm->above_seg_context + mi_col; - xd->left_seg_context = cm->left_seg_context + (mi_row & MI_MASK); + xd->left_seg_context = cm->left_seg_context + (mi_row & MI_MASK); } static int check_bsize_coverage(VP9_COMMON *cm, MACROBLOCKD *xd, diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c index 87253a999..8542679ca 100644 --- a/vp9/decoder/vp9_decodframe.c +++ b/vp9/decoder/vp9_decodframe.c @@ -206,8 +206,8 @@ static void set_offsets(VP9D_COMP *pbi, BLOCK_SIZE_TYPE bsize, pd->left_context = cm->left_context[i] + (((mi_row * 2) & 15) >> pd->subsampling_y); } - xd->above_seg_context = cm->above_seg_context + mi_col; - xd->left_seg_context = cm->left_seg_context + (mi_row & MI_MASK); + + set_partition_seg_context(cm, xd, mi_row, mi_col); // Distance of Mb to the various image edges. These are specified to 8th pel // as they are always compared to values that are in 1/8th pel units @@ -304,10 +304,8 @@ static void decode_modes_sb(VP9D_COMP *pbi, int mi_row, int mi_col, if (bsize >= BLOCK_SIZE_SB8X8) { int pl; - int idx = check_bsize_coverage(pc, xd, mi_row, mi_col, bsize); - // read the partition information - xd->left_seg_context = pc->left_seg_context + (mi_row & MI_MASK); - xd->above_seg_context = pc->above_seg_context + mi_col; + const int idx = check_bsize_coverage(pc, xd, mi_row, mi_col, bsize); + set_partition_seg_context(pc, xd, mi_row, mi_col); pl = partition_plane_context(xd, bsize); if (idx == 0) diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index a8fadd1cb..a80adc1c4 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -656,9 +656,8 @@ static void write_modes_sb(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc, if (bsize >= BLOCK_SIZE_SB8X8) { int pl; - int idx = check_bsize_coverage(cm, xd, mi_row, mi_col, bsize); - xd->left_seg_context = cm->left_seg_context + (mi_row & MI_MASK); - xd->above_seg_context = cm->above_seg_context + mi_col; + const int idx = check_bsize_coverage(cm, xd, mi_row, mi_col, bsize); + set_partition_seg_context(cm, xd, mi_row, mi_col); pl = partition_plane_context(xd, bsize); // encode the partition information if (idx == 0) -- 2.40.0