Skip to content

Instantly share code, notes, and snippets.

@sortofsleepy
Created August 7, 2017 18:13
Show Gist options
  • Save sortofsleepy/d9ea294cd674c256bae9c3e1061d70ac to your computer and use it in GitHub Desktop.
Save sortofsleepy/d9ea294cd674c256bae9c3e1061d70ac to your computer and use it in GitHub Desktop.
// yMap is the Y texture, uvMap is the CrCb texture
vec4 capturedImageTextureY = texture2D(yMap, uv);
vec4 capturedImageTextureCbCr = texture2D(uvMap, uv);
mat4 transform = mat4(
1.0000, 1.0000, 1.0000, 0.0000,
0.0000, -0.3441, 1.7720, 0.0000,
1.4020, -0.7141, 0.0000, 0.0000,
-0.7010, 0.5291, -0.8860, 1.0000
);
vec4 ycbr = vec4(capturedImageTextureY.r,capturedImageTextureCbCr.rg,1.);
gl_FragColor = transform * ycbr;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment