go back to the "old fashioned way" of doing yuv->rgb without matrix.
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 23 Mar 2012 06:49:42 +0000 (06:49 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 23 Mar 2012 06:49:42 +0000 (06:49 +0000)
the matrix seems to screw up on too many gl drivers/implementations.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@69579 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/modules/engines/gl_common/shader/yuv_frag.h
src/modules/engines/gl_common/shader/yuv_frag.shd
src/modules/engines/gl_common/shader/yuv_nomul_frag.h
src/modules/engines/gl_common/shader/yuv_nomul_frag.shd

index de9acf8..87f4095 100644 (file)
 "varying vec2 tex_c, tex_c2, tex_c3;\n"
 "void main()\n"
 "{\n"
-"   const mat4 yuv2rgb = mat4( 1.16400,  1.16400,  1.16400, 0.00000,\n"
-"                              0.00000, -0.34410,  1.77200, 0.00000,\n"
-"                              1.40200, -0.71410,  0.00000, 0.00000,\n"
-"                             -0.77380,  0.45630, -0.95880, 1.00000);\n"
-"   gl_FragColor = (yuv2rgb * vec4(texture2D(tex, tex_c.xy).r,\n"
-"                                  texture2D(texu, tex_c2.xy).r,\n"
-"                                  texture2D(texv, tex_c3.xy).r, 1.0)) * col;\n"
+"   float r, g, b, y, u, v;\n"
+"   y = texture2D(tex, tex_c.xy).r;\n"
+"   u = texture2D(texu, tex_c2.xy).r;\n"
+"   v = texture2D(texv, tex_c3.xy).r;\n"
+"   y = (y - 0.0625) * 1.164;\n"
+"   u = u - 0.5;\n"
+"   v = v - 0.5;\n"
+"   r = y + (1.402   * v);\n"
+"   g = y - (0.34414 * u) - (0.71414 * v);\n"
+"   b = y + (1.772   * u);\n"
+"   gl_FragColor = vec4(r, g, b, 1.0) * col;\n"
 "}\n"
index 8e55d14..367fb55 100644 (file)
@@ -10,11 +10,15 @@ varying vec4 col;
 varying vec2 tex_c, tex_c2, tex_c3;
 void main()
 {
-   const mat4 yuv2rgb = mat4( 1.16400,  1.16400,  1.16400, 0.00000,
-                              0.00000, -0.34410,  1.77200, 0.00000,
-                              1.40200, -0.71410,  0.00000, 0.00000,
-                             -0.77380,  0.45630, -0.95880, 1.00000);
-   gl_FragColor = (yuv2rgb * vec4(texture2D(tex, tex_c.xy).r,
-                                  texture2D(texu, tex_c2.xy).r,
-                                  texture2D(texv, tex_c3.xy).r, 1.0)) * col;
+   float r, g, b, y, u, v;
+   y = texture2D(tex, tex_c.xy).r;
+   u = texture2D(texu, tex_c2.xy).r;
+   v = texture2D(texv, tex_c3.xy).r;
+   y = (y - 0.0625) * 1.164;
+   u = u - 0.5;
+   v = v - 0.5;
+   r = y + (1.402   * v);
+   g = y - (0.34414 * u) - (0.71414 * v);
+   b = y + (1.772   * u);
+   gl_FragColor = vec4(r, g, b, 1.0) * col;
 }
index ee5855c..0df4b97 100644 (file)
@@ -9,11 +9,15 @@
 "varying vec2 tex_c, tex_c2, tex_c3;\n"
 "void main()\n"
 "{\n"
-"   const mat4 yuv2rgb = mat4( 1.16400,  1.16400,  1.16400, 0.00000,\n"
-"                              0.00000, -0.34410,  1.77200, 0.00000,\n"
-"                              1.40200, -0.71410,  0.00000, 0.00000,\n"
-"                             -0.77380,  0.45630, -0.95880, 1.00000);\n"
-"   gl_FragColor = yuv2rgb * vec4(texture2D(tex, tex_c.xy).r,\n"
-"                                 texture2D(texu, tex_c2.xy).r,\n"
-"                                 texture2D(texv, tex_c3.xy).r, 1.0);\n"
+"   float r, g, b, y, u, v;\n"
+"   y = texture2D(tex, tex_c.xy).r;\n"
+"   u = texture2D(texu, tex_c2.xy).r;\n"
+"   v = texture2D(texv, tex_c3.xy).r;\n"
+"   y = (y - 0.0625) * 1.164;\n"
+"   u = u - 0.5;\n"
+"   v = v - 0.5;\n"
+"   r = y + (1.402   * v);\n"
+"   g = y - (0.34414 * u) - (0.71414 * v);\n"
+"   b = y + (1.772   * u);\n"
+"   gl_FragColor = vec4(r, g, b, 1.0);\n"
 "}\n"
index 3ec4311..ce24622 100644 (file)
@@ -9,11 +9,15 @@ uniform sampler2D tex, texu, texv;
 varying vec2 tex_c, tex_c2, tex_c3;
 void main()
 {
-   const mat4 yuv2rgb = mat4( 1.16400,  1.16400,  1.16400, 0.00000,
-                              0.00000, -0.34410,  1.77200, 0.00000,
-                              1.40200, -0.71410,  0.00000, 0.00000,
-                             -0.77380,  0.45630, -0.95880, 1.00000);
-   gl_FragColor = yuv2rgb * vec4(texture2D(tex, tex_c.xy).r,
-                                 texture2D(texu, tex_c2.xy).r,
-                                 texture2D(texv, tex_c3.xy).r, 1.0);
+   float r, g, b, y, u, v;
+   y = texture2D(tex, tex_c.xy).r;
+   u = texture2D(texu, tex_c2.xy).r;
+   v = texture2D(texv, tex_c3.xy).r;
+   y = (y - 0.0625) * 1.164;
+   u = u - 0.5;
+   v = v - 0.5;
+   r = y + (1.402   * v);
+   g = y - (0.34414 * u) - (0.71414 * v);
+   b = y + (1.772   * u);
+   gl_FragColor = vec4(r, g, b, 1.0);
 }