pantson.Theora v2.1
BlitzMax Forums/BlitzMax Programming/pantson.Theora v2.1
| ||
Hi I've released v2.1 of the Theora movie library. In this version I've fixed the ghosting of images when the movie loops. (sorry about the delay getting this out) Download link in signature. |
| ||
Cool, is it cross-platform? (I don't currently have a use for it - yet, so I didn't take a peek) |
| ||
it is cross platform..but you will just have to compile the mod on linux or mac. I have only included the windows compiled libs. PS it doesn't do sound, but there is an example in the archive on how to sync sound and picture. |
| ||
So it is much better. But, only 13fps while playing video 1024*512 (on 2*3.0 GHz processor!). While it is not enough of it for games. MS MediaPlayer plays this video on full speed. |
| ||
unfortuantely it has to convert all YUV info to RGB (so that Blitzmax can display it) Thats what takes so long... Now if BlitzMax/OpenGL had YUV pixmaps instead... |
| ||
Now if BlitzMax/OpenGL had YUV pixmaps instead... Wouldn't it be possible to make a version that does? |
| ||
not sure Brucey... i'm not an opengl expert ;-) This guy was taking about it.. but its all greek to me http://propirate.net/oracle/archives/2006/03/05/yuv-on-gl/ PS I'm not greek ;-) |
| ||
This thread strats to talk about a fragment shader, but I would not know where to start. http://www.fourcc.org/fccyvrgb.php I have used the page for the equatiuon to convert YUV to RGB. To make it fastest I've used lookup tables, rather than calculating every pixel. Obviously fragment shaders are the way forward, but I wouldn't know where to start |
| ||
And of course your card would need to support it too. But I see what you mean... :-) |
| ||
2PantsOn: >To make it fastest I've used lookup tables, rather than calculating every pixel. And you tested speed with direct calculation and under the table? There is an opinion that access to memory borrows more time than calculation. Can you make a choice between table-based calculation and direct-calculation? P.S. If colors=false, speed up to 25-27fps (native video fps=30) |
| ||
I have tested the speeds of both and the lookup tables do work faster. Greyscale is a bit fatser as it has to lookup and calculate less then color mode. Heres the color tmp = (Y[ypoint]<<8) + U[upoint]; r = yuv_r[tmp]; tmp = (Y[ypoint]<<16) + (U[upoint]<<8) + V[vpoint]; g = yuv_g[tmp]; tmp = (Y[ypoint]<<8) + V[vpoint]; b = yuv_b[tmp]; Heres the greyscale g = yuv_bw[Y[ypoint]]; The other slow down is uploading the new pixmap to the image/gfx card every time it needs to be drawn. I have optimised this as far as possible within 'standard' BlitzMax without using any OpenGL fixes that there may be. |
| ||
Thanks for this, pantson -- I had posted about the ghosting w/ v2.0, but this new version is working really well |
| ||
sorry for the delay robw, glad it works for you. |
| ||
Does anyone have sample code that imports the library and plays a vid? It would be much appreciated. Thanksl. |
| ||
You can find example code in the 'project' folder from the download. Here is one: Strict ' import theora v2.0 Import pantson.theora Local m:Ttheora = OpenTheora("dice.ogg") ' autoloop m.autoloop = True 'set up gfx Graphics 800,600,0 ' create pixmap size of theora movie Local p:TPixmap = CreatePixmap(TheoraWidth(m),TheoraHeight(m),PF_STDFORMAT) ' FPS vars Local ticks:Int = 0 Local start:Int = MilliSecs() Local fps:Int = 0 ' initiate movie StartTheora(m) ' loop While Not KeyDown(key_escape) ' basic fps equation fps = (ticks*1000)/Max(1,(MilliSecs()-start)) ' process all theoras and check for update If ProcessTheora() ' if an update occoured, draw movie. DrawTheoraPixmap(m,p) ' draw pixap DrawPixmap p,0,0 ' display FPS DrawText fps,20,20 ticks:+1 Flip EndIf Wend |