[MPlayer-cvslog] CVS: main/libvo vo_gl.c, 1.100, 1.101 vo_gl2.c, 1.78, 1.79 gl_common.c, 1.24, 1.25 gl_common.h, 1.16, 1.17

Reimar Döffinger CVS syncmail at mplayerhq.hu
Sun Sep 25 18:07:57 CEST 2005


CVS change done by Reimar Döffinger CVS

Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv15057

Modified Files:
	vo_gl.c vo_gl2.c gl_common.c gl_common.h 
Log Message:
Support rectangular texture in fragment programs


Index: vo_gl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl.c,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -r1.100 -r1.101
--- vo_gl.c	25 Sep 2005 14:02:02 -0000	1.100
+++ vo_gl.c	25 Sep 2005 16:07:54 -0000	1.101
@@ -151,7 +151,8 @@
   float rgamma = exp(log(8.0) * eq_rgamma / 100.0);
   float ggamma = exp(log(8.0) * eq_ggamma / 100.0);
   float bgamma = exp(log(8.0) * eq_bgamma / 100.0);
-  glSetupYUVConversion(use_yuv, bri, cont, hue, sat, rgamma, ggamma, bgamma);
+  glSetupYUVConversion(gl_target, use_yuv, bri, cont, hue, sat,
+                       rgamma, ggamma, bgamma);
   if (custom_prog) {
     FILE *f = fopen(custom_prog, "r");
     if (!f)

Index: vo_gl2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl2.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- vo_gl2.c	25 Sep 2005 13:58:18 -0000	1.78
+++ vo_gl2.c	25 Sep 2005 16:07:54 -0000	1.79
@@ -763,7 +763,7 @@
         BindProgram(GL_FRAGMENT_PROGRAM, fragprog);
         break;
     }
-    glSetupYUVConversion(use_yuv, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0);
+    glSetupYUVConversion(GL_TEXTURE_2D, use_yuv, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0);
   }
 
   gl_set_antialias(0);

Index: gl_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/gl_common.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- gl_common.c	25 Sep 2005 13:56:42 -0000	1.24
+++ gl_common.c	25 Sep 2005 16:07:54 -0000	1.25
@@ -468,23 +468,25 @@
 
 static const char *yuv_prog_template =
   "!!ARBfp1.0\n"
+  "OPTION ARB_precision_hint_fastest;"
   "TEMP res, y, u, v;"
-  "TEX y, fragment.texcoord[0], texture[0], 2D;"
+  "TEX y, fragment.texcoord[0], texture[0], %s;"
   "MAD res, y, {%.4f, %.4f, %.4f}, {%.4f, %.4f, %.4f};"
-  "TEX u, fragment.texcoord[1], texture[1], 2D;"
+  "TEX u, fragment.texcoord[1], texture[1], %s;"
   "MAD res, u, {%.4f, %.4f, %.4f}, res;"
-  "TEX v, fragment.texcoord[2], texture[2], 2D;"
+  "TEX v, fragment.texcoord[2], texture[2], %s;"
   "MAD result.color, v, {%.4f, %.4f, %.4f}, res;"
   "END";
 
 static const char *yuv_pow_prog_template =
   "!!ARBfp1.0\n"
+  "OPTION ARB_precision_hint_fastest;"
   "TEMP res, y, u, v;"
-  "TEX y, fragment.texcoord[0], texture[0], 2D;"
+  "TEX y, fragment.texcoord[0], texture[0], %s;"
   "MAD res, y, {%.4f, %.4f, %.4f}, {%.4f, %.4f, %.4f};"
-  "TEX u, fragment.texcoord[1], texture[1], 2D;"
+  "TEX u, fragment.texcoord[1], texture[1], %s;"
   "MAD res, u, {%.4f, %.4f, %.4f}, res;"
-  "TEX v, fragment.texcoord[2], texture[2], 2D;"
+  "TEX v, fragment.texcoord[2], texture[2], %s;"
   "MAD_SAT res, v, {%.4f, %.4f, %.4f}, res;"
   "POW result.color.r, res.r, %.4f.r;"
   "POW result.color.g, res.g, %.4f.g;"
@@ -493,14 +495,14 @@
 
 static const char *yuv_lookup_prog_template =
   "!!ARBfp1.0\n"
+  "OPTION ARB_precision_hint_fastest;"
   "TEMP res, y, u, v;"
-  "TEX y, fragment.texcoord[0], texture[0], 2D;"
-  "MAD res, y, {%.4f, %.4f, %.4f, 0}, {%.4f, %.4f, %.4f, 0};"
-  "TEX u, fragment.texcoord[1], texture[1], 2D;"
+  "TEX y, fragment.texcoord[0], texture[0], %s;"
+  "MAD res, y, {%.4f, %.4f, %.4f, 0}, {%.4f, %.4f, %.4f, 0.125};"
+  "TEX u, fragment.texcoord[1], texture[1], %s;"
   "MAD res, u, {%.4f, %.4f, %.4f, 0}, res;"
-  "TEX v, fragment.texcoord[2], texture[2], 2D;"
+  "TEX v, fragment.texcoord[2], texture[2], %s;"
   "MAD res, v, {%.4f, %.4f, %.4f, 0}, res;"
-  "ADD res.a, res.a, 0.125;"
   "TEX result.color.r, res.raaa, texture[3], 2D;"
   "ADD res.a, res.a, 0.25;"
   "TEX result.color.g, res.gaaa, texture[3], 2D;"
@@ -519,9 +521,10 @@
  */
 static void glSetupYUVFragprog(float brightness, float contrast,
                         float uvcos, float uvsin, float rgamma,
-                        float ggamma, float bgamma, int type) {
+                        float ggamma, float bgamma, int type, int rect) {
   char yuv_prog[1000];
   const char *prog_template = yuv_prog_template;
+  char *tex_type = rect ? "RECT" : "2D";
   int lookup = 0;
   GLint i;
   // this is the conversion matrix, with y, u, v factors
@@ -564,8 +567,8 @@
   rgamma = 1.0 / rgamma;
   ggamma = 1.0 / ggamma;
   bgamma = 1.0 / bgamma;
-  snprintf(yuv_prog, 1000, prog_template, ry, gy, by, rc, gc, bc, ru, gu, bu,
-           rv, gv, bv, rgamma, bgamma, bgamma);
+  snprintf(yuv_prog, 1000, prog_template, tex_type, ry, gy, by, rc, gc, bc,
+         tex_type, ru, gu, bu, tex_type, rv, gv, bv, rgamma, bgamma, bgamma);
   ProgramString(GL_FRAGMENT_PROGRAM, GL_PROGRAM_FORMAT_ASCII,
                 strlen(yuv_prog), yuv_prog);
   glGetIntegerv(GL_PROGRAM_ERROR_POSITION, &i);
@@ -598,6 +601,7 @@
 
 /**
  * \brief setup YUV->RGB conversion
+ * \param target texture target for Y, U and V textures (e.g. GL_TEXTURE_2D)
  * \param brightness brightness adjustment offset
  * \param contrast contrast adjustment factor
  * \param hue hue adjustment angle
@@ -607,7 +611,8 @@
  * \param bgamma gamma value for blue channel
  * \param type YUV conversion type
  */
-void glSetupYUVConversion(int type, float brightness, float contrast,
+void glSetupYUVConversion(GLenum target, int type,
+                          float brightness, float contrast,
                           float hue, float saturation,
                           float rgamma, float ggamma, float bgamma) {
   float uvcos = saturation * cos(hue);
@@ -632,7 +637,8 @@
     case YUV_CONVERSION_FRAGMENT:
     case YUV_CONVERSION_FRAGMENT_POW:
       glSetupYUVFragprog(brightness, contrast, uvcos, uvsin,
-                         rgamma, ggamma, bgamma, type);
+                         rgamma, ggamma, bgamma, type,
+                         target == GL_TEXTURE_RECTANGLE);
       break;
   }
 }

Index: gl_common.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/gl_common.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- gl_common.h	14 Sep 2005 22:08:04 -0000	1.16
+++ gl_common.h	25 Sep 2005 16:07:54 -0000	1.17
@@ -158,7 +158,8 @@
 #define YUV_CONVERSION_FRAGMENT_POW 3
 //! use a fragment program with additional table lookup for YUV conversion
 #define YUV_CONVERSION_FRAGMENT_LOOKUP 4
-void glSetupYUVConversion(int type, float brightness, float contrast,
+void glSetupYUVConversion(GLenum target, int type,
+                          float brightness, float contrast,
                           float hue, float saturation,
                           float rgamma, float ggamma, float bgamma);
 void inline glEnableYUVConversion(GLenum target, int type);




More information about the MPlayer-cvslog mailing list