Line data Source code
1 : //Generated file - Edit yuv420unpack.glsl!
2 : #include <string>
3 12 : static const std::string yuv420unpack_glsl = "/* Copyright (c) 2009 Maxim Makhinya\n *\n * This library is free software; you can redistribute it and/or modify it under\n * the terms of the GNU Lesser General Public License as published by the Free\n * Software Foundation; either version 2.1 of the License, or (at your option)\n * any later version.\n * \n * This library is distributed in the hope that it will be useful, but WITHOUT\n * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more\n * details.\n * \n * You should have received a copy of the GNU Lesser General Public License\n * along with this library; if not, write to the Free Software Foundation, Inc.,\n * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n */\n \n uniform sampler2DRect color;\n \n \n uniform float shiftX;\n uniform float shiftY;\n \n void main(void)\n {\n vec2 pos = gl_FragCoord.xy - vec2( 0.5 + shiftX, 0.5 + shiftY );\n \n vec2 posAbs = vec2( floor( pos.x * 0.5 ), pos.y );\n \n float odd = fract( pos.y*0.5 );\n float hor;\n if( odd < 0.5 )\n hor = 1.0;\n else\n hor = -1.0;\n \n vec4 p1 = texture2DRect( color, posAbs );\n vec4 p2 = texture2DRect( color, posAbs + vec2( 0.0, hor ));\n \n float u;\n float v;\n if( odd < 0.5 )\n {\n u = p1.b - 0.5;\n v = p2.b - 0.5;\n }else\n {\n u = p2.b - 0.5;\n v = p1.b - 0.5;\n }\n \n //u = 0.0; v = 0.0;\n \n float y;\n if( fract( pos.x*0.5 ) < 0.5 )\n y = p1.x;\n else\n y = p1.y;\n \n gl_FragColor.r = y + 1.4031 * v;\n gl_FragColor.g = y - 0.3945 * u - 0.7146 * v;\n gl_FragColor.b = y + 2.032 * u;\n gl_FragColor.a = p1.a;\n }\n \n ";
|