summaryrefslogtreecommitdiff
path: root/vp8/decoder/decodemv.c
diff options
context:
space:
mode:
Diffstat (limited to 'vp8/decoder/decodemv.c')
-rw-r--r--vp8/decoder/decodemv.c50
1 files changed, 46 insertions, 4 deletions
diff --git a/vp8/decoder/decodemv.c b/vp8/decoder/decodemv.c
index 203d72dd2..415392b68 100644
--- a/vp8/decoder/decodemv.c
+++ b/vp8/decoder/decodemv.c
@@ -245,11 +245,13 @@ unsigned char vp8_mbsplit_fill_offset[4][16] = {
-
void vp8_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
pbi->prob_skip_false = 0;
if (pbi->common.mb_no_coeff_skip)
@@ -284,6 +286,9 @@ void vp8_mb_mode_mv_init(VP8D_COMP *pbi)
}
read_mvcontexts(bc, mvc);
+#if CONFIG_SEGMENTATION
+ xd->temporal_update = vp8_read_bit(bc);
+#endif
}
}
@@ -294,7 +299,11 @@ void vp8_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
MV *const mv = & mbmi->mv.as_mv;
int mb_to_left_edge;
int mb_to_right_edge;
@@ -305,7 +314,6 @@ void vp8_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
@@ -320,7 +328,41 @@ void vp8_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)