[MPlayer-users] Bicubic scaling in vo_gl - does it ever work?

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Mon Jun 19 11:11:28 CEST 2006


Hello,
On Mon, Jun 19, 2006 at 05:11:31AM +0400, Vladimir Mosgalin wrote:
> Tried it. No problems under windows, bicubic scaling without any
> problems. Choosen coefficients give very soft picture though, definitely
> softer than default mplayer's bicubic sws, almost as blurry as "bicubic
> spline" mode in sws ;)

Well, the algorithm actually is bicubic spline IIRC... I have to admit I
don't know the differences between those methods, like "natural bicubic
spline", no idea what that "natural" means...
You can easily change the coefficients in gl_common.c, store_weights
function, w0 - w3 are the coefficients.
None of the values may become negative though (and the sum must be 1).

> Btw, according to manpage lscale/cscale should work with yuv=4, but they
> just give a very broken picture withc hardly resembles original image..

You need five texture units for that to work, probably you get a warning
that you do not have enough somewhere...

Please try the attached patch, I read that some cards/implementations
have trouble with GL_REPEAT textures.
I don't like it much since it slows down the shader a bit, but it's not
much.

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libvo/gl_common.c
===================================================================
--- libvo/gl_common.c	(revision 18746)
+++ libvo/gl_common.c	(working copy)
@@ -642,7 +642,7 @@
   glTexParameterf(GL_TEXTURE_1D, GL_TEXTURE_PRIORITY, 1.0);
   glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
   glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-  glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+  glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP);
   ActiveTexture(GL_TEXTURE0);
 }
 
@@ -665,6 +665,7 @@
 
 static const char *bicub_filt_template_2D =
   "MAD coord.xy, fragment.texcoord[%c], {%f, %f}, {0.5, 0.5};"
+  "FRC coord.xy, coord;"
   "TEX parmx, coord.x, texture[%c], 1D;"
   "MUL cdelta.xz, parmx.rrgg, {-%f, 0, %f, 0};"
   "TEX parmy, coord.y, texture[%c], 1D;"
@@ -673,6 +674,7 @@
 
 static const char *bicub_filt_template_RECT =
   "ADD coord, fragment.texcoord[%c], {0.5, 0.5};"
+  "FRC coord.xy, coord;"
   "TEX parmx, coord.x, texture[%c], 1D;"
   "MUL cdelta.xz, parmx.rrgg, {-1, 0, 1, 0};"
   "TEX parmy, coord.y, texture[%c], 1D;"


More information about the MPlayer-users mailing list