// 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     vec2 _upper_bound;
COMPAT_VARYING     vec2 _lower_bound;
COMPAT_VARYING     vec2 _tex_coord_2;
COMPAT_VARYING     vec2 _tex_coord_1;
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
    float _frame_count;
float _placeholder31;
};
struct pass_1 {
float _placeholder35;
};
struct blur_coords {
    vec2 _tex_coord_1;
    vec2 _tex_coord_2;
    vec2 _lower_bound;
    vec2 _upper_bound;
};
vec4 _oPosition1;
blur_coords _oBlurCoords1;
input_dummy _IN1;
vec4 _r0007;
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;
 
uniform mat4 MVPMatrix;
uniform COMPAT_PRECISION int FrameDirection;
uniform COMPAT_PRECISION int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
    vec2 _oTexCoord;
    vec2 _texel;
    blur_coords _TMP3;
    _r0007 = VertexCoord.x*MVPMatrix[0];
    _r0007 = _r0007 + VertexCoord.y*MVPMatrix[1];
    _r0007 = _r0007 + VertexCoord.z*MVPMatrix[2];
    _r0007 = _r0007 + VertexCoord.w*MVPMatrix[3];
    _oPosition1 = _r0007;
    _oTexCoord = TexCoord.xy;
    _texel = vec2(float((1.00000000E+00/TextureSize).x), float((1.00000000E+00/TextureSize).y));
    _TMP3._tex_coord_1 = vec2(float((TexCoord.xy + vec2(0.00000000E+00, float(_texel.y))).x), float((TexCoord.xy + vec2(0.00000000E+00, float(_texel.y))).y));
    _TMP3._tex_coord_2 = vec2(float((TexCoord.xy + vec2(0.00000000E+00, float(-_texel.y))).x), float((TexCoord.xy + vec2(0.00000000E+00, float(-_texel.y))).y));
    _TMP3._upper_bound = vec2(float((vec2(float(_texel.x), float(_texel.y))*(OutputSize - 2.00000000E+00)).x), float((vec2(float(_texel.x), float(_texel.y))*(OutputSize - 2.00000000E+00)).y));
    _oBlurCoords1._tex_coord_1 = _TMP3._tex_coord_1;
    _oBlurCoords1._tex_coord_2 = _TMP3._tex_coord_2;
    _oBlurCoords1._lower_bound = vec2( 0.00000000E+00, 0.00000000E+00);
    _oBlurCoords1._upper_bound = _TMP3._upper_bound;
    gl_Position = _r0007;
    TEX0.xy = TexCoord.xy;
    TEX1.xy = _TMP3._tex_coord_1;
    TEX2.xy = _TMP3._tex_coord_2;
    TEX3.xy = vec2( 0.00000000E+00, 0.00000000E+00);
    TEX4.xy = _TMP3._upper_bound;
} 
#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     vec2 _upper_bound;
COMPAT_VARYING     vec2 _lower_bound;
COMPAT_VARYING     vec2 _tex_coord_2;
COMPAT_VARYING     vec2 _tex_coord_1;
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
    float _frame_count;
float _placeholder29;
};
struct pass_1 {
float _placeholder33;
};
struct blur_coords {
    vec2 _tex_coord_1;
    vec2 _tex_coord_2;
    vec2 _lower_bound;
    vec2 _upper_bound;
};
vec4 _ret_0;
vec4 _TMP7;
vec4 _TMP6;
vec4 _TMP5;
vec4 _TMP4;
vec2 _TMP8;
vec2 _TMP10;
vec2 _TMP9;
float _TMP1;
float _TMP3;
vec4 _TMP0;
pass_1 _PASS11;
input_dummy _IN2;
float _a0017;
vec4 _adjacent_texel_10019;
vec4 _adjacent_texel_20019;
vec4 _adjacent_texel_30019;
vec4 _adjacent_texel_40019;
vec3 _LCD_color0019;
vec4 _COLOR0019;
vec3 _original_color0019;
vec2 _TMP20;
vec2 _TMP26;
vec2 _c0033;
vec2 _c0035;
vec2 _c0037;
vec2 _c0039;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec4 TEX1;
COMPAT_VARYING vec4 TEX2;
COMPAT_VARYING vec4 TEX3;
COMPAT_VARYING vec4 TEX4;
 
uniform sampler2D Texture;
uniform sampler2D Pass1Texture;
uniform COMPAT_PRECISION int FrameDirection;
uniform COMPAT_PRECISION int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
    vec4 _out_color;
    float _is_on_line;
    _TMP0 = COMPAT_TEXTURE(Texture, TEX0.xy);
    _out_color = vec4(float(_TMP0.x), float(_TMP0.y), float(_TMP0.z), float(_TMP0.w));
    _a0017 = _out_color.w - 5.00000000E-01;
    _TMP3 = abs(float(_a0017));
    _TMP1 = float(_TMP3);
    _is_on_line = float((_TMP1 < 9.96093750E-02));
    _COLOR0019 = _out_color;
    _TMP9 = min(vec2(float(TEX4.x), float(TEX4.y)), vec2(float(TEX1.x), float(TEX1.y)));
    _TMP8 = vec2(float(_TMP9.x), float(_TMP9.y));
    _TMP10 = max(vec2(float(TEX3.x), float(TEX3.y)), vec2(float(_TMP8.x), float(_TMP8.y)));
    _TMP20 = vec2(float(_TMP10.x), float(_TMP10.y));
    _TMP9 = min(vec2(float(TEX4.x), float(TEX4.y)), vec2(float(TEX2.x), float(TEX2.y)));
    _TMP8 = vec2(float(_TMP9.x), float(_TMP9.y));
    _TMP10 = max(vec2(float(TEX3.x), float(TEX3.y)), vec2(float(_TMP8.x), float(_TMP8.y)));
    _TMP26 = vec2(float(_TMP10.x), float(_TMP10.y));
    _c0033 = vec2(float(_TMP20.x), float(_TMP20.y));
    _TMP4 = COMPAT_TEXTURE(Texture, _c0033);
    _adjacent_texel_10019 = vec4(float(_TMP4.x), float(_TMP4.y), float(_TMP4.z), float(_TMP4.w));
    _c0035 = vec2(float(_TMP26.x), float(_TMP26.y));
    _TMP5 = COMPAT_TEXTURE(Texture, _c0035);
    _adjacent_texel_20019 = vec4(float(_TMP5.x), float(_TMP5.y), float(_TMP5.z), float(_TMP5.w));
    _c0037 = vec2(float(_TMP20.x), float(_TMP20.y));
    _TMP6 = COMPAT_TEXTURE(Pass1Texture, _c0037);
    _adjacent_texel_30019 = vec4(float(_TMP6.x), float(_TMP6.y), float(_TMP6.z), float(_TMP6.w));
    _c0039 = vec2(float(_TMP26.x), float(_TMP26.y));
    _TMP7 = COMPAT_TEXTURE(Pass1Texture, _c0039);
    _adjacent_texel_40019 = vec4(float(_TMP7.x), float(_TMP7.y), float(_TMP7.z), float(_TMP7.w));
    _LCD_color0019 = ((_out_color.xyz - _adjacent_texel_10019.xyz) + (_out_color.xyz - _adjacent_texel_20019.xyz))*2.00195312E-01;
    _original_color0019 = ((_out_color.xyz - _adjacent_texel_30019.xyz) + (_out_color.xyz - _adjacent_texel_40019.xyz))*2.00195312E-01;
    _COLOR0019.xyz = _out_color.xyz - (_original_color0019 + _LCD_color0019);
    _out_color = _COLOR0019*_is_on_line + _out_color*float(!bool(_is_on_line));
    _ret_0 = vec4(float(_out_color.x), float(_out_color.y), float(_out_color.z), float(_out_color.w));
    FragColor = _ret_0;
    return;
} 
#endif
