The first step in H.264/AVC decoding is to analyze and disassemble the bitstream. The encoded macroblocks are decoded in the entropy decoder, inverse quantized and inverse scaled. Then the inverse transform is applied and the residual macroblock is formed. Macroblocks containing information about intraframe prediction and interframe motion vectors are also decoded.
If the macroblock uses interframe prediction, the corresponding motion vectors are extracted from the input bitstream and the reference macroblock is extracted from the reference frame that was already decoded and stored in the decoded picture buffer. If the macroblock uses intraframe prediction, the reference is taken from a part of the same frame that was already decoded.
The decoded residual macroblock is added to the reference macroblock and the deblocking filter is applied. The output macroblock is copied to the output frame and stored in the decoded picture buffer. The finished frames must be rearranged according to the order defined by the GOP structure before they can be output by the decoder.