blob: 1243286168b045f563138b7db0bb112bffc1d960 [file] [log] [blame]
### Chapter 10: Segment-based Feature Adjustments {#h-10-00}
Every macroblock may optionally override some of the default behaviors of the decoder. Specifically, VP8 uses segment-based adjustments to support changing quantizer level and loop filter level for a macroblock. When the segment-based adjustment feature is enabled for a frame, each macroblock within the frame is coded with a `segment_id`. This effectively segments all the macroblocks in the current frame into a number of different segments. Macroblocks within the same segment behave exactly the same for quantizer and loop filter level adjustments.
If both the `segmentation_enabled` and `update_mb_segmentation_map` flags in subsection B of the frame header take a value of `1`, the prediction data for each (intra- or inter-coded) macroblock begins with a specification of `segment_id` for the current macroblock. It is decoded using this simple tree ...
const tree_index mb_segment_tree [2 * (4-1)] =
2, 4, /* root: "0", "1" subtrees */
-0, -1, /* "00" = 0th value, "01" = 1st value */
-2, -3 /* "10" = 2nd value, "11" = 3rd value */
... combined with a 3-entry probability table `mb_segment_tree_probs[3]`. The macroblock's `segment_id` is used later in the decoding process to look into the `segment_feature_data` table and determine how the quantizer and loop filter levels are adjusted.
The decoding of `segment_id`, together with the parsing of intra-prediction modes (which is taken up next), is implemented in the reference decoder file `modemv.c`.