TinyGPU
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
GammaTable Class Reference

Precomputed 8-bit gamma correction lookup table. More...

#include <GammaTable.h>

Public Member Functions

 GammaTable ()
 
 GammaTable (float gamma)
 
void setGamma (float gamma)
 
float gamma () const
 
uint8_t apply (uint8_t value) const
 

Protected Attributes

float gamma_ = 1.0f
 
uint8_t table_ [256]
 

Detailed Description

Precomputed 8-bit gamma correction lookup table.

Applies out = pow(in / 255, gamma) * 255 to a channel value. This compensates for a display's non-linear brightness response - on some cheap panels, near-black tones show a visible color tint because tiny per-channel differences (e.g. R=33 vs B=32) get amplified into a visible hue by the panel's own response curve, even though the exact same values render correctly at higher, well-saturated brightness.

There's no single correct gamma value for an unknown/undocumented panel - try values on both sides of 1.0 and compare on real hardware: gamma < 1.0 lifts (brightens) dark input values before they reach the panel; gamma > 1.0 compresses them further. 1.0 (the default) applies no correction.

Constructor & Destructor Documentation

◆ GammaTable() [1/2]

GammaTable ( )
inline

◆ GammaTable() [2/2]

GammaTable ( float  gamma)
inlineexplicit

Member Function Documentation

◆ apply()

uint8_t apply ( uint8_t  value) const
inline

◆ gamma()

float gamma ( ) const
inline

◆ setGamma()

void setGamma ( float  gamma)
inline

Member Data Documentation

◆ gamma_

float gamma_ = 1.0f
protected

◆ table_

uint8_t table_[256]
protected

The documentation for this class was generated from the following file: