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.
13 #include "effect_chain.h"
14 #include "image_format.h"
16 #define COMPRESSION_CURVE_SIZE 4096
18 class GammaCompressionEffect : public Effect {
20 // Should not be instantiated by end users.
21 GammaCompressionEffect();
22 friend class EffectChain;
25 virtual std::string effect_type_id() const { return "GammaCompressionEffect"; }
26 std::string output_fragment_shader();
28 virtual bool needs_srgb_primaries() const { return false; }
30 // Actually needs postmultiplied input as well as outputting it.
31 // EffectChain will take care of that.
32 virtual AlphaHandling alpha_handling() const { return OUTPUT_POSTMULTIPLIED_ALPHA; }
35 GammaCurve destination_curve;
36 float compression_curve[COMPRESSION_CURVE_SIZE];
39 #endif // !defined(_GAMMA_COMPRESSION_EFFECT_H)