diff options
Diffstat (limited to 'vp8/encoder')
-rw-r--r-- | vp8/encoder/bitstream.c | 22 | ||||
-rw-r--r-- | vp8/encoder/segmentation.c | 21 |
2 files changed, 22 insertions, 21 deletions
diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c index eda40f375..cea5a6ce4 100644 --- a/vp8/encoder/bitstream.c +++ b/vp8/encoder/bitstream.c @@ -1041,26 +1041,28 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) if (cpi->mb.e_mbd.update_mb_segmentation_map) { #if CONFIG_SEGMENTATION + // Is temporal coding of the segment map enabled if (xd->temporal_update) { + // Look at whether neighbours were successfully predicted + // to create a context for the seg_id_predicted flag. pred_context = 0; if (mb_col != 0) - pred_context += (m-1)->mbmi.segment_flag; + pred_context += (m-1)->mbmi.seg_id_predicted; if (mb_row != 0) - pred_context += (m-pc->mb_cols)->mbmi.segment_flag; + pred_context += (m-pc->mb_cols)->mbmi.seg_id_predicted; - if (m->mbmi.segment_flag == 0) - { - vp8_write(w,0,xd->mb_segment_pred_probs[pred_context]); - } - else - { - vp8_write(w,1,xd->mb_segment_pred_probs[pred_context]); + // Code the prediction flag for this mb + vp8_write( w, m->mbmi.seg_id_predicted, + xd->mb_segment_pred_probs[pred_context]); + + // If the mbs segment id was not predicted code explicitly + if (!m->mbmi.seg_id_predicted) write_mb_segid(w, mi, &cpi->mb.e_mbd); - } } else { + // Normal undpredicted coding write_mb_segid(w, mi, &cpi->mb.e_mbd); } index++; diff --git a/vp8/encoder/segmentation.c b/vp8/encoder/segmentation.c index 2eb0ce408..2dc96c61b 100644 --- a/vp8/encoder/segmentation.c +++ b/vp8/encoder/segmentation.c @@ -226,25 +226,26 @@ void choose_segmap_coding_method( VP8_COMP *cpi ) pred_context = 0; if (mb_col != 0) pred_context += - (xd->mode_info_context-1)->mbmi.segment_flag; + (xd->mode_info_context-1)->mbmi.seg_id_predicted; if (mb_row != 0) + { pred_context += - (xd->mode_info_context-cm->mb_cols)->mbmi.segment_flag; + (xd->mode_info_context-cm->mb_cols)-> + mbmi.seg_id_predicted; + } // Test to see if the last frame segment id at the same - // locationcorrectly predicts the segment_id for this MB. + // location correctly predicts the segment_id for this MB. // Update the prediction flag and count as appropriate; if ( segment_id == cpi->last_segmentation_map[segmap_index] ) { - //xd->mode_info_context->mbmi.segment_predicted = 1; - xd->mode_info_context->mbmi.segment_flag = 0; - temporal_predictor_count[pred_context][0]++; + xd->mode_info_context->mbmi.seg_id_predicted = 1; + temporal_predictor_count[pred_context][1]++; } else { - //xd->mode_info_context->mbmi.segment_predicted = 0; - xd->mode_info_context->mbmi.segment_flag = 1; - temporal_predictor_count[pred_context][1]++; + xd->mode_info_context->mbmi.seg_id_predicted = 0; + temporal_predictor_count[pred_context][0]++; // Update the "undpredicted" segment count t_unpred_seg_counts[segment_id]++; @@ -317,8 +318,6 @@ void choose_segmap_coding_method( VP8_COMP *cpi ) xd->temporal_update = 0; vpx_memcpy( xd->mb_segment_tree_probs, no_pred_tree, sizeof(no_pred_tree) ); - //vpx_memcpy( &xd->mb_segment_pred_probs, - // t_nopred_prob, sizeof(t_nopred_prob) ); } } #endif |