From: Gernot Ziegler (gz++at++lysator.liu.se)
Date: 09/28/2001 10:46:30
Hej folks !
Now that my MPEG2-playback is working (but only in Linux, have to fix some
things before it works on IRIX, I am using Linux-only libraries for audio
playback), I would like to iron out some performance issues;
one of them is that the YUV->RGB conversion is done in software; I would
like to use the new OpenGL 1.2 color matrix to do this download ... a
collegue of mine used the following code to download the texture:
static GLfloat Matrix_YCbCr2RGB[16] = {
1, 1, 1, 0,
0, -0.344136, 1.773, 0,
1.402, -0.714136, 0, 0,
0, 0, 0, 0
};
and then:
// Setup YCbCr -> RGB color transform matrix
glMatrixMode(GL_COLOR);
if (convYUV2RGB) {
glLoadMatrixf(Matrix_YCbCr2RGB);
glPixelTransferf(GL_GREEN_BIAS, -0.5);
glPixelTransferf(GL_BLUE_BIAS, -0.5);
}
else {
glLoadIdentity();
glPixelTransferf(GL_GREEN_BIAS, 0.0);
glPixelTransferf(GL_BLUE_BIAS, 0.0);
}
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
imgWidth, imgHeight,
GL_RGB, GL_UNSIGNED_BYTE, imgData);
glMatrixMode(GL_MODELVIEW);
------------
Hmmm, what do I have to do now to get this working in Performer ?
I thought of something in the style of:
int
texmpeg_YUVMap(pfTraverser *trav, void *data)
{
int convYUV2RGB = 1;
// Setup YCbCr -> RGB color transform matrix
glMatrixMode(GL_COLOR);
if (convYUV2RGB)
{
glPushMatrix();
printf("Now modifying color matrix!\n");
glLoadMatrixf(Matrix_YCbCr2RGB);
glPixelTransferf(GL_GREEN_BIAS, -0.5);
glPixelTransferf(GL_BLUE_BIAS, -0.5);
}
else
{
glLoadIdentity();
glPixelTransferf(GL_GREEN_BIAS, 0.0);
glPixelTransferf(GL_BLUE_BIAS, 0.0);
}
#if 0
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
imgWidth, imgHeight,
GL_RGB, GL_UNSIGNED_BYTE, imgData);
#endif
glMatrixMode(GL_MODELVIEW);
return NULL;
}
and adding this as a draw callback to my rectangle that is used as video
surface ...
Does this sound reasonable ?
Or is there another magic functionality that I haven't heard of yet (I'm a
newbie in mixed & advanced OpenGL/Performer programming :-) )
Servus,
Gernot
/-----------------------------W-E-L-C-O-M-E------------------------------\
T The Austria <=> Sweden connection..... T
| E-Mail: gz++at++lysator.liu.se H
O Homepage: http://www.lysator.liu.se/~gz E
\------------------------------F-U-T-U-R-E-------------------------------/
This archive was generated by hypermail 2b29 : Fri Sep 28 2001 - 10:46:41 PDT