Created
November 19, 2017 21:05
-
-
Save dlublin/90f879cfe027ebf5792bdadf2c911bb5 to your computer and use it in GitHub Desktop.
GLSL shader that performs YCoCg conversion and can be used for drawing Hap Q frames.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uniform sampler2D cocgsy_src; | |
const vec4 offsets = vec4(-0.50196078431373, -0.50196078431373, 0.0, 0.0); | |
void main() | |
{ | |
vec4 CoCgSY = texture2D(cocgsy_src, gl_TexCoord[0].xy); | |
CoCgSY += offsets; | |
float scale = ( CoCgSY.z * ( 255.0 / 8.0 ) ) + 1.0; | |
float Co = CoCgSY.x / scale; | |
float Cg = CoCgSY.y / scale; | |
float Y = CoCgSY.w; | |
vec4 rgba = vec4(Y + Co - Cg, Y + Cg, Y - Co - Cg, 1.0); | |
gl_FragColor = rgba; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment