Fix YUV->RGB shader (YCbCr->RGB really).
WebRTC SDK got it wrong. See https://web.archive.org/web/20180421030430/ http://www.equasys.de/colorconversion.html
This commit is contained in:
parent
45c476da3a
commit
06f7b1d4ec
1 changed files with 8 additions and 2 deletions
|
|
@ -74,10 +74,16 @@ uniform sampler2D u_texture;
|
|||
uniform sampler2D v_texture;
|
||||
)",
|
||||
.body = R"(
|
||||
float y = texture2D(y_texture, v_texcoord).r;
|
||||
// float y = texture2D(y_texture, v_texcoord).r;
|
||||
float y = texture2D(y_texture, v_texcoord).r - 0.0625;
|
||||
float u = texture2D(u_texture, v_texcoord).r - 0.5;
|
||||
float v = texture2D(v_texture, v_texcoord).r - 0.5;
|
||||
result = vec4(y + 1.403 * v, y - 0.344 * u - 0.714 * v, y + 1.77 * u, 1);
|
||||
// result = vec4(y + 1.403 * v, y - 0.344 * u - 0.714 * v, y + 1.77 * u, 1);
|
||||
result = vec4(
|
||||
1.164 * y + 1.596 * v,
|
||||
1.164 * y - 0.392 * u - 0.813 * v,
|
||||
1.164 * y + 2.17 * u,
|
||||
1.);
|
||||
)",
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue