1 | #extension GL_ARB_texture_rectangle : enable
|
---|
2 |
|
---|
3 | uniform sampler2DRect uSrcTex;
|
---|
4 | uniform sampler2DRect uVTex;
|
---|
5 | uniform sampler2DRect uUTex;
|
---|
6 |
|
---|
7 | float splitBGRA(vec4 color, float coord);
|
---|
8 | void cconvApplyAYUV(vec4 color);
|
---|
9 | /* texture internalFormat: GL_LUMINANCE
|
---|
10 | * size: width X height
|
---|
11 | * data format: GL_LUMINANCE
|
---|
12 | *
|
---|
13 | /* YV12-rgb888 conversion shader */
|
---|
14 | void cconvYV12(vec2 srcCoord)
|
---|
15 | {
|
---|
16 | vec4 clrY = texture2DRect(uSrcTex, srcCoord);
|
---|
17 | vec4 clrV = texture2DRect(uVTex, vec2(gl_TexCoord[2]));
|
---|
18 | vec4 clrU = texture2DRect(uUTex, vec2(gl_TexCoord[3]));
|
---|
19 | float y = splitBGRA(clrY, srcCoord.x);
|
---|
20 | float v = splitBGRA(clrV, gl_TexCoord[2].x);
|
---|
21 | float u = splitBGRA(clrU, gl_TexCoord[3].x);
|
---|
22 |
|
---|
23 | /* convert it to AYUV (for the GL_BGRA_EXT texture this is mapped as follows:
|
---|
24 | * A -> B
|
---|
25 | * Y -> G
|
---|
26 | * U -> R
|
---|
27 | * V -> A */
|
---|
28 | cconvApplyAYUV(vec4(u, y, 0.0, v));
|
---|
29 | // gl_FragColor = vec4(clrY.r,clrY.r,clrY.r,1.0);
|
---|
30 | }
|
---|