// 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 _t6;
COMPAT_VARYING     vec4 _t5;
COMPAT_VARYING     vec4 _t4;
COMPAT_VARYING     vec4 _t3;
COMPAT_VARYING     vec4 _t2;
COMPAT_VARYING     vec4 _t1;
COMPAT_VARYING     vec2 _texCoord1;
COMPAT_VARYING     vec4 _position1;
COMPAT_VARYING     float _frame_rotation;
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
    float _frame_count;
    float _frame_direction;
    float _frame_rotation;
};
struct out_vertex {
    vec4 _position1;
    vec2 _texCoord1;
    vec4 _t1;
    vec4 _t2;
    vec4 _t3;
    vec4 _t4;
    vec4 _t5;
    vec4 _t6;
};
out_vertex _ret_0;
float _TMP1;
float _TMP0;
input_dummy _IN1;
vec4 _r0022;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec4 TEX1;
COMPAT_VARYING vec4 TEX2;
COMPAT_VARYING vec4 TEX3;
COMPAT_VARYING vec4 TEX4;
COMPAT_VARYING vec4 TEX5;
COMPAT_VARYING vec4 TEX6;
 
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()
{
    vec2 _ps;
    float _sx;
    float _sy;
    out_vertex _TMP18;
    if (TextureSize.x == 0.00000000E+00) { 
        _TMP0 = TextureSize.x;
    } else {
        _TMP0 = TextureSize.x;
    } 
    if (TextureSize.y == 0.00000000E+00) { 
        _TMP1 = TextureSize.y;
    } else {
        _TMP1 = TextureSize.y;
    } 
    _ps = vec2(1.00000000E+00/_TMP0, 1.00000000E+00/_TMP1);
    _sx = _ps.x*5.00000000E-01;
    _sy = _ps.y*5.00000000E-01;
    _r0022 = VertexCoord.x*MVPMatrix[0];
    _r0022 = _r0022 + VertexCoord.y*MVPMatrix[1];
    _r0022 = _r0022 + VertexCoord.z*MVPMatrix[2];
    _r0022 = _r0022 + VertexCoord.w*MVPMatrix[3];
    _TMP18._t1 = vec4(TexCoord.x, TexCoord.y, TexCoord.x, TexCoord.y) + vec4(-_ps.x, -_ps.y, _ps.x, -_ps.y);
    _TMP18._t2 = vec4(TexCoord.x, TexCoord.y, TexCoord.x, TexCoord.y) + vec4(_ps.x, _ps.y, -_ps.x, _ps.y);
    _TMP18._t3 = vec4(TexCoord.x, TexCoord.y, TexCoord.x, TexCoord.y) + vec4(-_sx, -_sy, _sx, -_sy);
    _TMP18._t4 = vec4(TexCoord.x, TexCoord.y, TexCoord.x, TexCoord.y) + vec4(_sx, _sy, -_sx, _sy);
    _TMP18._t5 = vec4(TexCoord.x, TexCoord.y, TexCoord.x, TexCoord.y) + vec4(-_ps.x, 0.00000000E+00, _ps.x, 0.00000000E+00);
    _TMP18._t6 = vec4(TexCoord.x, TexCoord.y, TexCoord.x, TexCoord.y) + vec4(0.00000000E+00, -_ps.y, 0.00000000E+00, _ps.y);
    _ret_0._position1 = _r0022;
    _ret_0._texCoord1 = TexCoord.xy;
    _ret_0._t1 = _TMP18._t1;
    _ret_0._t2 = _TMP18._t2;
    _ret_0._t3 = _TMP18._t3;
    _ret_0._t4 = _TMP18._t4;
    _ret_0._t5 = _TMP18._t5;
    _ret_0._t6 = _TMP18._t6;
    gl_Position = _r0022;
    TEX0.xy = TexCoord.xy;
    TEX1 = _TMP18._t1;
    TEX2 = _TMP18._t2;
    TEX3 = _TMP18._t3;
    TEX4 = _TMP18._t4;
    TEX5 = _TMP18._t5;
    TEX6 = _TMP18._t6;
    return;
    TEX0.xy = _ret_0._texCoord1;
    TEX1 = _ret_0._t1;
    TEX2 = _ret_0._t2;
    TEX3 = _ret_0._t3;
    TEX4 = _ret_0._t4;
    TEX5 = _ret_0._t5;
    TEX6 = _ret_0._t6;
} 
#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 _t6;
COMPAT_VARYING     vec4 _t5;
COMPAT_VARYING     vec4 _t4;
COMPAT_VARYING     vec4 _t3;
COMPAT_VARYING     vec4 _t21;
COMPAT_VARYING     vec4 _t11;
COMPAT_VARYING     vec2 _texCoord;
COMPAT_VARYING     float _frame_rotation;
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
    float _frame_count;
    float _frame_direction;
    float _frame_rotation;
};
struct out_vertex {
    vec2 _texCoord;
    vec4 _t11;
    vec4 _t21;
    vec4 _t3;
    vec4 _t4;
    vec4 _t5;
    vec4 _t6;
};
vec4 _ret_0;
float _TMP24;
vec3 _TMP23;
float _TMP22;
vec3 _TMP21;
float _TMP20;
vec3 _TMP19;
float _TMP18;
vec3 _TMP17;
float _TMP16;
vec3 _TMP15;
float _TMP14;
vec3 _TMP13;
vec4 _TMP12;
vec4 _TMP11;
vec4 _TMP10;
vec4 _TMP9;
vec4 _TMP8;
vec4 _TMP7;
vec4 _TMP6;
vec4 _TMP5;
vec4 _TMP4;
vec4 _TMP3;
vec4 _TMP2;
vec4 _TMP1;
vec4 _TMP0;
uniform sampler2D Texture;
vec3 _a0056;
vec3 _a0060;
vec3 _a0064;
vec3 _a0068;
vec3 _a0072;
vec3 _a0076;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec4 TEX1;
COMPAT_VARYING vec4 TEX2;
COMPAT_VARYING vec4 TEX3;
COMPAT_VARYING vec4 TEX4;
COMPAT_VARYING vec4 TEX5;
COMPAT_VARYING vec4 TEX6;
 
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
    float _d1;
    float _d2;
    float _hl;
    float _vl;
    float _m1;
    float _m2;
    vec3 _t1;
    vec3 _t2;
    vec3 _TMP28;
    _TMP0 = COMPAT_TEXTURE(Texture, TEX0.xy);
    _TMP1 = COMPAT_TEXTURE(Texture, TEX1.xy);
    _TMP2 = COMPAT_TEXTURE(Texture, TEX1.zw);
    _TMP3 = COMPAT_TEXTURE(Texture, TEX2.xy);
    _TMP4 = COMPAT_TEXTURE(Texture, TEX2.zw);
    _TMP5 = COMPAT_TEXTURE(Texture, TEX3.xy);
    _TMP6 = COMPAT_TEXTURE(Texture, TEX3.zw);
    _TMP7 = COMPAT_TEXTURE(Texture, TEX4.xy);
    _TMP8 = COMPAT_TEXTURE(Texture, TEX4.zw);
    _TMP9 = COMPAT_TEXTURE(Texture, TEX5.xy);
    _TMP10 = COMPAT_TEXTURE(Texture, TEX5.zw);
    _TMP11 = COMPAT_TEXTURE(Texture, TEX6.xy);
    _TMP12 = COMPAT_TEXTURE(Texture, TEX6.zw);
    _a0056 = _TMP1.xyz - _TMP3.xyz;
    _TMP13 = abs(_a0056);
    _TMP14 = dot(_TMP13, vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _d1 = _TMP14 + 9.99999975E-05;
    _a0060 = _TMP2.xyz - _TMP4.xyz;
    _TMP15 = abs(_a0060);
    _TMP16 = dot(_TMP15, vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _d2 = _TMP16 + 9.99999975E-05;
    _a0064 = _TMP9.xyz - _TMP10.xyz;
    _TMP17 = abs(_a0064);
    _TMP18 = dot(_TMP17, vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _hl = _TMP18 + 9.99999975E-05;
    _a0068 = _TMP11.xyz - _TMP12.xyz;
    _TMP19 = abs(_a0068);
    _TMP20 = dot(_TMP19, vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _vl = _TMP20 + 9.99999975E-05;
    _a0072 = _TMP5.xyz - _TMP7.xyz;
    _TMP21 = abs(_a0072);
    _TMP22 = dot(_TMP21, vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _m1 = _TMP22 + 1.00000005E-03;
    _a0076 = _TMP8.xyz - _TMP6.xyz;
    _TMP23 = abs(_a0076);
    _TMP24 = dot(_TMP23, vec3( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));
    _m2 = _TMP24 + 1.00000005E-03;
    _t1 = (_hl*(_TMP11.xyz + _TMP12.xyz) + _vl*(_TMP9.xyz + _TMP10.xyz) + (_hl + _vl)*_TMP0.xyz)/(3.00000000E+00*(_hl + _vl));
    _t2 = (_d1*(_TMP2.xyz + _TMP4.xyz) + _d2*(_TMP1.xyz + _TMP3.xyz) + (_d1 + _d2)*_TMP0.xyz)/(3.00000000E+00*(_d1 + _d2));
    _TMP28 = 2.50000000E-01*(_t1 + _t2 + (_m2*(_TMP5.xyz + _TMP7.xyz) + _m1*(_TMP8.xyz + _TMP6.xyz))/(_m1 + _m2));
    _ret_0 = vec4(_TMP28.x, _TMP28.y, _TMP28.z, 1.00000000E+00);
    FragColor = _ret_0;
    return;
} 
#endif
