// 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     float _frame_rotation;
COMPAT_VARYING     vec2 _oney;
COMPAT_VARYING     vec2 _onex;
COMPAT_VARYING     vec2 _texCoord;
struct tex_coords {
    vec2 _texCoord;
    vec2 _onex;
    vec2 _oney;
};
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
    float _frame_count;
    float _frame_direction;
    float _frame_rotation;
};
vec4 _oPosition1;
input_dummy _IN1;
vec4 _r0006;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 COLOR;
COMPAT_VARYING vec4 COL0;
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()
{
    vec4 _oColor;
    tex_coords _coords;
    _r0006 = VertexCoord.x*MVPMatrix[0];
    _r0006 = _r0006 + VertexCoord.y*MVPMatrix[1];
    _r0006 = _r0006 + VertexCoord.z*MVPMatrix[2];
    _r0006 = _r0006 + VertexCoord.w*MVPMatrix[3];
    _oPosition1 = _r0006;
    _oColor = COLOR;
    _coords._texCoord = TexCoord.xy;
    _coords._onex = vec2(1.00000000E+00/TextureSize.x, 0.00000000E+00);
    _coords._oney = vec2(0.00000000E+00, 1.00000000E+00/TextureSize.y);
    gl_Position = _r0006;
    COL0 = COLOR;
    TEX0.xy = TexCoord.xy;
    TEX1.xy = _coords._onex;
    TEX2.xy = _coords._oney;
} 
#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     float _frame_rotation;
COMPAT_VARYING     vec2 _oney;
COMPAT_VARYING     vec2 _onex;
COMPAT_VARYING     vec2 _texCoord;
struct tex_coords {
    vec2 _texCoord;
    vec2 _onex;
    vec2 _oney;
};
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
    float _frame_count;
    float _frame_direction;
    float _frame_rotation;
};
vec4 _TMP5;
vec4 _TMP10;
float _TMP9;
float _TMP8;
float _TMP7;
float _TMP6;
vec4 _TMP4;
vec4 _TMP3;
vec4 _TMP2;
vec4 _TMP1;
vec2 _TMP0;
input_dummy _IN1;
uniform sampler2D Texture;
vec2 _c0028;
vec2 _c0040;
vec2 _c0052;
vec4 _TMP73;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec4 TEX1;
COMPAT_VARYING vec4 TEX2;
 
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
    vec2 _coords;
    vec2 _pixel_center;
    vec2 _texture_coords;
    vec4 _color;
    float _dx;
    float _h_weight_00;
    vec2 _coords01;
    vec4 _colorNB;
    float _h_weight_01;
    float _dy;
    float _v_weight_00;
    vec2 _coords10;
    float _v_weight_10;
    _coords = TEX0.xy*TextureSize;
    _TMP0 = floor(_coords);
    _pixel_center = _TMP0 + vec2( 5.00000000E-01, 5.00000000E-01);
    _texture_coords = _pixel_center/TextureSize;
    _TMP1 = COMPAT_TEXTURE(Texture, _texture_coords);
    _TMP6 = pow(_TMP1.x, 2.40000010E+00);
    _TMP7 = pow(_TMP1.y, 2.40000010E+00);
    _TMP8 = pow(_TMP1.z, 2.40000010E+00);
    _TMP9 = pow(_TMP1.w, 2.40000010E+00);
    _color = vec4(_TMP6, _TMP7, _TMP8, _TMP9);
    _dx = _coords.x - _pixel_center.x;
    _h_weight_00 = _dx/8.99999976E-01;
    if (_h_weight_00 > 1.00000000E+00) { 
        _h_weight_00 = 1.00000000E+00;
    } 
    _h_weight_00 = 1.00000000E+00 - _h_weight_00*_h_weight_00;
    _h_weight_00 = _h_weight_00*_h_weight_00;
    _color = _color*vec4(_h_weight_00, _h_weight_00, _h_weight_00, _h_weight_00);
    if (_dx > 0.00000000E+00) { 
        _coords01 = TEX1.xy;
        _dx = 1.00000000E+00 - _dx;
    } else {
        _coords01 = -TEX1.xy;
        _dx = 1.00000000E+00 + _dx;
    } 
    _c0028 = _texture_coords + _coords01;
    _TMP2 = COMPAT_TEXTURE(Texture, _c0028);
    _TMP6 = pow(_TMP2.x, 2.40000010E+00);
    _TMP7 = pow(_TMP2.y, 2.40000010E+00);
    _TMP8 = pow(_TMP2.z, 2.40000010E+00);
    _TMP9 = pow(_TMP2.w, 2.40000010E+00);
    _colorNB = vec4(_TMP6, _TMP7, _TMP8, _TMP9);
    _h_weight_01 = _dx/8.99999976E-01;
    if (_h_weight_01 > 1.00000000E+00) { 
        _h_weight_01 = 1.00000000E+00;
    } 
    _h_weight_01 = 1.00000000E+00 - _h_weight_01*_h_weight_01;
    _h_weight_01 = _h_weight_01*_h_weight_01;
    _color = _color + _colorNB*vec4(_h_weight_01, _h_weight_01, _h_weight_01, _h_weight_01);
    _dy = _coords.y - _pixel_center.y;
    _v_weight_00 = _dy/6.49999976E-01;
    if (_v_weight_00 > 1.00000000E+00) { 
        _v_weight_00 = 1.00000000E+00;
    } 
    _v_weight_00 = 1.00000000E+00 - _v_weight_00*_v_weight_00;
    _v_weight_00 = _v_weight_00*_v_weight_00;
    _color = _color*vec4(_v_weight_00, _v_weight_00, _v_weight_00, _v_weight_00);
    if (_dy > 0.00000000E+00) { 
        _coords10 = TEX2.xy;
        _dy = 1.00000000E+00 - _dy;
    } else {
        _coords10 = -TEX2.xy;
        _dy = 1.00000000E+00 + _dy;
    } 
    _c0040 = _texture_coords + _coords10;
    _TMP3 = COMPAT_TEXTURE(Texture, _c0040);
    _TMP6 = pow(_TMP3.x, 2.40000010E+00);
    _TMP7 = pow(_TMP3.y, 2.40000010E+00);
    _TMP8 = pow(_TMP3.z, 2.40000010E+00);
    _TMP9 = pow(_TMP3.w, 2.40000010E+00);
    _colorNB = vec4(_TMP6, _TMP7, _TMP8, _TMP9);
    _v_weight_10 = _dy/6.49999976E-01;
    if (_v_weight_10 > 1.00000000E+00) { 
        _v_weight_10 = 1.00000000E+00;
    } 
    _v_weight_10 = 1.00000000E+00 - _v_weight_10*_v_weight_10;
    _v_weight_10 = _v_weight_10*_v_weight_10;
    _color = _color + _colorNB*vec4(_v_weight_10*_h_weight_00, _v_weight_10*_h_weight_00, _v_weight_10*_h_weight_00, _v_weight_10*_h_weight_00);
    _c0052 = _texture_coords + _coords01 + _coords10;
    _TMP4 = COMPAT_TEXTURE(Texture, _c0052);
    _TMP6 = pow(_TMP4.x, 2.40000010E+00);
    _TMP7 = pow(_TMP4.y, 2.40000010E+00);
    _TMP8 = pow(_TMP4.z, 2.40000010E+00);
    _TMP9 = pow(_TMP4.w, 2.40000010E+00);
    _colorNB = vec4(_TMP6, _TMP7, _TMP8, _TMP9);
    _color = _color + _colorNB*vec4(_v_weight_10*_h_weight_01, _v_weight_10*_h_weight_01, _v_weight_10*_h_weight_01, _v_weight_10*_h_weight_01);
    _color = _color*vec4( 1.45000005E+00, 1.45000005E+00, 1.45000005E+00, 1.45000005E+00);
    _TMP6 = pow(_color.x, 4.54545438E-01);
    _TMP7 = pow(_color.y, 4.54545438E-01);
    _TMP8 = pow(_color.z, 4.54545438E-01);
    _TMP9 = pow(_color.w, 4.54545438E-01);
    _TMP5 = vec4(_TMP6, _TMP7, _TMP8, _TMP9);
    _TMP10 = min(vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00), _TMP5);
    _TMP73 = max(vec4( 0.00000000E+00, 0.00000000E+00, 0.00000000E+00, 0.00000000E+00), _TMP10);
    FragColor = _TMP73;
    return;
} 
#endif
