X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=dither_effect.h;h=921a1ef5e1130ca6184e401fe06e8b267b4c67e2;hp=cad6488921b67c5f60a3a1ac17fb97dec440b474;hb=f216b7bef5a968c89f6fc78e83cc26a91e504a8a;hpb=38dfb378427d1c97113ad7644c39f7695be84c49 diff --git a/dither_effect.h b/dither_effect.h index cad6488..921a1ef 100644 --- a/dither_effect.h +++ b/dither_effect.h @@ -1,5 +1,5 @@ -#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. // @@ -43,8 +43,13 @@ // like many LCD monitors do, but it starts to get very hairy, again, for limited gains.) // The dither is also deterministic across runs. +#include +#include + #include "effect.h" +namespace movit { + class DitherEffect : public Effect { private: // Should not be instantiated by end users; @@ -61,6 +66,7 @@ public: // 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); @@ -72,7 +78,11 @@ private: 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)