// Path: videffects/src/main/java/com/sherazkhilji/videffects/Constants.java
// public final class Constants {
// 
//     public static final int FLOAT_SIZE_BYTES = 4;
// 
//     public static final String DEFAULT_VERTEX_SHADER = "uniform mat4 uMVPMatrix;\n"
//             + "uniform mat4 uSTMatrix;\n"
//             + "attribute vec4 aPosition;\n"
//             + "attribute vec4 aTextureCoord;\n"
//             + "varying vec2 vTextureCoord;\n"
//             + "void main() {\n"
//             + "  gl_Position = uMVPMatrix * aPosition;\n"
//             + "  vTextureCoord = (uSTMatrix * aTextureCoord).xy;\n"
//             + "}\n";
// }
// 
// Path: videffects/src/main/java/com/sherazkhilji/videffects/interfaces/Filter.java
// public interface Filter {
// 
// 	public String getVertexShader();
// 
// 	public String getFragmentShader();
// 
// 	public void setIntensity(float intensity);
// }


import android.os.Parcel;
import com.sherazkhilji.videffects.Constants;
import com.sherazkhilji.videffects.interfaces.Filter;
import java.util.Locale;
import java.util.concurrent.ThreadLocalRandom;
                + "}\n"
                + "void main() {\n"
                + "  seed[0] = %f;\n"
                + "  seed[1] = %f;\n"
                + "  scale = %f;\n"
                + "  stepX = " + 0.5f / width + ";\n"
                + "  stepY = " + 0.5f / height + ";\n"
                + "  float noise = texture2D(tex_sampler_1, vTextureCoord + vec2(-stepX, -stepY)).r * 0.224;\n"
                + "  noise += texture2D(tex_sampler_1, vTextureCoord + vec2(-stepX, stepY)).r * 0.224;\n"
                + "  noise += texture2D(tex_sampler_1, vTextureCoord + vec2(stepX, -stepY)).r * 0.224;\n"
                + "  noise += texture2D(tex_sampler_1, vTextureCoord + vec2(stepX, stepY)).r * 0.224;\n"
                + "  noise += 0.4448;\n"
                + "  noise *= scale;\n"
                + "  vec4 color = texture2D(tex_sampler_0, vTextureCoord);\n"
                + "  float energy = 0.33333 * color.r + 0.33333 * color.g + 0.33333 * color.b;\n"
                + "  float mask = (1.0 - sqrt(energy));\n"
                + "  float weight = 1.0 - 1.333 * mask * noise;\n"
                + "  gl_FragColor = vec4(color.rgb * weight, color.a);\n"
                + "  gl_FragColor = gl_FragColor+vec4(rand(vTextureCoord + seed), rand(vTextureCoord + seed),rand(vTextureCoord + seed),1);\n"
                + "}\n";

    }

    @Override
    public void setIntensity(float intensity) {
        this.intensity = intensity;
    }

    @Override
    public String getVertexShader() {
// Path: videffects/src/main/java/com/sherazkhilji/videffects/Constants.java
// public final class Constants {
// 
//     public static final int FLOAT_SIZE_BYTES = 4;
// 
//     public static final String DEFAULT_VERTEX_SHADER = "uniform mat4 uMVPMatrix;\n"
//             + "uniform mat4 uSTMatrix;\n"
//             + "attribute vec4 aPosition;\n"
//             + "attribute vec4 aTextureCoord;\n"
//             + "varying vec2 vTextureCoord;\n"
//             + "void main() {\n"
//             + "  gl_Position = uMVPMatrix * aPosition;\n"
//             + "  vTextureCoord = (uSTMatrix * aTextureCoord).xy;\n"
//             + "}\n";
// }
// 
// Path: videffects/src/main/java/com/sherazkhilji/videffects/interfaces/Filter.java
// public interface Filter {
// 
// 	public String getVertexShader();
// 
// 	public String getFragmentShader();
// 
// 	public void setIntensity(float intensity);
// }


// Path: videffects/src/main/java/com/sherazkhilji/videffects/filter/GrainFilter.java
import android.os.Parcel;
import com.sherazkhilji.videffects.Constants;
import com.sherazkhilji.videffects.interfaces.Filter;
import java.util.Locale;
import java.util.concurrent.ThreadLocalRandom;

                + "}\n"
                + "void main() {\n"
                + "  seed[0] = %f;\n"
                + "  seed[1] = %f;\n"
                + "  scale = %f;\n"
                + "  stepX = " + 0.5f / width + ";\n"
                + "  stepY = " + 0.5f / height + ";\n"
                + "  float noise = texture2D(tex_sampler_1, vTextureCoord + vec2(-stepX, -stepY)).r * 0.224;\n"
                + "  noise += texture2D(tex_sampler_1, vTextureCoord + vec2(-stepX, stepY)).r * 0.224;\n"
                + "  noise += texture2D(tex_sampler_1, vTextureCoord + vec2(stepX, -stepY)).r * 0.224;\n"
                + "  noise += texture2D(tex_sampler_1, vTextureCoord + vec2(stepX, stepY)).r * 0.224;\n"
                + "  noise += 0.4448;\n"
                + "  noise *= scale;\n"
                + "  vec4 color = texture2D(tex_sampler_0, vTextureCoord);\n"
                + "  float energy = 0.33333 * color.r + 0.33333 * color.g + 0.33333 * color.b;\n"
                + "  float mask = (1.0 - sqrt(energy));\n"
                + "  float weight = 1.0 - 1.333 * mask * noise;\n"
                + "  gl_FragColor = vec4(color.rgb * weight, color.a);\n"
                + "  gl_FragColor = gl_FragColor+vec4(rand(vTextureCoord + seed), rand(vTextureCoord + seed),rand(vTextureCoord + seed),1);\n"
                + "}\n";

    }

    @Override
    public void setIntensity(float intensity) {
        this.intensity = intensity;
    }

    @Override
    public String getVertexShader() {
        return Constants.DEFAULT_VERTEX_SHADER;