]> git.sesse.net Git - movit/blob - gamma_compression_effect.h
Fix an issue where we could take an FBO off a freelist but not properly clean fbo_for...
[movit] / gamma_compression_effect.h
1 #ifndef _MOVIT_GAMMA_COMPRESSION_EFFECT_H 
2 #define _MOVIT_GAMMA_COMPRESSION_EFFECT_H 1
3
4 // An effect to convert linear light to the given gamma curve,
5 // typically inserted by the framework automatically at the end
6 // of the processing chain.
7 //
8 // Currently supports sRGB, Rec. 601/709 and Rec. 2020 (10- and 12-bit).
9 // Note that Movit's internal formats generally do not have enough accuracy
10 // for 12-bit input or output.
11
12 #include <epoxy/gl.h>
13 #include <string>
14
15 #include "effect.h"
16 #include "image_format.h"
17
18 namespace movit {
19
20 class GammaCompressionEffect : public Effect {
21 private:
22         // Should not be instantiated by end users.
23         GammaCompressionEffect();
24         friend class EffectChain;
25
26 public:
27         virtual std::string effect_type_id() const { return "GammaCompressionEffect"; }
28         std::string output_fragment_shader();
29         virtual void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
30
31         virtual bool needs_srgb_primaries() const { return false; }
32
33         // Actually needs postmultiplied input as well as outputting it.
34         // EffectChain will take care of that.
35         virtual AlphaHandling alpha_handling() const { return OUTPUT_POSTMULTIPLIED_ALPHA; }
36
37 private:
38         GammaCurve destination_curve;
39 };
40
41 }  // namespace movit
42
43 #endif // !defined(_MOVIT_GAMMA_COMPRESSION_EFFECT_H)