[theora-dev] Re: YUV to RGB

wesley kiriinya kiriinya2000 at yahoo.com
Tue Jan 15 05:28:43 PST 2008


Thanks a lot for the replies.

Using the GPU is not currently an option. I'm also targeting PCs that don't have GPUs.
I'm thinking of creating a utility that will read an OGG file, get the theora stream, convert the YUV to RGB and save the RGB instead of YUV to the OGG file. In this case the YUV read out will be RGB. Due to the real time nature of the application I'm developing simply reading the RGB will be better.
In my mind this sounds simple enough. I'm surprised that no such utility exists or I'm I wrong?
Also does SDL convert YUV to RGB or is YUV data used directly as one normally uses RGB?

Regards.

Shane Stephens <shane.stephens at gmail.com> wrote: Hi,

Be aware that the SSE implementation in oggplay is not perfect - in particular it does not correctly do linear interpolation of 4 pixel values for chrominance (instead it uses 2 values per pixel).  Actually, strictly speaking I think it's MMX from memory (using fixed-point integer arithmetic instead of floating-point arithmetic). 

Fragment shaders vs. vector-based CPU instructions is an interesting trade off - on the one hand fragment shaders free up CPU cycles; on the other the vector-based routine is a fraction of the cost of Theora decoding (I measure about 11%) and I bet more existing Intel-based machines support MMX than fragment shading. 

Cheers,
    -Shane

On Jan 15, 2008 6:48 PM, Ralph Giles <giles at xiph.org> wrote:
 On Mon, Jan 14, 2008 at 10:59:39PM -0800, wesley kiriinya wrote:

>  I'm trying to write an OpenGL application that plays theora frames. SDL is not an option. Is there a function/routine that can do this for me efficiently or do I have to write my own with a bit of SSE so that the YUV to RGB conversion is fast enough. Also wouldn't it be OK if a Theora stream could be encoded in RGB instead of YUV or is there already something like this? I'm writing a decoder not an encoder. 


If you're doing OpenGL, the best thing is to write a fragment shader to
do the conversion. In most applications the GPU can more easily spare
the cycles.

For one implementation on the host side, see: 

  http://svn.annodex.net/liboggplay/trunk/src/liboggplay/oggplay_yuv2rgb.c

There are many others, of various speed and quality. 

I'd eventually like to add to-from RGB routines to the reference
implementation, but that's post-1.0.

HTH,
 -r
_______________________________________________
theora-dev mailing list
 theora-dev at xiph.org
http://lists.xiph.org/mailman/listinfo/theora-dev


 

       
---------------------------------
Never miss a thing.   Make Yahoo your homepage.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/theora-dev/attachments/20080115/496536e4/attachment.htm


More information about the theora-dev mailing list