YUV to RGB compute BT709 coeff...

This forum is about all development around libVLC.
wcoder
Blank Cone
Blank Cone
Posts: 26
Joined: 30 Mar 2014 12:56

YUV to RGB compute BT709 coeff...

Postby wcoder » 26 Apr 2014 08:59

Hi,

I'am try to found how coeff was calculated on YUV to RGB shader on OpenGl.c module...and what is the last column factor ?

// [R/G/B][Y U V O] from TV range to full range XXX we could also do hue/brightness/constrast/gamma by simply changing the coefficients
const float matrix_bt709_tv2full[12] = {
1.164383561643836, 0.0000, 1.792741071428571, -0.972945075016308,
1.164383561643836, -0.21324861427373, -0.532909328559444, 0.301482665475862,
1.164383561643836, 2.112401785714286, 0.0000, -1.133402217873451 };

Thanks

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: YUV to RGB compute BT709 coeff...

Postby Jean-Baptiste Kempf » 26 Apr 2014 18:42

It's based on the standard.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

wcoder
Blank Cone
Blank Cone
Posts: 26
Joined: 30 Mar 2014 12:56

Re: YUV to RGB compute BT709 coeff...

Postby wcoder » 29 Apr 2014 12:26

I known but it's not my question (allez un petit effort camarade ^_^), i found a lot of site like :
http://www.fourcc.org/fccyvrgb.php
http://www.equasys.de/colorconversion.html

So I made my own basic shader using this coeff from fourcc (LUMINANCE texture) :

float fY = 1.164 * ( texture2D ( TextureY, gl_TexCoord [0].st ).r - 0.0625 );
float fU = texture2D ( TextureU, gl_TexCoord [1].st ).r - 0.5;
float fV = texture2D ( TextureV, gl_TexCoord [2].st ).r - 0.5;

vec4 rgbColor;
rgbColor.x = fY + 1.793 * fV;
rgbColor.y = fY - 0.213 * fU + 0.533 * fV;
rgbColor.z = fY + 2.112 * fU;

gl_FragColor = rgbColor;

It's work, but i want to undestand how use info from spec to calculate coeff with a full précision : http://www.itu.int/rec/R-REC-BT.709-5-200204-I/en
Like you, i want to undestand too : what is the last column i supose for the moment it's a brightnes & constrast adjustement
1.164383561643836, 0.0000, 1.792741071428571, -0.972945075016308,
1.164383561643836, -0.21324861427373, -0.532909328559444, 0.301482665475862,
1.164383561643836, 2.112401785714286, 0.0000, -1.133402217873451 };

Thanks by advance,

WCdr


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 12 guests