-#ifndef _DITHER_EFFECT_H
-#define _DITHER_EFFECT_H 1
+#ifndef _MOVIT_DITHER_EFFECT_H
+#define _MOVIT_DITHER_EFFECT_H 1
// Implements simple rectangular-PDF dither.
//
// like many LCD monitors do, but it starts to get very hairy, again, for limited gains.)
// The dither is also deterministic across runs.
+#include <epoxy/gl.h>
+#include <string>
+
#include "effect.h"
+namespace movit {
+
class DitherEffect : public Effect {
-public:
+private:
+ // Should not be instantiated by end users;
+ // call EffectChain::set_dither_bits() instead.
DitherEffect();
+ friend class EffectChain;
+
+public:
~DitherEffect();
virtual std::string effect_type_id() const { return "DitherEffect"; }
std::string output_fragment_shader();
// premultiplied error. However, we need to do dithering in the same
// space as quantization, whether that be pre- or postmultiply.
virtual AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; }
+ virtual bool one_to_one_sampling() const { return true; }
void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
int texture_width, texture_height;
GLuint texnum;
- bool need_texture_update;
+ float uniform_round_fac, uniform_inv_round_fac;
+ float uniform_tc_scale[2];
+ GLint uniform_dither_tex;
};
-#endif // !defined(_DITHER_EFFECT_H)
+} // namespace movit
+
+#endif // !defined(_MOVIT_DITHER_EFFECT_H)