// 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 _color;
struct output_dummy {
    vec4 _color;
};
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
};
vec4 _oPosition1;
vec4 _r0006;
vec4 _v0006;
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 TEX0;
 
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 _otexCoord;
    _v0006 = vec4(VertexCoord.x, VertexCoord.y, 0.00000000E+00, 1.00000000E+00);
    _r0006 = _v0006.x*MVPMatrix[0];
    _r0006 = _r0006 + _v0006.y*MVPMatrix[1];
    _r0006 = _r0006 + _v0006.z*MVPMatrix[2];
    _r0006 = _r0006 + _v0006.w*MVPMatrix[3];
    _oPosition1 = _r0006;
    _otexCoord = TexCoord.xy;
    gl_Position = _r0006;
    TEX0.xy = TexCoord.xy;
} 
#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 _color;
struct output_dummy {
    vec4 _color;
};
struct input_dummy {
    vec2 _video_size;
    vec2 _texture_size;
    vec2 _output_dummy_size;
};
vec4 _ret_0;
vec4 _TMP10;
vec4 _TMP9;
float _TMP8;
float _TMP7;
vec4 _TMP6;
vec4 _TMP5;
float _TMP4;
float _TMP3;
float _TMP11;
vec4 _TMP2;
vec4 _TMP1;
vec4 _TMP0;
uniform sampler2D Texture;
input_dummy _IN1;
vec2 _c0018;
vec2 _c0020;
float _x0026;
float _TMP27;
vec2 _c0036;
vec4 _a0038;
vec2 _c0044;
vec3 _t0046;
COMPAT_VARYING vec4 TEX0;
 
uniform int FrameDirection;
uniform int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
    vec2 _uv;
    vec2 _uv_shift;
    vec3 _dither_v_zone;
    vec3 _safe_zone;
    vec3 _blur_h;
    vec3 _finalcolor;
    _uv = TEX0.xy - (1.00000000E+00/TextureSize)*2.50000000E-01;
    _uv_shift = 1.00000000E+00/TextureSize;
    _TMP0 = COMPAT_TEXTURE(Texture, _uv);
    _c0018 = _uv + vec2(_uv_shift.x, 0.00000000E+00);
    _TMP1 = COMPAT_TEXTURE(Texture, _c0018);
    _c0020 = _uv - vec2(_uv_shift.x, 0.00000000E+00);
    _TMP2 = COMPAT_TEXTURE(Texture, _c0020);
    _dither_v_zone = vec3(float((_TMP1.x == _TMP2.x)), float((_TMP1.y == _TMP2.y)), float((_TMP1.z == _TMP2.z)));
    _TMP3 = dot(_dither_v_zone, vec3( 3.33330005E-01, 3.33330005E-01, 3.33330005E-01));
    _x0026 = (_TMP3 - 2.00000003E-01)/8.00000012E-01;
    _TMP11 = min(1.00000000E+00, _x0026);
    _TMP27 = max(0.00000000E+00, _TMP11);
    _TMP4 = _TMP27*_TMP27*(3.00000000E+00 - 2.00000000E+00*_TMP27);
    _TMP5 = COMPAT_TEXTURE(Texture, _uv);
    _c0036 = _uv - vec2(_uv_shift.x, 0.00000000E+00);
    _TMP6 = COMPAT_TEXTURE(Texture, _c0036);
    _a0038 = _TMP5 - _TMP6;
    _TMP7 = dot(_a0038, vec4( 3.33299994E-01, 3.33299994E-01, 3.33299994E-01, 3.33299994E-01));
    _TMP8 = abs(_TMP7);
    _safe_zone = vec3(float((_TMP8 < 4.49999988E-01)), float((_TMP8 < 4.49999988E-01)), float((_TMP8 < 4.49999988E-01)));
    _TMP9 = COMPAT_TEXTURE(Texture, _uv);
    _c0044 = _uv - vec2(_uv_shift.x, 0.00000000E+00);
    _TMP10 = COMPAT_TEXTURE(Texture, _c0044);
    _blur_h = (_TMP9.xyz + _TMP10.xyz)*5.00000000E-01;
    _t0046 = vec3(_TMP4, _TMP4, _TMP4)*_safe_zone;
    _finalcolor = _TMP0.xyz + _t0046*(_blur_h - _TMP0.xyz);
    _ret_0 = vec4(_finalcolor.x, _finalcolor.y, _finalcolor.z, 1.00000000E+00);
    FragColor = _ret_0;
    return;
} 
#endif
