mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-20 11:35:56 +00:00
parent
2757e7aa41
commit
3544ec34d6
1 changed files with 7 additions and 1 deletions
|
@ -61,15 +61,21 @@ static QString s_fragShader = R"(
|
|||
{
|
||||
vec3 yuv;
|
||||
vec3 rgb;
|
||||
// SDL2-2.0.10\src\render\opengl\SDL_shaders_gl.c BT709_SHADER_CONSTANTS
|
||||
|
||||
// SDL2 BT709_SHADER_CONSTANTS
|
||||
// https://github.com/spurious/SDL-mirror/blob/4ddd4c445aa059bb127e101b74a8c5b59257fbe2/src/render/opengl/SDL_shaders_gl.c#L102
|
||||
const vec3 Rcoeff = vec3(1.1644, 0.000, 1.7927);
|
||||
const vec3 Gcoeff = vec3(1.1644, -0.2132, -0.5329);
|
||||
const vec3 Bcoeff = vec3(1.1644, 2.1124, 0.000);
|
||||
|
||||
// 根据指定的纹理textureY和坐标textureOut来采样
|
||||
yuv.x = texture2D(textureY, textureOut).r;
|
||||
yuv.y = texture2D(textureU, textureOut).r - 0.5;
|
||||
yuv.z = texture2D(textureV, textureOut).r - 0.5;
|
||||
|
||||
// 采样完转为rgb
|
||||
// 减少一些亮度
|
||||
yuv.x = yuv.x - 0.0625;
|
||||
rgb.r = dot(yuv, Rcoeff);
|
||||
rgb.g = dot(yuv, Gcoeff);
|
||||
rgb.b = dot(yuv, Bcoeff);
|
||||
|
|
Loading…
Add table
Reference in a new issue