wip video device
This commit is contained in:
+14
-1
@@ -1923,4 +1923,17 @@ subroutine(mix_stage_sub) vec4 mix_16(vec2 vUV, sampler2D ta, sampler2D tb, int
|
||||
|
||||
// TODO temp
|
||||
|
||||
const mat4x4 yuv_to_rgb = {{1,0,1.13983,0},{1,-0.39465,-0.5806,0},{1,2.03211,0,0},{0,0,0,1}};
|
||||
const mat3x3 yuv_to_rgb = {{1,1,1},{0,-0.39465,2.03211},{1.13983,-0.5806,0}};
|
||||
|
||||
vec4 yuyvTex(sampler2D tex, vec2 vUV, int base_width) {
|
||||
float w = base_width - 1;
|
||||
int x = int(vUV.x * w);
|
||||
int xU = x - x % 2;
|
||||
int xV = x - x % 2 + 1;
|
||||
vec3 yuv = vec3(
|
||||
texture(tex, vec2(vUV.x, 1 - vUV.y)).x,
|
||||
texture(tex, vec2(xU / w, 1 - vUV.y)).y - 0.5,
|
||||
texture(tex, vec2(xV / w, 1 - vUV.y)).y - 0.5
|
||||
);
|
||||
return vec4(yuv_to_rgb * yuv, 1.0);
|
||||
}
|
||||
+1
-9
@@ -7,13 +7,5 @@ in vec2 vUV;
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
float r, g, b, y, u, v;
|
||||
vec4 src = texture(tex1, vec2(vUV.x, 1 - vUV.y));
|
||||
y = src.r;
|
||||
u = src.g - 0.5;
|
||||
v = src.a - 0.5;
|
||||
r = y + 1.13983 * v;
|
||||
g = y - 0.39465 * u - 0.58060 * v;
|
||||
b = y + 2.03211 * u;
|
||||
fragColor = vec4(r, g, b, 1.0);
|
||||
fragColor = yuyvTex(tex1, vUV, 320);
|
||||
}
|
||||
+1
-9
@@ -7,13 +7,5 @@ in vec2 vUV;
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
float r, g, b, y, u, v;
|
||||
vec4 src = texture(tex2, vec2(vUV.x, 1 - vUV.y));
|
||||
y = src.r;
|
||||
u = src.g - 0.5;
|
||||
v = src.a - 0.5;
|
||||
r = y + 1.13983 * v;
|
||||
g = y - 0.39465 * u - 0.58060 * v;
|
||||
b = y + 2.03211 * u;
|
||||
fragColor = vec4(r, g, b, 1.0);
|
||||
fragColor = yuyvTex(tex2, vUV, 320);
|
||||
}
|
||||
Reference in New Issue
Block a user