I'm trying to understand these calculations for YUV420P to RGB conversion on an OpenGL fragment shader. On https://en.wikipedia.org/wiki/YUV there are lots of calculations but none of them look like the one below. Why take 0.0625
and 0.5
and 0.5
in the first part? And where did the second part come from?
yuv.r = texture(tex_y, TexCoord).r - 0.0625;
yuv.g = texture(tex_u, TexCoord).r - 0.5;
yuv.b = texture(tex_v, TexCoord).r - 0.5;
rgba.r = yuv.r + 1.596 * yuv.b
rgba.g = yuv.r - 0.813 * yuv.b - 0.391 * yuv.g;
rgba.b = yuv.r + 2.018 * yuv.g;
It may be an special color conversion for some specific YUV color scheme but I couldn't find anything on the internet.