Philip Lamb schrieb:
Hi all,

For one of our projects which we are connecting to OSG, we use YCbCr pixels where possible, via the GL_APPLE_ycbcr_422 OpenGL extension on Mac OS X and/or the GL_MESA_ycbcr_texture OpenGL extension on Linux.

I see no support for these extensions in OSG, and I wonder if anyone has considered it / put it into the too hard / don't care basket?

I did some tests with GL_APPLE_ycbcr_422 and the Quicktime-movie-plugin. It was a bit wonky (but twice as fast), and I had not enough time to investigate the problems.

What I did: the quicktime-plugin uses a subclass from ImageStream. I set up the image with:

image->setImage(_textureWidth,
                _textureHeight,
                1,
                (GLint) GL_RGBA,
                (GLenum)GL_YCBCR_422_APPLE,
                computeInternalFormat(),
                (unsigned char*)buffer,
                osg::Image::NO_DELETE,
                2);


and computeInternalFormat looks like this:
GLenum MovieData::computeInternalFormat() {

        GLenum format;
#ifdef GL_YCBR_422_APPLE
        if (getYUVPlaybackUsed()) {
                #if defined(__APPLE__) && defined(__BIG_ENDIAN__)
                        format = (GLenum)GL_UNSIGNED_SHORT_8_8_REV_APPLE;
                #else
                        format = (GLenum)GL_UNSIGNED_SHORT_8_8_APPLE;
                #endif
        }
        else
#endif
        {
                #if defined(__APPLE__) && defined(__BIG_ENDIAN__)
                        format = (GLenum)GL_UNSIGNED_INT_8_8_8_8_REV;
                #else
                        format = (GLenum)GL_UNSIGNED_INT_8_8_8_8;
                #endif
        }
        
        return format;
}


As far as adding support for these formats, AFAICT some additions would be needed in osg::Image and osg::Texture2D and osg::TextureRectangle.

For me there was no need to modify the core-osg. Set up the image with the right parameters and it should work out of the box.

Which is the preferred base for making a proposal in the form of a patch? Latest release, or a specific cvs branch / revision?

see <http://www.openscenegraph.org/osgwiki/pmwiki.php/Support/SubmissionsProtocol>


HTH,
Stephan
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to