Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #version 330
  2. uniform sampler2D texA;
  3.  
  4. in vec2 ftexcoord;
  5. layout(location = 0) out vec4 rgbColour;
  6. //layout(location = 0) out vec4 yuvColour;
  7.  
  8.  
  9. void main()
  10. {
  11.     float y;
  12.     float cb;
  13.     float cr;
  14.  
  15.     vec2 txc = gl_FragCoord.xy;
  16.     ivec2 texSize  = textureSize(texA, 0);
  17.     vec2 texOffset = 1 / vec2(texSize.xy);
  18.    
  19.     y = texture(texA, ftexcoord).r;
  20.  
  21.     if (mod(txc.x, 2) > 1)
  22.     {
  23.         cb = texture(texA, ftexcoord.xy + texOffset * vec2(1.0, 0.0)).g - 0.5;
  24.         cr = texture(texA, ftexcoord).g - 0.5;
  25.     }
  26.     else
  27.     {
  28.         cb = texture(texA, ftexcoord).g - 0.5;
  29.         cr = texture(texA, ftexcoord.xy + texOffset * vec2(-1.0, 0.0)).g - 0.5;
  30.     }
  31.  
  32.     rgbColour.r =  y + 1.5958* cr;
  33.     rgbColour.g = y - 0.39173 * cb - 0.81290 * cr;
  34.     rgbColour.b =  y + 2.017*cb;
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement