uniform sampler2D textureHandle;
uniform float lineShade;
const mat4 yuv2rgbMatrix = mat4( 1.21433, 0.00000, 0.38046, -1.95146,
1.21433, -0.09339, -0.19380, 0.59560,
1.21433, 0.48087, 0.00000, -2.33451,
0.00000, 0.00000, 0.00000, 0.00000);
void main()
{
float txc = gl_TexCoord[0][0];
float tyc = gl_TexCoord[0][1] + 0.015625;
vec4 pm5 = texture2D(textureHandle, vec2(txc - 0.00488, tyc));
vec4 pm4 = texture2D(textureHandle, vec2(txc - 0.00391, tyc));
vec4 pm3 = texture2D(textureHandle, vec2(txc - 0.00293, tyc));
vec4 pm2 = texture2D(textureHandle, vec2(txc - 0.00195, tyc));
vec4 pm1 = texture2D(textureHandle, vec2(txc - 0.00098, tyc));
vec4 p0 = texture2D(textureHandle, vec2(txc, tyc));
vec4 pp1 = texture2D(textureHandle, vec2(txc + 0.00098, tyc));
vec4 pp2 = texture2D(textureHandle, vec2(txc + 0.00195, tyc));
vec4 pp3 = texture2D(textureHandle, vec2(txc + 0.00293, tyc));
vec4 pp4 = texture2D(textureHandle, vec2(txc + 0.00391, tyc));
float ytmp = (pp3.g * 0.0196) + (pp2.g * -0.2353) + (pp1.g * 0.3529)
+ p0.g + (pm1.g * 0.3333) + (pm2.g * 0.1373)
+ (pm3.g * 0.0392);
vec2 ctmp = (pp4.br * 0.45) + (pp3.br * 0.68) + (pp2.br * 0.84)
+ (pp1.br * 0.92) + p0.br + (pm1.br * 1.04)
+ (pm2.br * 0.96) + (pm3.br * 0.80) + (pm4.br * 0.57)
+ (pm5.br * 0.37);
float f
= mix
(cos(tyc
* 100.531) * -0.5 + 0.5, 1.0, lineShade
); gl_FragColor = (vec4(ytmp, ctmp[0], ctmp[1], 1.0) * yuv2rgbMatrix) * f;
}