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

Eduardo Machado dudaskank at yahoo.com
Sat Dec 27 17:59:02 CET 2003


Hi all!
 
So, after the fight between me and the bootstrap.sh to install the XviD library, version 1.0 beta 2, I've discovered that, since 0.9.2, some names of structs have changed...
 
In the site, the names are like in 0.9.2, but ok, after I opened and searched the xvid.h and xvid_decraw.c, I have finished the conversion...
 
After the compilation of my library, all ok, I've tested it with the samples I usually test.
 
Then, the problem appear! With the versoin 0.9.2, all work great and ok, like in windows media player you know... but with 1.0.b2, argh! Not a single frame!
 
I'm using many different colorspaces, XVID_CSP_RGB555, XVID_CSP_RGB565, XVID_CSP_BGR, XVID_CSP_BGRA.
 
The strange thing is, when I use XVID_CSP_BGRA and multiply the stride * 4 and XVID_CSP_BGR and multiply the stride again * 3, it "works" (at least some frames).
 
Is this a bug? Because with the exact same structure the 0.9.2 can play the movies, the changes I've made is only the names of certain structs... the code is bellow (the comented code is the original code, working with 0.9.2 version):
 

// the function to initialize xvidint dec_init_xvid(void){ int xerr;  xvid_gbl_init_t xinit; xvid_dec_create_t xparam; xinit.cpu_flags = 0;// xinit.cpu_flags = XVID_CPU_FORCE; /********/ xinit.version = XVID_VERSION;// xvid_init(NULL, 0, &xinit, NULL); xvid_global(NULL, 0, &xinit, NULL); /********/ xparam.version = XVID_VERSION; xparam.width = the_movie->xvid; xparam.height = the_movie->yvid; xerr = xvid_decore(NULL, XVID_DEC_CREATE, &xparam, NULL); dechandle = xparam.handle; // choose the proper function to convert from bgr to bitmap, based on current bpp switch(bitmap_color_depth(screen)) {  case 8 :   xvid_colorspace = XVID_CSP_NULL;   return 1;  break;  case 15 :   bgr_to_bitmap = NULL;   xvid_colorspace = XVID_CSP_RGB555;  break;  case 16 :   bgr_to_bitmap = NULL;   xvid_colorspace = XVID_CSP_RGB565;  break;  case 24 :   bgr_to_bitmap = bgr_to_bitmap24;   xvid_colorspace = XVID_CSP_BGR;  break;  case 32 :   bgr_to_bitmap = NULL;   xvid_colorspace = XVID_CSP_BGRA;  break; }
 return xerr;}// function to decode the frameint load_memory_dat_xvid_ex(void *data, BITMAP *dest){ int xerr; xvid_dec_frame_t xframe; xvid_dec_stats_t status; DATAFILE *dat; dat = (DATAFILE *)the_movie->movie; // initialize the dec_frame struct /********/ xframe.version = XVID_VERSION; status.version = XVID_VERSION; xframe.general = 0;// xframe.stride = the_movie->xvid; xframe.output.stride[0] = the_movie->xvid; // if necessary, skip some frames for slow computers while(the_movie->last_frame + 1 < the_movie->frame) {  the_movie->last_frame++;  xframe.bitstream = dat[the_movie->last_frame].dat;  xframe.length = dat[the_movie->last_frame].size;//  xframe.colorspace = XVID_CSP_NULL;  xframe.output.csp = XVID_CSP_NULL;//  xerr = xvid_decore(dechandle, XVID_DEC_DECODE, &xframe, NULL);  xerr = xvid_decore(dechandle, XVID_DEC_DECODE, &xframe, &status);  if(xerr < 0) {   // invalid frame   return 1;  } } // initialize the dec_frame struct with the actual frame data xframe.bitstream = data;
 xframe.length = dat[the_movie->frame].size; // XVID_CSP_USER is fastest (no memcopy involved) xframe.output.csp = xvid_colorspace;// xframe.image = (void *)bmp_write_line(dest, 0); xframe.output.plane[0] = (void *)bmp_write_line(dest, 0); // decode the frame// xerr = xvid_decore(dechandle, XVID_DEC_DECODE, &xframe, NULL); xerr = xvid_decore(dechandle, XVID_DEC_DECODE, &xframe, &status); bmp_unwrite_line(dest); if(xerr < 0) {  // error decoding  return 1; } // convert if needed if(bgr_to_bitmap) {  bgr_to_bitmap(dest); } // update the content of last_frame the_movie->last_frame = the_movie->frame; return 0;}
 
If you want, samples and the binaries of my lib using xvid 0.9.2 can be found in http://mjpgalleg.sf.net
 
Please!!! Someone point me to what I'm doing wrong, or tell me if this is a bug or not. And forgive my poor english... :-/
 
Thanks!
 
^__^
 



Eduardo
A{text-decoration:none;color:#09f}A:visited{text-decoration:none;color:#093}A:hover {text-decoration:underline;color: #00f;background: #eee}
Home Page | dudaskank at yahoo.com | ICQ: 157528738
Tetris 1.1 | MJpgAlleg 2.3


As mais belas frases de amor são ditas no silêncio de um olhar



---------------------------------
Central anti-spam do Yahoo! Mail: com dicas, dúvidas e curiosidades!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://edu.bnhof.de/pipermail/xvid-devel/attachments/20031227/84dcb91e/attachment.htm


More information about the XviD-devel mailing list