#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D texture;
uniform sampler2D u_texture;
uniform sampler2D v_texture;
varying vec2 texc;

void main(void)
{
    float cb = texture2D(u_texture, texc).r - 0.5;
    float cr = texture2D(v_texture, texc).r - 0.5;
    vec3 ycbcr = vec3(texture2D(texture, texc).r, cb, cr);
    vec3 rgb = mat3(1, 1, 1,
        0, -0.344, 1.772,
        1.402, -0.714, 0) * ycbcr;
    gl_FragColor = vec4(rgb, 1.0);
}
