Line data Source code
1 : // Generated file - Edit yuv420unpack.glsl!
2 : #include <string>
3 6 : static const std::string yuv420unpack_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 \n uniform float shiftX;\n uniform float shiftY;\n \n void "
17 : "main(void)\n {\n vec2 pos = gl_FragCoord.xy - vec2( 0.5 + shiftX, 0.5 "
18 : "+ shiftY );\n \n vec2 posAbs = vec2( floor( pos.x * 0.5 ), pos.y );\n "
19 : "\n float odd = fract( pos.y*0.5 );\n float hor;\n if( odd < "
20 : "0.5 )\n hor = 1.0;\n else\n hor = -1.0;\n \n "
21 : "vec4 p1 = texture2DRect( color, posAbs );\n vec4 p2 = texture2DRect( "
22 : "color, posAbs + vec2( 0.0, hor ));\n \n float u;\n float v;\n "
23 : "if( odd < 0.5 )\n {\n u = p1.b - 0.5;\n v = p2.b - "
24 : "0.5;\n }else\n {\n u = p2.b - 0.5;\n v = p1.b - "
25 : "0.5;\n }\n \n //u = 0.0; v = 0.0;\n \n float y;\n if( "
26 : "fract( pos.x*0.5 ) < 0.5 )\n y = p1.x;\n else\n y = "
27 : "p1.y;\n \n gl_FragColor.r = y + 1.4031 * v;\n "
28 : "gl_FragColor.g = y - 0.3945 * u - 0.7146 * v;\n gl_FragColor.b = y + "
29 : "2.032 * u;\n gl_FragColor.a = p1.a;\n }\n \n ";
|