[XviD-devel] Is it a bug in colorspace?

Christoph Nägeli chn at kbw.ch
Sun Dec 28 12:40:28 CET 2003


Hi,

I'm not quite sure what's wrong with your code but here's the code that 
works fine for me:
	- decoder is the the decoder instance returned from xvid_decore(..., 
XVID_DEC_CREATE, ...)
	- pixmap is the bitmap where the frame should be rendered.
	- imagebuffer is the mpeg4 stream you wish to decode
	- bufferlength the number of bytes in imagebuffer
	- stride is the number of bytes from the beginning of a row to the 
beginning of the next row

void DecompressXviDFrame(void *decoder, void *pixmap, void 
*imagebuffer, int bufferlength, short stride)
{
     int xresult;
     xvid_dec_frame_t dec;

     memset(&dec, 0, sizeof(xvid_dec_frame_t));
     dec.version = XVID_VERSION;

     dec.bitstream = imagebuffer;
     dec.length = bufferlength;

     dec.general = 0; // or XVID_LOWDELAY

     dec.output.csp = XVID_CSP_ARGB;

     dec.output.plane[0] = pixmap;
     dec.output.plane[1] = NULL;
     dec.output.plane[2] = NULL;

     dec.output.stride[0] = stride;
     dec.output.stride[1] = 0;
     dec.output.stride[2] = 0;

     xresult = xvid_decore(decoder, XVID_DEC_DECODE, &dec, NULL);
} // DecompressXviDFrame

If you like you can have a look at the source code of mplayer,
the file 'vd_xvid4.c' is the interface for the xvid library decoder.

Hope this helps
Christoph
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2328 bytes
Desc: not available
Url : http://edu.bnhof.de/pipermail/xvid-devel/attachments/20031228/baec88f4/attachment.bin


More information about the XviD-devel mailing list