Reset segment_id to 0 when segmentation is disabled

Whilst the encoder explicitly set the segment_id to 0
when segmentation is diabled, the decoder would allow
the segment_id to persist from the previous frame.

This fix attempts to make the decoder behave the same
as the encoder by explicitly setting the segment_id to
0 in this case.

Change-Id: I65c3a05247550edb10706eb5d54d306dfb792309
This commit is contained in:
Adrian Grange 2011-12-16 14:00:36 -08:00
parent b3ade15a26
commit 0fafd0543f

View File

@ -468,45 +468,52 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
mb_to_right_edge += RIGHT_BOTTOM_MARGIN;
/* If required read in new segmentation data for this MB */
if (xd->update_mb_segmentation_map)
if (xd->segmentation_enabled)
{
// Is temporal coding of the segment id for this mb enabled.
if (xd->temporal_update)
if (xd->update_mb_segmentation_map)
{
// Work out a context for decoding seg_id_predicted.
pred_context = 0;
if (mb_col != 0)
pred_context += (mi-1)->mbmi.seg_id_predicted;
if (mb_row != 0)
pred_context +=
(mi-pbi->common.mode_info_stride)->mbmi.seg_id_predicted;
mbmi->seg_id_predicted =
vp8_read(bc,
xd->mb_segment_pred_probs[pred_context]);
if ( mbmi->seg_id_predicted )
// Is temporal coding of the segment id for this mb enabled.
if (xd->temporal_update)
{
mbmi->segment_id = pbi->segmentation_map[index];
// Work out a context for decoding seg_id_predicted.
pred_context = 0;
if (mb_col != 0)
pred_context += (mi-1)->mbmi.seg_id_predicted;
if (mb_row != 0)
pred_context +=
(mi-pbi->common.mode_info_stride)->mbmi.seg_id_predicted;
mbmi->seg_id_predicted =
vp8_read(bc,
xd->mb_segment_pred_probs[pred_context]);
if ( mbmi->seg_id_predicted )
{
mbmi->segment_id = pbi->segmentation_map[index];
}
// If the segment id was not predicted decode it explicitly
else
{
vp8_read_mb_segid(bc, &mi->mbmi, xd);
pbi->segmentation_map[index] = mbmi->segment_id;
}
}
// If the segment id was not predicted decode it explicitly
// Normal unpredicted coding mode
else
{
vp8_read_mb_segid(bc, &mi->mbmi, xd);
pbi->segmentation_map[index] = mbmi->segment_id;
}
index++;
}
// Normal unpredicted coding mode
else
{
vp8_read_mb_segid(bc, &mi->mbmi, xd);
pbi->segmentation_map[index] = mbmi->segment_id;
}
index++;
}
else
{
// The encoder explicitly sets the segment_id to 0
// when segmentation is disabled
mbmi->segment_id = 0;
}
//#if CONFIG_SEGFEATURES
if ( pbi->common.mb_no_coeff_skip &&
( !segfeature_active( xd,