[XviD-devel] illegal MPEG-4 Bitstream Syntax / RAW YUV input swaped

Andreas Dehnhardt xvid-devel@xvid.org
Fri, 03 Jan 2003 22:34:47 +0100


Hi everyone,

1) illegal MPEG-4 Bitstream Syntax

I was playing around with the xvidcore-0.9.0 codec and found out the following:
After encoding a sequence to a raw MPEG-4 bitstream, I tried to decode
it using the standard MPEG-4 decoder (the reference ISO fpdam decoder).

The decoding failed at the second I-VOP, it complained about an illegal
VOP_START_CODE while parsing the bitstream. This error is caused by
FrameCodeI() in "encoder.c". There is a new VO/VOL-Header inserted into the
bitstream (BitstreamWriteVolHeader()) for every new I-VOP. According to
the MPEG-4 standard, this structure is illegal. The VO/VOL-Header is only
allowed at the start of the sequence. The VOPs (in our case, a Frame is
equal to a VOP) are instances of one VideoObject (VO) at a given time.
VideoObjectLayers (VOLs) are used for object based temporal and spatial
scalability (not included in the simple profile of MPEG-4). We only have
one VO and one VOL, so we cannot include more than one VO/VOL-Header.

I disabled the BitstreamWriteVolHeader()-call (except for the initial I-VOP).
After this modification, the standard MPEG-4 decoder was able to decode
the whole bitstream.

Did anyone play around with decoding the raw MPEG-4 stream using other
decoders before?




2) RAW YUV input swaped

I used raw YUV data as input for the encoder. After encoding (xvid_encraw)
and decoding (fpdam), the colors seem to be somehow "wrong". I swaped
the order of U and V in my input YUV-file. This fixed the error. I don't
know the "correct" order of a YUV-file. Either the encoder swaps the
color information while reading the raw data or there is no standard
YUV-order for such files???




I hope this is useful for anyone and we will have a nice
discussion about VO/VOL/VOP :-)


Have fun,
Andreas