From ead2b8adf05c1f026bf57836fcac3832a1ae03d7 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Thu, 1 Oct 2026 15:59:53 +1000 Subject: [PATCH] [client] network: crop aligned video planes --- client/transports/Network/video/shaders.h | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/client/transports/Network/video/shaders.h b/client/transports/Network/video/shaders.h index d6262213..4598eba5 100644 --- a/client/transports/Network/video/shaders.h +++ b/client/transports/Network/video/shaders.h @@ -303,20 +303,25 @@ static const char NETWORK_VIDEO_YUV_SHADER[] = "uniform float lumaScale;\n" "uniform float chromaMidpoint;\n" "uniform float chromaScale;\n" - "void main(){ivec2 pixel=ivec2(gl_GlobalInvocationID.xy);\n" + "void main(){\n" + " ivec2 pixel = ivec2(gl_GlobalInvocationID.xy);\n" " if(any(greaterThanEqual(pixel,outputSize)))return;\n" - " vec2 uv=(vec2(pixel)+0.5)/vec2(outputSize);\n" - " vec2 offset=chromaLeft?vec2(0.5/float(outputSize.x),0.0):vec2(0.0);\n" - " float y=clamp((texture(lumaPlane,uv).x-lumaOffset)*lumaScale,0.0,1.0);\n" - " float cb=clamp((texture(cbPlane,uv+offset).x-chromaMidpoint)*\n" + " ivec2 planeSize = textureSize(lumaPlane,0);\n" + " vec2 uv = (vec2(pixel)+0.5)/vec2(planeSize);\n" + " vec2 offset = chromaLeft?\n" + " vec2(0.5/float(planeSize.x),0.0):vec2(0.0);\n" + " float y = clamp((texture(lumaPlane,uv).x-lumaOffset)*\n" + " lumaScale,0.0,1.0);\n" + " float cb = clamp((texture(cbPlane,uv+offset).x-chromaMidpoint)*\n" " chromaScale,-0.5,0.5);\n" - " float cr=clamp((texture(crPlane,uv+offset).x-chromaMidpoint)*\n" + " float cr = clamp((texture(crPlane,uv+offset).x-chromaMidpoint)*\n" " chromaScale,-0.5,0.5);\n" - " mat3 m=bt2020?mat3(vec3(1.0),vec3(0.0,-0.16455313,1.8814),\n" + " mat3 m = bt2020?\n" + " mat3(vec3(1.0),vec3(0.0,-0.16455313,1.8814),\n" " vec3(1.4746,-0.57135313,0.0)):\n" " mat3(vec3(1.0),vec3(0.0,-0.13397432/0.7152,1.8556),\n" " vec3(1.5748,-0.33480248/0.7152,0.0));\n" - " vec3 rgb=clamp(m*vec3(y,cb,cr),vec3(0.0),vec3(1.0));\n" + " vec3 rgb = clamp(m*vec3(y,cb,cr),vec3(0.0),vec3(1.0));\n" " imageStore(outputImage,pixel,vec4(rgb,1.0));}\n"; static const char * const NETWORK_VIDEO_DEQUANT_SOURCES[] =