diff options
Diffstat (limited to 'vp8/decoder/decodemv.c')
-rw-r--r-- | vp8/decoder/decodemv.c | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/vp8/decoder/decodemv.c b/vp8/decoder/decodemv.c index 0a7942d89..fe5a427cd 100644 --- a/vp8/decoder/decodemv.c +++ b/vp8/decoder/decodemv.c @@ -208,11 +208,13 @@ static const unsigned char mbsplit_fill_offset[4][16] = { - static void mb_mode_mv_init(VP8D_COMP *pbi) { vp8_reader *const bc = & pbi->bc; MV_CONTEXT *const mvc = pbi->common.fc.mvc; +#if CONFIG_SEGMENTATION + MACROBLOCKD *const xd = & pbi->mb; +#endif #if CONFIG_ERROR_CONCEALMENT /* Default is that no macroblock is corrupt, therefore we initialize @@ -253,6 +255,9 @@ static void mb_mode_mv_init(VP8D_COMP *pbi) } read_mvcontexts(bc, mvc); +#if CONFIG_SEGMENTATION + xd->temporal_update = vp8_read_bit(bc); +#endif } } @@ -263,7 +268,11 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, vp8_reader *const bc = & pbi->bc; MV_CONTEXT *const mvc = pbi->common.fc.mvc; const int mis = pbi->common.mode_info_stride; - +#if CONFIG_SEGMENTATION + MACROBLOCKD *const xd = & pbi->mb; + int sum; + int index = mb_row * pbi->common.mb_cols + mb_col; +#endif int_mv *const mv = & mbmi->mv; int mb_to_left_edge; int mb_to_right_edge; @@ -274,7 +283,6 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, mb_to_bottom_edge = pbi->mb.mb_to_bottom_edge; mb_to_top_edge -= LEFT_TOP_MARGIN; mb_to_bottom_edge += RIGHT_BOTTOM_MARGIN; - mbmi->need_to_clamp_mvs = 0; /* Distance of Mb to the various image edges. * These specified to 8th pel as they are always compared to MV values that are in 1/8th pel units @@ -289,7 +297,41 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi, /* If required read in new segmentation data for this MB */ if (pbi->mb.update_mb_segmentation_map) - vp8_read_mb_features(bc, mbmi, &pbi->mb); + { +#if CONFIG_SEGMENTATION + if (xd->temporal_update) + { + sum = 0; + + if (mb_col != 0) + sum += (mi-1)->mbmi.segment_flag; + if (mb_row != 0) + sum += (mi-pbi->common.mb_cols)->mbmi.segment_flag; + + if (vp8_read(bc, xd->mb_segment_tree_probs[3+sum]) == 0) + { + mbmi->segment_id = pbi->segmentation_map[index]; + mbmi->segment_flag = 0; + } + else + { + vp8_read_mb_features(bc, &mi->mbmi, &pbi->mb); + mbmi->segment_flag = 1; + pbi->segmentation_map[index] = mbmi->segment_id; + } + + } + else + { + vp8_read_mb_features(bc, &mi->mbmi, &pbi->mb); + pbi->segmentation_map[index] = mbmi->segment_id; + } + index++; +#else + vp8_read_mb_features(bc, &mi->mbmi, &pbi->mb); +#endif + } + /* Read the macroblock coeff skip flag if this feature is in use, else default to 0 */ if (pbi->common.mb_no_coeff_skip) |