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

Andreas Dehnhardt xvid-devel@xvid.org
Fri, 03 Jan 2003 23:59:09 +0100


Christoph Lampert wrote:

>>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???
> 
> 
> 
> The problem is not too few standards, but too many of them. 
> We should finally agree on one. 
> 
> I guess your problem is related to the colorspace paramers: 
> 
> #define XVID_CSP_YV12   1  /**< YV12 colorspace (y,v,u planar) */
> #define XVID_CSP_YUY2   2  /**< YUY2 colorspace (y,u,y,v packed) */
> #define XVID_CSP_UYVY   3  /**< UYVY colorspace (u,y,v,y packed) */
> #define XVID_CSP_I420   4  /**< I420 colorsapce (y,u,v planar) */
> 
> (from src/xvid.h)
> 
> xvid_encraw uses XVI_CSP_YV12 as input. Maybe this is wrong and I should
> have used XVID_CSP_I420, because internal format of MPEG-4 is supposed to be
> YUV = YCbCr ? 



Right, This one is used by the fpdam encoder/decoder.




> 
> I never notice these things because I don't use RGB output, but look at
> YUV as greyscale... 
> 
> 
> Anyway, change line 655 in xvid_encraw.c to 
> 
>         xframe.colorspace = XVID_CSP_I420;  
> 
> and I hope the problem will be gone...
> 




Now it works. All the MPEG-4 verification sequences (mobile, foreman, coastguard, stefan, ....)
are using this format.






Andreas