1 #ifndef _MOVIT_GAMMA_COMPRESSION_EFFECT_H
2 #define _MOVIT_GAMMA_COMPRESSION_EFFECT_H 1
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.
8 // Currently supports sRGB and Rec. 601/709.
13 #include "image_format.h"
15 #define COMPRESSION_CURVE_SIZE 4096
17 class GammaCompressionEffect : public Effect {
19 // Should not be instantiated by end users.
20 GammaCompressionEffect();
21 friend class EffectChain;
24 virtual std::string effect_type_id() const { return "GammaCompressionEffect"; }
25 std::string output_fragment_shader();
27 virtual bool needs_srgb_primaries() const { return false; }
29 // Actually needs postmultiplied input as well as outputting it.
30 // EffectChain will take care of that.
31 virtual AlphaHandling alpha_handling() const { return OUTPUT_POSTMULTIPLIED_ALPHA; }
34 GammaCurve destination_curve;
35 float compression_curve[COMPRESSION_CURVE_SIZE];
38 #endif // !defined(_MOVIT_GAMMA_COMPRESSION_EFFECT_H)