Re: YV12 decoding
"peter ross" <[email protected]>
| Newsgroups | gmane.comp.video.xvid.user |
|---|---|
| Message-ID | <[email protected]> |
>From: Rrrough Spirit <[email protected]> >(which admittedly isn't THAT important). >sh0dan stated, that the needed functions are basically >already there, so my question is, would it be >painlessly possible to modify xvid that way, that it >always decodes (raw) YV12 streams and reports it to >virtualdub "upon request" ? Or maybe at least include >this hack into CVS ? I'd love to be independant from >DivX5, and still have a mighty fast compression >without any color conversions. hi, ive commited the yv12->yv12 memcpy hack into cvs. does anyone think xvid should provide application access all our colorspace conversion functionality via the api? OR, should we only provide yv12->rbg as a quick fix until virtualdub supports yv12?? i can see five levels upon which color conversion can be implemented: 1. basic hack. provide a simple YV12->xxx ========================================== opt = XVID_INIT_YV12TOXXX typedef struct { int width; int height; DEC_PICTURE * input; // YV12 input image int colorspace; // output colorspace void * output; // output buffer void * stride; // output stride } XVID_INIT_YV12PARAM; 2. add support for all conversions ================================== opt = XVID_INIT_CONVERT typedef struct { int colorspace; int width, height; void * y_ptr; void * u_ptr; void * v_ptr; int y_stride; int uv_stride; } XVID_IMAGE; // passed as param1 and param2 param1 = destination, param2 = source when colorspace is packed, only y_ptr and y_stride as used. return fail if the width/height do not match. 3. modify encoder/decoder to use XVID_IMAGE ============================================ the XVID_IMAGE structure neatly describes all the properties of an image, so we could use this within the encoder and decoder. 4. remove image conversions from encoder/decoder ================================================ * rename xvid_init to xvid_global. * remove colorspace stuff from the encoder and decoder, and place it into the global function. (XVID_INIT_CONVERT becomes XVID_GLO_CONVERT) * upon creation, the encoder and decoder return thier internal buffers. colorspace handling if left upto the application. (much like mpeg2dec). e.g. encoding: xvid_global(0, XVID_GLO_INIT, xinit); // init xvid xvid_encode(0, XVID_ENC_CREATE, xparam); // create encoder while( ...frames...) { xvid_global(0, XVID_GLO_CONVERT, my_src_bmp, xparam.image); xvid_encoder(xparam.handle, XVID_ENC_ENCODE); } xvid_encoder(xparam.handle. e.g. decoding: xvid_global(0, XVID_GLO_INIT, xinit); // init xvid xvid_decode(0, XVID_DEC_CREATE, xparam); // create encoder while( ...frames...) { xvid_encoder(xparam.handle, XVID_DEC_ENCODE); xvid_global(0, XVID_GLO_CONVERT, xparam.image, my_dst_bmp); } xvid_encoder(xparam.handle. 5. write a seperate libcolorspace, or libxvidcolorspace or something ==================================================================== ?! iam happy with number 2 (or maybe 3). any other opinions? -- pete _________________________________________________________________ Get faster connections -- switch to MSN Internet Access! http://resourcecenter.msn.com/access/plans/default.asp