Revision 4,
834 bytes
checked in by ajaworski, 13 years ago
(diff) |
Added modified SAGE sources
|
Line | |
---|
1 | #extension GL_ARB_texture_rectangle : enable |
---|
2 | |
---|
3 | uniform sampler2DRect yuvtex; |
---|
4 | |
---|
5 | void main(void) |
---|
6 | { |
---|
7 | float nx, ny, tu, tv, ty; |
---|
8 | float t, dx, dy; |
---|
9 | float y,u,v; |
---|
10 | float r,g,b; |
---|
11 | int m, n; |
---|
12 | vec4 vy, uy, yv, yu; |
---|
13 | |
---|
14 | nx=gl_TexCoord[0].s; |
---|
15 | ny=gl_TexCoord[0].t; |
---|
16 | |
---|
17 | dx = gl_FragCoord.s; |
---|
18 | dy = gl_FragCoord.t; |
---|
19 | |
---|
20 | if(mod(floor(nx),2.0)>0.5) { |
---|
21 | |
---|
22 | uy = texture2DRect(yuvtex,vec2(nx-1.0,ny)); |
---|
23 | vy = texture2DRect(yuvtex,vec2(nx,ny)); |
---|
24 | |
---|
25 | u = uy.x; |
---|
26 | v = vy.x; |
---|
27 | |
---|
28 | y = vy.a; |
---|
29 | } |
---|
30 | else { |
---|
31 | uy = texture2DRect(yuvtex,vec2(nx,ny)); |
---|
32 | vy = texture2DRect(yuvtex,vec2(nx+1.0,ny)); |
---|
33 | |
---|
34 | u = uy.x; |
---|
35 | v = vy.x; |
---|
36 | |
---|
37 | y = uy.a; |
---|
38 | } |
---|
39 | |
---|
40 | y = 1.1640625 * ( y - 0.0625); |
---|
41 | u = u - 0.5; |
---|
42 | v = v - 0.5; |
---|
43 | |
---|
44 | r = y + 1.59765625 * v ; |
---|
45 | g = y - 0.390625 * u - 0.8125 * v ; |
---|
46 | b = y + 2.015625 * u ; |
---|
47 | |
---|
48 | gl_FragColor=vec4(r,g,b,1.0); |
---|
49 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.