#ifndef _BLUR_EFFECT_H
#define _BLUR_EFFECT_H 1
+// A separable 2D blur implemented by a combination of mipmap filtering
+// and convolution (essentially giving a convolution with a piecewise linear
+// approximation to the true impulse response).
+//
+// Works in two passes; first horizontal, then vertical (BlurEffect,
+// which is what the user is intended to use, instantiates two copies of
+// SingleBlurPassEffect behind the scenes).
+
#include "effect.h"
class SingleBlurPassEffect;
#ifndef _COLORSPACE_CONVERSION_EFFECT_H
#define _COLORSPACE_CONVERSION_EFFECT_H 1
+// An effect to convert between different color spaces.
+// Can convert freely between sRGB/Rec. 709 and the two different Rec. 601
+// color spaces (which thankfully have the same white point).
+//
+// We don't do any fancy gamut mapping or similar; colors that are out-of-gamut
+// will simply stay out-of-gamut, and probably clip in the output stage.
+
#include "effect.h"
#include "effect_chain.h"
#ifndef _GAMMA_COMPRESSION_EFFECT_H
#define _GAMMA_COMPRESSION_EFFECT_H 1
+// An effect to convert linear light to the given gamma curve,
+// typically inserted by the framework automatically at the end
+// of the processing chain.
+//
+// Currently supports sRGB and Rec. 601/709.
+
#include "effect.h"
#include "effect_chain.h"
#ifndef _GAMMA_EXPANSION_EFFECT_H
#define _GAMMA_EXPANSION_EFFECT_H 1
+// An effect to convert the given gamma curve into linear light,
+// typically inserted by the framework automatically at the beginning
+// of the processing chain.
+//
+// Currently supports sRGB and Rec. 601/709.
+
#include "effect.h"
#include "effect_chain.h"
-// Standard lift/gamma/gain color correction tools.
-//
-// We do lift in a nonlinear (gamma-2.2) space since that looks a lot better
-// than in linear (blacks stay a lot closer to black). The two others don't
-// really care; they are (sans some constants) commutative with the x^2.2
-// operation.
-
// These are calculated in the host code to save some arithmetic.
uniform vec3 PREFIX(gain_pow_inv_gamma); // gain^(1/gamma).
uniform vec3 PREFIX(inv_gamma_22); // 2.2 / gamma.
#ifndef _LIFT_GAMMA_GAIN_EFFECT_H
#define _LIFT_GAMMA_GAIN_EFFECT_H 1
+// A simple lift/gamma/gain effect, used for color grading.
+//
+// Very roughly speaking, lift=shadows, gamma=midtones and gain=highlights,
+// although all parameters affect the entire curve. Mathematically speaking,
+// it is a bit unusual to look at gamma as a color, but it works pretty well
+// in practice.
+//
+// The classic formula is: output = (gain * (x + lift * (1-x)))^(1/gamma).
+//
+// The lift is actually a case where we actually would _not_ want linear light;
+// since black by definition becomes equal to the lift color, we want lift to
+// be pretty close to black, but in linear light that means lift affects the
+// rest of the curve relatively little. Thus, we actually convert to gamma 2.2
+// before lift, and then back again afterwards. (Gain and gamma are,
+// up to constants, commutative with the de-gamma operation.)
+
#include "effect.h"
class LiftGammaGainEffect : public Effect {
#ifndef _MIRROR_EFFECT_H
#define _MIRROR_EFFECT_H 1
+// A simple horizontal mirroring.
+
#include "effect.h"
class MirrorEffect : public Effect {
#ifndef _SATURATION_EFFECT_H
#define _SATURATION_EFFECT_H 1
+// A simple desaturation/saturation effect. We use the Rec. 709
+// definition of luminance (in linear light, of course) and linearly
+// interpolate between that (saturation=0) and the original signal
+// (saturation=1). Extrapolating that curve further (ie., saturation > 1)
+// gives us increased saturation if so desired.
+
#include "effect.h"
class SaturationEffect : public Effect {
#ifndef _VIGNETTE_EFFECT_H
#define _VIGNETTE_EFFECT_H 1
+// A circular vignette, falling off as cosĀ² of the distance from the center
+// (the classic formula for approximating a real lens).
+
#include "effect.h"
class VignetteEffect : public Effect {