Trans.: Fw: Re: [XviD-devel] stream position after reading the user data

Edouard Gomez ed.gomez at free.fr
Wed Jan 19 10:18:59 CET 2005


Pete has some problems with emails being rejected by xvid-devel ML. So i forward
his answer.

----------[Forwarded message]--------------

hi martin,

On Sun, 16 Jan 2005 15:39:28 +0100 Martin Kuball <MartinKuball at web.de> wrote:
> I'm currently trying to understand how to read a mp4 as profile. And
> my reference is the xvid implementation. While reading the code I
> noticed that the after reading the user data string the bitstream is
> positioned at the last character (not the terminating 0). Why is this
> so? The character is skipt when reading the next startcode. I can't
> see situation where it is part of the next startcode.

there is no requirement in the mpeg-4 standard for a terminating zero.
therefore xvid must stop reading bytes the moment it see a zero, because
this may belong to the subsequent startcode (see example below).

    00 00 01 b2 | 'X'  'V'  'I' 'D' |  00 00 01 b3
    USERDATA_SC | arbitrary data    |  VOP_SC

here's another example, where there is a zero embedded in the arbitrary
data! xvid will only parse the "XV". this is sufficient because we only
care about xvid and divx userdata.

    00 00 01 b2 | 'X'  'V'  00 'I' 'D' |  00 00 01 b3
    USERDATA_SC | arbitrary data       |  VOP_SC


> All the more the code for reading the user data looks overly complicated
> just to achieve this effect.

we welcome any suggestions (or patches) that improve the readibility of
the code!

cheers,
-- pete


More information about the XviD-devel mailing list