// GLSL shader autogenerated by cg2glsl.py.
#if defined(VERTEX)

#if __VERSION__ >= 130
#define COMPAT_VARYING out
#define COMPAT_ATTRIBUTE in
#define COMPAT_TEXTURE texture
#else
#define COMPAT_VARYING varying
#define COMPAT_ATTRIBUTE attribute
#define COMPAT_TEXTURE texture2D
#endif

#ifdef GL_ES
#define COMPAT_PRECISION mediump
#else
#define COMPAT_PRECISION
#endif
COMPAT_VARYING     vec4 _t2;
COMPAT_VARYING     vec4 _t1;
COMPAT_VARYING     vec2 _texCoord1;
COMPAT_VARYING     vec4 _position1;
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
};
struct out_vertex {
    vec4 _position1;
    vec2 _texCoord1;
    vec4 _t1;
    vec4 _t2;
};
out_vertex _ret_0;
input_dummy _IN1;
vec4 _r0006;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec4 TEX1;
COMPAT_VARYING vec4 TEX2;
 
uniform mat4 MVPMatrix;
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
    out_vertex _OUT;
    vec2 _ps;
    _r0006 = VertexCoord.x*MVPMatrix[0];
    _r0006 = _r0006 + VertexCoord.y*MVPMatrix[1];
    _r0006 = _r0006 + VertexCoord.z*MVPMatrix[2];
    _r0006 = _r0006 + VertexCoord.w*MVPMatrix[3];
    _ps = 1.00000000E+00/TextureSize;
    _OUT._t1 = TexCoord.xyxy + vec4(0.00000000E+00, -_ps.y, 0.00000000E+00, _ps.y);
    _OUT._t2 = TexCoord.xyxy + vec4(-_ps.x, 0.00000000E+00, _ps.x, 0.00000000E+00);
    _ret_0._position1 = _r0006;
    _ret_0._texCoord1 = TexCoord.xy;
    _ret_0._t1 = _OUT._t1;
    _ret_0._t2 = _OUT._t2;
    gl_Position = _r0006;
    TEX0.xy = TexCoord.xy;
    TEX1 = _OUT._t1;
    TEX2 = _OUT._t2;
    return;
    TEX0.xy = _ret_0._texCoord1;
    TEX1 = _ret_0._t1;
    TEX2 = _ret_0._t2;
} 
#elif defined(FRAGMENT)

#if __VERSION__ >= 130
#define COMPAT_VARYING in
#define COMPAT_TEXTURE texture
out vec4 FragColor;
#else
#define COMPAT_VARYING varying
#define FragColor gl_FragColor
#define COMPAT_TEXTURE texture2D
#endif

#ifdef GL_ES
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
#define COMPAT_PRECISION mediump
#else
#define COMPAT_PRECISION
#endif
COMPAT_VARYING     vec4 _t2;
COMPAT_VARYING     vec4 _t1;
COMPAT_VARYING     vec2 _texCoord;
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
};
struct out_vertex {
    vec2 _texCoord;
    vec4 _t1;
    vec4 _t2;
};
vec4 _ret_0;
vec4 _TMP9;
vec4 _TMP10;
float _TMP14;
float _TMP13;
float _TMP12;
float _TMP11;
vec4 _TMP3;
vec4 _TMP2;
vec4 _TMP1;
vec4 _TMP0;
uniform sampler2D Texture;
vec3 _TMP250035[4];
vec4 _ravg0035;
vec4 _TMP240035[3];
vec4 _TMP230035[3];
vec4 _TMP220035[3];
vec4 _TMP210035[3];
vec3 _TMP200035[4];
vec4 _r0045;
COMPAT_VARYING vec4 TEX1;
COMPAT_VARYING vec4 TEX2;
vec4 _TMP66;
vec4 _TMP67;
vec3 _TMP68;
vec3 _TMP69;
vec3 _TMP70;
vec3 _TMP71;
 
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
    _TMP0 = COMPAT_TEXTURE(Texture, TEX1.xy);
    _TMP1 = COMPAT_TEXTURE(Texture, TEX1.zw);
    _TMP2 = COMPAT_TEXTURE(Texture, TEX2.xy);
    _TMP3 = COMPAT_TEXTURE(Texture, TEX2.zw);
    _TMP250035[0] = _TMP2.xyz - _TMP0.xyz;
    _TMP250035[1] = _TMP0.xyz - _TMP3.xyz;
    _TMP250035[2] = _TMP3.xyz - _TMP1.xyz;
    _TMP250035[3] = _TMP1.xyz - _TMP2.xyz;
    _TMP66.x = _TMP2.x;
    _TMP66.y = _TMP0.x;
    _TMP66.z = _TMP3.x;
    _TMP66.w = _TMP1.x;
    _TMP67.x = _TMP0.x;
    _TMP67.y = _TMP3.x;
    _TMP67.z = _TMP1.x;
    _TMP67.w = _TMP2.x;
    _ravg0035 = 5.00000000E-01*(_TMP66 + _TMP67);
    _TMP240035[0] = 2.00000000E+00 + _ravg0035;
    _TMP240035[2] = 3.00000000E+00 - _ravg0035;
    _TMP230035[0] = 2.00000000E+00 + _ravg0035;
    _TMP230035[2] = 3.00000000E+00 - _ravg0035;
    _TMP220035[0] = 2.00000000E+00 + _ravg0035;
    _TMP220035[2] = 3.00000000E+00 - _ravg0035;
    _TMP210035[0] = 2.00000000E+00 + _ravg0035;
    _TMP210035[2] = 3.00000000E+00 - _ravg0035;
    _TMP68.x = _TMP240035[0].x;
    _TMP68.y = 4.00000000E+00;
    _TMP68.z = _TMP240035[2].x;
    _TMP200035[0] = _TMP250035[0]*_TMP250035[0]*_TMP68;
    _TMP69.x = _TMP230035[0].y;
    _TMP69.y = 4.00000000E+00;
    _TMP69.z = _TMP230035[2].y;
    _TMP200035[1] = _TMP250035[1]*_TMP250035[1]*_TMP69;
    _TMP70.x = _TMP220035[0].z;
    _TMP70.y = 4.00000000E+00;
    _TMP70.z = _TMP220035[2].z;
    _TMP200035[2] = _TMP250035[2]*_TMP250035[2]*_TMP70;
    _TMP71.x = _TMP210035[0].w;
    _TMP71.y = 4.00000000E+00;
    _TMP71.z = _TMP210035[2].w;
    _TMP200035[3] = _TMP250035[3]*_TMP250035[3]*_TMP71;
    _r0045.x = dot(_TMP200035[0], vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _r0045.y = dot(_TMP200035[1], vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _r0045.z = dot(_TMP200035[2], vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _r0045.w = dot(_TMP200035[3], vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _TMP11 = inversesqrt(_r0045.x);
    _TMP12 = inversesqrt(_r0045.y);
    _TMP13 = inversesqrt(_r0045.z);
    _TMP14 = inversesqrt(_r0045.w);
    _TMP10 = vec4(_TMP11, _TMP12, _TMP13, _TMP14);
    _TMP9 = 1.00000000E+00/_TMP10;
    _ret_0 = 1.00000000E+00 - _TMP9/3.00000000E+00;
    FragColor = _ret_0;
    return;
} 
#endif
