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