1 #ifndef _GAMMA_COMPRESSION_EFFECT_H
2 #define _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.
11 #include "effect_chain.h"
13 #define COMPRESSION_CURVE_SIZE 4096
15 class GammaCompressionEffect : public Effect {
17 // Should not be instantiated by end users.
18 GammaCompressionEffect();
19 friend class EffectChain;
22 virtual std::string effect_type_id() const { return "GammaCompressionEffect"; }
23 std::string output_fragment_shader();
25 virtual bool needs_srgb_primaries() const { return false; }
27 // Actually needs postmultiplied input as well as outputting it.
28 // EffectChain will take care of that.
29 virtual AlphaHandling alpha_handling() const { return OUTPUT_ALPHA_POSTMULTIPLIED; }
32 GammaCurve destination_curve;
33 float compression_curve[COMPRESSION_CURVE_SIZE];
36 #endif // !defined(_GAMMA_COMPRESSION_EFFECT_H)