SUB2r

Site Tools

isp:gamma

This is an old revision of the document!

Gamma

More precisely - this is a “gamma encoding” that is originally used to correct for the old-school CRT-type monitors' x2.2 voltage correction.

Gamma encoding is calculated as a power function, where each pixel's L component (in HSL color space) is corrected.

For now we are using a simplified single-curve method which will eventually be replaced with a more sophisticated multi-point curve that would allow a user to specify a curve using up to N knee points (at which point it will no longer be proper to call this “gamma” but rather something else).

Implementation-wise there's nothing special about this (assuming L is in range [0..1] and _gamma is ≥1):

// pseudo-code
void gamma(/*array of pixels*/image, double _gamma){
for(const & pixel: image){
pixel.luma = power(pixel.luma, _gamma);
}
}