[theora-dev] Theora on iPhone

Mihai Balea mihai at hates.ms
Tue Oct 7 19:39:08 PDT 2008


On Oct 7, 2008, at 1:56 PM, Steven Woolley wrote:
> The SDL port to iphone uses an opengl-es driver and opengl drivers  
> for SDL don't support YUV overlay's!  So the problem (at least for  
> now) is how I can get the YUV encoded frames from a theora movie  
> rendered on the iPhone?
>
> The options I've considered are:
> a) convert from YUV to RGB in code (this probably won't work for  
> realtime decoding)
> b) convert from YUV to RGB using pixel shading (If it sounds like I  
> don't know what I'm talking about, that's correct... I've simply  
> seen smarter people talk about doing the conversion on the GPU using  
> pixel shading???)
> c) convert the frames to still images in a format that the iphone  
> can display natively (doesn't jpeg use the same YUV encoding that  
> theora does?) and render them as a series of images (I have no clue  
> if this is feasible or not, or if the conversion/decoding would be  
> worse than just doing a or b above)
> d) something else?
> e) give up!
>
> So any feedback would be great!

Conversion from YUV to RGB is probably an order of magnitude less  
intensive than Theora decoding, so if you got that working in realtime  
and you have a bit CPU juice left you can easily do it.  The order of  
preference should be:
- Pixel shaders.  If you can offload to GPU, then by all means do it.   
I'm not familiar with the PowerVR MBX chip that's in the iphone to  
know whether it has the chops, but I doubt it.
- SIMD version of the standard YUV to RGB conversion algorithm.  The  
iphone's version of ARM core has SIMD instructions, but most of the  
code you'll find online is written for x86 MMX so you'll need to adapt  
it.
- Plain, old-school, optimized C code.  For an example that uses pre- 
calculated tables and only basic operations (add, or and bit shifts),  
take a look here: http://iaxclient.svn.sourceforge.net/viewvc/iaxclient/branches/2.0/lib/video.c?revision=1199&view=markup 
.  Look for the iaxc_YUV420_to_RGB32() function.

You might actually want to profile the last two, I'm not sure that the  
SIMD version would be so much faster...

Hope this helps,

Mihai





More information about the theora-dev mailing list