23 lines
584 B
GLSL
23 lines
584 B
GLSL
#version 150
|
|
|
|
in vec2 v_texCoord;
|
|
out vec4 fragColor;
|
|
|
|
uniform sampler2D u_texY;
|
|
uniform sampler2D u_texUV;
|
|
|
|
void main() {
|
|
float y = texture(u_texY, v_texCoord).r;
|
|
vec2 uvVal = texture(u_texUV, v_texCoord).rg;
|
|
|
|
// El formato NV12 almacena U y V entrelazados. Restamos 0.5 para centrar la crominancia.
|
|
float u = uvVal.r - 0.5;
|
|
float v = uvVal.g - 0.5;
|
|
|
|
// Matriz estándar de conversión YUV (NV12) a RGB
|
|
float r = y + 1.402 * v;
|
|
float g = y - 0.344136 * u - 0.714136 * v;
|
|
float b = y + 1.772 * u;
|
|
|
|
fragColor = vec4(r, g, b, 1.0);
|
|
}
|