go back to the "old fashioned way" of doing yuv->rgb without matrix.

the matrix seems to screw up on too many gl drivers/implementations.



SVN revision: 69579
This commit is contained in:
Carsten Haitzler 2012-03-23 06:49:42 +00:00
parent 17135e16fb
commit ef3db76d55
4 changed files with 44 additions and 28 deletions

View File

@ -10,11 +10,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)) * 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"

View 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;
}

View 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"

View 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);
}