1
0
mirror of https://github.com/jojo61/vdr-plugin-softhdcuvid.git synced 2023-10-10 13:37:41 +02:00

correct conversion BT709 colors to sRGB

This commit is contained in:
jojo61 2020-03-06 11:51:20 +01:00
parent 3e649a5cea
commit 04e1b8732d

View File

@ -361,10 +361,14 @@ static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace)
GLSL("// color conversion \n");
GLSL("color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c; \n");
GLSL("color.a = 1.0; \n");
#ifdef GAMMA
GLSL("// delinearize gamma \n");
GLSL("color.rgb = clamp(color.rgb, 0.0, 1.0); \n"); // delinearize gamma
GLSL("// linearize gamma \n");
GLSL("color.rgb = clamp(color.rgb, 0.0, 1.0); \n"); // linearize gamma
GLSL("color.rgb = pow(color.rgb, vec3(2.4)); \n");
#ifndef GAMMA
GLSL("// delinearize gamma to sRGB \n");
GLSL("color.rgb = max(color.rgb, 0.0); \n");
GLSL("color.rgb = mix(color.rgb * vec3(12.92), vec3(1.055) * pow(color.rgb, vec3(1.0/2.4)) - vec3(0.055), bvec3(lessThanEqual(vec3(0.0031308), color.rgb))); \n");
#endif
GLSL("// color mapping \n");
GLSL("out_color = color; \n");