2 // uniform sampler2D PREFIX(tex_y);
3 // uniform sampler2D PREFIX(tex_cbcr);
5 vec4 FUNCNAME(vec2 tc) {
6 // OpenGL's origin is bottom-left, but most graphics software assumes
7 // a top-left origin. Thus, for inputs that come from the user,
8 // we flip the y coordinate.
12 ycbcr.x = tex2D(PREFIX(tex_y), tc).y;
13 #if CB_CR_OFFSETS_EQUAL
15 tc_cbcr.x += PREFIX(cb_offset_x);
16 ycbcr.yz = tex2D(PREFIX(tex_cbcr), tc_cbcr).xz;
19 tc_cb.x += PREFIX(cb_offset_x);
20 ycbcr.y = tex2D(PREFIX(tex_cbcr), tc_cb).x;
23 tc_cr.x += PREFIX(cr_offset_x);
24 ycbcr.z = tex2D(PREFIX(tex_cbcr), tc_cr).z;
27 ycbcr -= PREFIX(offset);
30 rgba.rgb = PREFIX(inv_ycbcr_matrix) * ycbcr;