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

void main(void)
{
    vec2 cbcr = texture2D(uv_texture, texc).ra - vec2(0.5, 0.5);
    vec3 ycbcr = vec3(texture2D(texture, texc).r, cbcr);
    vec3 rgb = mat3(1, 1, 1,
        0, -0.344, 1.772,
        1.402, -0.714, 0) * ycbcr;
    gl_FragColor = vec4(rgb, 1.0);
}
