]> git.sesse.net Git - movit/blobdiff - deconvolution_sharpen_effect.h
Makefile should now be in .gitignore.
[movit] / deconvolution_sharpen_effect.h
index bc0bbd48ee8e07e896624d08b7deb1a41ce0ea69..80553adf0aecb5557cbbc85d30698fba40998f8b 100644 (file)
 //
 //   Jain, Anil K.: “Fundamentals of Digital Image Processing”, Prentice Hall, 1988.
 
+#include <GL/glew.h>
+#include <Eigen/Dense>
+#include <string>
+
 #include "effect.h"
 
 class DeconvolutionSharpenEffect : public Effect {
@@ -27,6 +31,9 @@ public:
        virtual std::string effect_type_id() const { return "DeconvolutionSharpenEffect"; }
        std::string output_fragment_shader();
 
+       // Samples a lot of times from its input.
+       virtual bool needs_texture_bounce() const { return true; }
+
        virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height)
        {
                this->width = width;
@@ -34,6 +41,7 @@ public:
        }
 
        void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
+       virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
 
 private:
        // Input size.
@@ -51,6 +59,13 @@ private:
        // (ie., blur is assumed to be a 2px circle), correlation = 0.95, and noise = 0.01.
        // Note that once the radius starts going too far past R, you will get nonsensical results.
        float circle_radius, gaussian_radius, correlation, noise;
+
+       // The deconvolution kernel, and the parameters last time we did an update.
+       Eigen::MatrixXf g;
+       int last_R;
+       float last_circle_radius, last_gaussian_radius, last_correlation, last_noise;
+       
+       void update_deconvolution_kernel();
 };
 
 #endif // !defined(_DECONVOLUTION_SHARPEN_EFFECT_H)