[MPlayer-dev-eng] Fast OpenGL playback

Stephen Webb swebb at netlab.uky.edu
Mon Nov 8 02:01:34 CET 2004


Hello to everyone.  I have written some code that may be useful / of
interest to the dev team.  I figured I would post on the list to see if
anyone wants it.  

What I wanted was to be able to use MPEG-2 decoded frames as textures in
OpenGL (just like everyone else, it seems).  Since I needed all the speed
I could get, I hacked the vo_gl.c file to better take advantage of my
hardware, and was able to (appx.) double the performance compared to the
"normal" vo_gl.c stuff.

I'm new to Mplayer, so maybe this has been done ten times already, or
maybe it's seen as too hardware-specific to be included.  My apologies if
I'm repeating old information. (I did scan the archives and didn't find a
whole lot of discussion on this topic)

Anyway, the two main things I did were to get rid of the software YUV to
RGB conversion, and to use nVidia's PDR support for fast texSubImage2D
calls.  The YUV conversion was done using Cg, so it needs extra libraries
and headers, and the PDR uses extensions that aren't in the standard OGL
headers.  (I use the GLEW extension management stuff)

The bottom line:
1024x768 @ 1375 KBytes/sec MPEG-2 on a P4 2.4 GHz w/ GFFX5950:

300 frames, with the -benchmark option

-vo X11:     5.4 sec
-vo gl2:     6.85 sec
-vo gl :    ~7 sec
-vo dga:     4.7 sec
-vo vesa:   ~3.7 sec
-vo gl_hack: 3.7 sec 

Getting rid of the YUV to RGB conversion is obviously a big help (it
happens on the card in parallel...), but the AGP accelerated texSubImage
shouldn't be overlooked either. It saved about 1.4 seconds (~800 MB/sec
transfer vs. ~120 MB/sec).

For comparison, on a FX5200 it is actually slower to do the conversion on
the card (but I haven't necessarily optimized the fragment program).

Anyway, if anyone is interested in the code let me know.

Thanks 

-Steve





More information about the MPlayer-dev-eng mailing list