Coverage for /home/antoine/projects/xpra-git/dist/python3/lib64/python/xpra/client/gl/gl_colorspace_conversions.py : 100%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# The following fragprog is:
2# * MIT X11 license, Copyright (c) 2007 by:
3# * Michael Dominic K. <mdk@mdk.am>
4#http://www.mdk.org.pl/2007/11/17/gl-colorspace-conversions
5# "full-color" version by Antoine Martin <antoine@xpra.org>
7YUV2RGB_shader = b"""!!ARBfp1.0
8# cgc version 3.1.0010, build date Feb 10 2012
9# command line args: -profile arbfp1
10# source file: yuv.cg
11#vendor NVIDIA Corporation
12#version 3.1.0.10
13#profile arbfp1
14#program main
15#semantic main.IN
16#var float2 IN.texcoord1 : $vin.TEXCOORD0 : TEX0 : 0 : 1
17#var float2 IN.texcoord2 : $vin.TEXCOORD1 : TEX1 : 0 : 1
18#var float2 IN.texcoord3 : $vin.TEXCOORD2 : TEX2 : 0 : 1
19#var samplerRECT IN.texture1 : TEXUNIT0 : texunit 0 : 0 : 1
20#var samplerRECT IN.texture2 : TEXUNIT1 : texunit 1 : 0 : 1
21#var samplerRECT IN.texture3 : TEXUNIT2 : texunit 2 : 0 : 1
22#var float4 IN.color : $vin.COLOR0 : COL0 : 0 : 1
23#var float4 main.color : $vout.COLOR0 : COL : -1 : 1
24#const c[0] = 1.1643835 2.017231 0 0.5
25#const c[1] = 0.0625 1.1643835 -0.3917616 -0.81296802
26#const c[2] = 1.1643835 0 1.5960271
27 PARAM c[3] = { { 1.1643835, 2.017231, 0, 0.5 },
28 { 0.0625, 1.1643835, -0.3917616, -0.81296802 },
29 { 1.1643835, 0, 1.5960271 } };
30 TEMP R0;
31 TEMP R1;
32 TEX R0.x, fragment.texcoord[2], texture[2], RECT;
33 ADD R1.z, R0.x, -c[0].w;
34 TEX R1.x, fragment.texcoord[0], texture[0], RECT;
35 TEX R0.x, fragment.texcoord[1], texture[1], RECT;
36 ADD R1.x, R1, -c[1];
37 ADD R1.y, R0.x, -c[0].w;
38 DP3 result.color.z, R1, c[0];
39 DP3 result.color.y, R1, c[1].yzww;
40 DP3 result.color.x, R1, c[2];
41 MOV result.color.w, fragment.color.primary;
42 END
43# 10 instructions, 2 R-regs
44"""
46YUV2RGB_FULL_shader = b"""!!ARBfp1.0
47# cgc version 3.0.0016, build date Feb 13 2011
48# command line args: -profile arbfp1
49# source file: yuv.cg
50#vendor NVIDIA Corporation
51#version 3.0.0.16
52#profile arbfp1
53#program main
54#semantic main.IN
55#var float2 IN.texcoord1 : $vin.TEXCOORD0 : TEX0 : 0 : 1
56#var float2 IN.texcoord2 : $vin.TEXCOORD1 : TEX1 : 0 : 1
57#var float2 IN.texcoord3 : $vin.TEXCOORD2 : TEX2 : 0 : 1
58#var samplerRECT IN.texture1 : TEXUNIT0 : texunit 0 : 0 : 1
59#var samplerRECT IN.texture2 : TEXUNIT1 : texunit 1 : 0 : 1
60#var samplerRECT IN.texture3 : TEXUNIT2 : texunit 2 : 0 : 1
61#var float4 IN.color : $vin.COLOR0 : COL0 : 0 : 1
62#var float4 main.color : $vout.COLOR0 : COL : -1 : 1
63#const c[0] = 1 1.732 0 0.5
64#const c[1] = 1 -0.344136 -0.714136
65#const c[2] = 1 0 1.402
66PARAM c[3] = { { 1, 1.732, 0, 0.5 },
67 { 1, -0.344136, -0.714136 },
68 { 1, 0, 1.402 } };
69TEMP R0;
70TEMP R1;
71TEX R0.x, fragment.texcoord[2], texture[2], RECT;
72ADD R1.z, R0.x, -c[0].w;
73TEX R0.x, fragment.texcoord[1], texture[1], RECT;
74TEX R1.x, fragment.texcoord[0], texture[0], RECT;
75ADD R1.y, R0.x, -c[0].w;
76DP3 result.color.z, R1, c[0];
77DP3 result.color.y, R1, c[1];
78DP3 result.color.x, R1, c[2];
79MOV result.color.w, fragment.color.primary;
80END
81# 9 instructions, 2 R-regs
82"""
84# The following fragprog is a derived work of the above.
85# Source Cg is :
86#
87#struct pixel_in {
88# float2 texcoord1 : TEXCOORD0;
89# float2 texcoord2 : TEXCOORD1;
90# float2 texcoord3 : TEXCOORD2;
91# uniform samplerRECT texture1 : TEXUNIT0;
92# uniform samplerRECT texture2 : TEXUNIT1;
93# uniform samplerRECT texture3 : TEXUNIT2;
94# float4 color : COLOR0;
95#};
96#
97#struct pixel_out {
98# float4 color : COLOR0;
99#};
100#
101#pixel_out
102#main (pixel_in IN)
103#{
104# pixel_out OUT;
105#
106# OUT.color.r = texRECT(IN.texture1, IN.texcoord1).r;
107# OUT.color.g = texRECT(IN.texture2, IN.texcoord2).r;
108# OUT.color.b = texRECT(IN.texture3, IN.texcoord3).r;
109# OUT.color.a = IN.color.a;
110#
111# return OUT;
112#}
114RGBP2RGB_shader = b"""!!ARBfp1.0
115# cgc version 3.1.0013, build date Apr 24 2012
116# command line args: -profile arbfp1
117# source file: a.cg
118#vendor NVIDIA Corporation
119#version 3.1.0.13
120#profile arbfp1
121#program main
122#semantic main.IN
123#var float2 IN.texcoord1 : $vin.TEXCOORD0 : TEX0 : 0 : 1
124#var float2 IN.texcoord2 : $vin.TEXCOORD1 : TEX1 : 0 : 1
125#var float2 IN.texcoord3 : $vin.TEXCOORD2 : TEX2 : 0 : 1
126#var samplerRECT IN.texture1 : TEXUNIT0 : texunit 0 : 0 : 1
127#var samplerRECT IN.texture2 : TEXUNIT1 : texunit 1 : 0 : 1
128#var samplerRECT IN.texture3 : TEXUNIT2 : texunit 2 : 0 : 1
129#var float4 IN.color : $vin.COLOR0 : COL0 : 0 : 1
130#var float4 main.color : $vout.COLOR0 : COL : -1 : 1
131TEMP R0;
132TEMP R1;
133TEX R0.x, fragment.texcoord[2], texture[2], RECT;
134TEX R1.x, fragment.texcoord[1], texture[1], RECT;
135MOV result.color.w, fragment.color.primary;
136MOV result.color.x, R0.x;
137MOV result.color.z, R1.x;
138TEX result.color.y, fragment.texcoord[0], texture[0], RECT;
139END
140# 6 instructions, 2 R-regs
141"""