refactor(default): glsl cleaning (1/2)
This commit is contained in:
+8
-24
@@ -4,41 +4,25 @@
|
||||
const int YUYV_FOURCC = 1448695129;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Y%E2%80%B2UV
|
||||
const mat3x3 yuyv_to_rgb_bt709 = {
|
||||
{
|
||||
1,
|
||||
1,
|
||||
1
|
||||
},
|
||||
{
|
||||
0,
|
||||
-0.21482,
|
||||
2.12798
|
||||
},
|
||||
{
|
||||
1.28033,
|
||||
-0.38059,
|
||||
0
|
||||
}
|
||||
};
|
||||
const mat3x3 yuyv_to_rgb_bt709 = mat3x3(1., 1., 1., 0., -.21482, 2.12798, 1.28033, -.38059, 0.);
|
||||
|
||||
vec4 yuyvTex(sampler2D tex, vec2 vUV, int base_width) {
|
||||
float w = base_width - 1;
|
||||
float w = base_width - 1.;
|
||||
int x = int(vUV.x * w);
|
||||
|
||||
int xU = x - x % 2;
|
||||
int xV = x - x % 2 + 1;
|
||||
|
||||
vec4 tU = texture(tex, vec2(xU / w, 1 - vUV.y));
|
||||
vec4 tV = texture(tex, vec2(xV / w, 1 - vUV.y));
|
||||
vec4 tU = texture(tex, vec2(xU / w, 1. - vUV.y));
|
||||
vec4 tV = texture(tex, vec2(xV / w, 1. - vUV.y));
|
||||
|
||||
vec3 yuv = vec3(
|
||||
x % 2 == 0 ? tU.x : tV.x,
|
||||
tU.y - 0.5,
|
||||
tV.y - 0.5
|
||||
x % 2 == 0. ? tU.x : tV.x,
|
||||
tU.y - .5,
|
||||
tV.y - .5
|
||||
);
|
||||
|
||||
return vec4(yuyv_to_rgb_bt709 * yuv, 1.0);
|
||||
return vec4(yuyv_to_rgb_bt709 * yuv, 1.);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user