[MPlayer-dev-eng] [PATCH] vo_gl opt. and support for np2 textures

Ralovich Kristof tade at sch.bme.hu
Fri Nov 11 23:07:37 CET 2005


Hi mplayer developers,

I have created a patch for the libvo/vo_gl.c source file!
The patch adds the following:
-Checks for GL_ARB_texture_non_power_of_two extension during
 initialization, if available and enabled(see below), sets
 the texture size to the size of the movie( d_width, d_height
 in initGL() ).
-If no np2 support was found, or is disabled, it enables a non
 (always)square, but still power of two dimensioned texture.
-Disabling the np2 extension usage can be made by passing the
 'notexnp2' command line option. (example: /$mplayer -vo
 gl:notexnp2 somefile.avi'). By default it is enabled.

In general the advantages of the optimization:
-For example, there is given a movie with dimensions of 640x304.
 The unpatched code would create a 1024x1024 texture (the smallest
 power of two sized square bigger than 640x304). My code creates
 a texture of size 1024x512 (the smallest power of two sized
 rectangle bigger then 640x304). Uploading the 1024x1024 sized
 texture requires about twice the bandwidth of uploading the
 1024x512 texture.

In general the advantages of np2 texturing is:
-Reducing the AGP bandwidth required to upload the texture to
 the gfx card.
-See, in the previous example, a 640x304 sized texture would be
 created. Uploading this requires only about 20% of the bandwidth
 of the 1024x1024 tex.

The patch has been successfully tested on nv card with OpenGL 2.0
(nv closed source drv) and on a laptop with i915gm using
OpenGL 1.5 (mesa).

I created the patch with this in MPlayer/libvo:
$ diff -au vo_gl.c.original vo_gl.c > vo_gl.c.diff

Can be applied with this in Mplayer/libvo:
$ patch -p1 <vo_gl.c.diff
  |
  +- at the 'File to patch:' prompt write vo_gl.c

In case something is not working, I shared the patch and the
patched file at:
http://www.sch.bme.hu/~tade/vo_gl/vo_gl.c - patched file 15480 bytes
http://www.sch.bme.hu/~tade/vo_gl/vo_gl.c.diff - patch file 3462 bytes
http://www.sch.bme.hu/~tade/vo_gl/vo_gl.c.original- original,
unpatched file 14740 bytes

I hope I will get some (hopefully positive) feedback from you guys, and
the patch is going to be useable.

I am looking forward to hearing from you:

Kristof Ralovich
tade at sch dot bme dot hu


PS.:
1) In the whole email 'texture' was used for the texture
vo_gl uses to display the movie.

2) If you use the gl vo, you probably want to pass 'slice-height=0'
too. GL wise it provides some speedup, theoretically.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: vo_gl.c.diff
Type: application/octet-stream
Size: 3461 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20051111/86387a93/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vo_gl.c.diff.bz2
Type: application/octet-stream
Size: 1571 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20051111/86387a93/attachment-0001.obj>


More information about the MPlayer-dev-eng mailing list