Each coded picture, a coded frame or field, is composed of one or more slices, each containing a slice header followed an integral number of macroblocks. The number of macroblocks
in a slice need not be constant. Possible scenarios for choosing slice sizes include:
- One slice per coded picture, common practice in many H.264 encoding applications.
- N slices per picture, each containing M macroblocks, N and M integer. The number of bytes in each coded slice will tend to vary depending on the amount of motion and detail in the picture area.
- N slices per picture, containing a varying number of macroblocks, chosen to keep the number of bytes per slice roughly constant.
The available slice types are shown below, together with the macroblock types that may be present in each slice. Note that a B slice (for example) may contain B, P and/or I
macroblock types and an encoder may choose between these types depending on the content of the sequence.
|Slice type||Contains macroblock types||Comments|
|I (including IDR)||I only||Intra prediction only.|
|P||I and/or P||Intra prediction (I) and/or prediction from|
one reference per macroblock partition
|B||I, P and/or B||Intra prediction (I), prediction from one|
reference (P) or biprediction, i.e.
prediction from two references (B)
|SP||P and/or I||Switching P slice|
|SI||SI||Switching I slice|
The slice header conveys information common to all macroblocks in the slice, such as
- Slice type which determines which macroblock types are allowed
- Frame number that the slice corresponds to
- Reference picture settings
- Default quantization parameter (QP)
The Macroblock Layer contains all the syntax elements necessary to decode a single macroblock. mb_type indicates the macroblock coding type, I, SI, P or B, and further information about macroblock prediction and coding.
- An I macroblock (Intra) can occur in any slice type and is coded without reference to any other slices.
- An SIntra MB (SI) occurs only in switching or SI
- A P macroblock (Predicted) can occur in P or SP slices and is inter-coded with one prediction reference.
- A B macroblock (BiPredicted) can occur in B slices and is inter-coded with one or two prediction references.