[XviD-devel] B-Frame Questions

Christoph Lampert chl at math.uni-bonn.de
Mon Feb 17 17:12:25 CET 2003


On 17 Feb 2003, Ravage wrote:
> 1) B-Frames:
> Without B-Frames the codec works straight forward: give them a frame -
> it decodes - know you can display
> it. If I'm not wrong, this is how it works with I- and P-Frames.
> But with B-Frames are enabled the problem is that I'll need the
> corresponding frames for decoding the 
> B-Frame. So I need to give the codec the frame(s) before and after first
> - then it will be decoding it.
> Right ?

For encoding, you give the frames in viewing order, (so first the frame
that is supposed to become a B-VOP, later the second reference VOP).
If your GOP is IBBP input for the decoder is IBBP. 
Output of the encoder will be (after some delay): IPBB

For decoding, you have to give the frames in decoding order, so if the
GOP is IBBP you have to give them as  IPBB which is just the order 
the encoder had as output. Output of the decoder will be IBBP, in viewing
order. 

> But in which order ? 
> A player must know which frame is displayed next and has to reorder
> these frame after decoding ?!
>
> 2) How is the detection of the frame type done and where ?
> Are there some routines checking if the frame delivert to the codec is a
> I-/P-/B-Frame or is it done
> "deep" within while decoding itself ?

The encoder decides on frame type rather early in encoder.c, because 
handling of B-VOPs is very different from others. 
The decoder simply reads a few byte from the beginning of the encoded VOP.
There the VOP-type is specified by some value in some data field of MPEG
header.

gruel



More information about the XviD-devel mailing list