[GEM-dev] Re: FFMPEG in GEM

IOhannes zmoelnig zmoelnig at iem.kug.ac.at
Wed Dec 3 16:34:10 CET 2003


Henning Haaland Kulander wrote:
> Hi!
> 
> The problem now is that the image is flipped vertically and horizontally 
> and blue colors are green and vice versa. Do you have any idea why this 
> is, and how it can be fixed? What format does GEM use to store the image? 

flipping upside-down canbe done with the "upsidedown"-flag in the 
imageStruct-structure. the problem is, that openGL handles the 
upside-down orientation contrary to all other image-applications (1st 
pixel is lower-left edge instead of upper-left)

he other problem is BGR-colorspace (or BGRA) vs RGB(A).
(pix_* processing in) Gem supports 3 different colorspaces: GL_RGBA, 
yuv422 (UYVY) and Greyscale (GL_LUMINANCE). the [pix_texture] just 
passes the current-colorspace to the renderer, thus supporting other 
formats like GL_BGR too.

however, the imageStruct-class has functions fromBGR(data) (and similar: 
like fromGrey()) to convert data into "native"-Gem-colourspace.
how to use it ?
1. set-up the imageStruct correctly (xsize, ysize, format/csize/type can 
be handled with the setCsizeByFormat() finction - you only need to now 
the format this way)
2. get a pointer to the image-data you want to convert.
unsigned char* bgr_data=<pointer to my BGR-data)
shouldn`t be image.data;
then call image.fromBGR(bgr_data);
et voila.

however, great you have had a look on this.
i will incorporate it when i am at home (in 0.5h)

mfg.asd.r
IOhannes





More information about the GEM-dev mailing list