Line data Source code
1 : // Generated file - Edit yuv420readback.glsl!
2 : #include <string>
3 6 : static const std::string yuv420readback_glsl =
4 : "/* Copyright (c) 2009 Maxim Makhinya\n *\n * This library is free "
5 : "software; you can redistribute it and/or modify it under\n * the terms "
6 : "of the GNU Lesser General Public License as published by the Free\n * "
7 : "Software Foundation; either version 2.1 of the License, or (at your "
8 : "option)\n * any later version.\n * \n * This library is distributed "
9 : "in the hope that it will be useful, but WITHOUT\n * ANY WARRANTY; "
10 : "without even the implied warranty of MERCHANTABILITY or FITNESS\n * FOR "
11 : "A PARTICULAR PURPOSE. See the GNU Lesser General Public License for "
12 : "more\n * details.\n * \n * You should have received a copy of the GNU "
13 : "Lesser General Public License\n * along with this library; if not, write "
14 : "to the Free Software Foundation, Inc.,\n * 51 Franklin Street, Fifth "
15 : "Floor, Boston, MA 02110-1301 USA.\n */\n \n uniform sampler2DRect "
16 : "color;\n \n vec4 yMul = vec4( 0.299 , 0.587 , 0.114 , 0.0 );\n vec4 uMul "
17 : "= vec4(-0.147 ,-0.289 , 0.436 , 0.0 );\n vec4 vMul = vec4( "
18 : "0.4996,-0.4184,-0.0812, 0.0 );\n /*vec4 vMul = vec4( "
19 : "0.2896,-0.2084,-0.0802, 0.0 );*/\n \n vec4 test = vec4( 1.0, 1.0, 1.0, "
20 : "0.0 );\n \n void main(void)\n {\n vec2 pos = gl_FragCoord.xy - vec2( "
21 : "0.5, 0.5 );\n pos.x = pos.x * 2.0;\n \n float odd = fract( "
22 : "pos.y*0.5 );\n float hor;\n if( odd < 0.5 )\n hor = "
23 : "1.0;\n else\n hor = -1.0;\n \n vec4 p1 = texture2DRect( "
24 : "color, pos );\n vec4 p2 = texture2DRect( color, pos + vec2( 1.0, 0.0 "
25 : "));\n vec4 p3 = texture2DRect( color, pos + vec2( 0.0, hor ));\n "
26 : "vec4 p4 = texture2DRect( color, pos + vec2( 1.0, hor ));\n \n float n "
27 : "= 0.0;\n vec4 p = vec4( .0, .0, .0, .0 );\n \n if( dot( p1, test "
28 : ") > .0 ) { n += 1.0; p += p1; }\n if( dot( p2, test ) > .0 ) { n += "
29 : "1.0; p += p2; }\n if( dot( p3, test ) > .0 ) { n += 1.0; p += p3; }\n "
30 : " if( dot( p4, test ) > .0 ) { n += 1.0; p += p4; }\n \n float cVal "
31 : "= 0.0;\n if( n > 0.0 )\n {\n p /= n;\n \n if( odd "
32 : "< 0.5 )\n cVal = dot(p,uMul);\n else\n "
33 : "cVal = dot(p,vMul);\n }\n // cVal = 0.0;\n gl_FragColor = "
34 : "vec4( dot(p1,yMul), dot(p2,yMul), cVal+0.5, (p1.a+p2.a)/2.0 );\n }\n \n ";
|