MCPcopy Create free account
hub / github.com/FastLED/FastLED / eval

Function eval

src/fl/gfx/gamma_lut.h:174–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172// Computes: clamp(round(pow(x/255, gamma) * 255), 0, 255)
173
174constexpr u8 eval(u8 x, u32 gamma_raw) FL_NOEXCEPT {
175 return x == 0 ? static_cast<u8>(0)
176 : x == 255 ? static_cast<u8>(255)
177 : static_cast<u8>(
178 (pow_fp(
179 static_cast<u32>((static_cast<u64>(x) << FRAC) / 255),
180 gamma_raw
181 ) * 255ULL + (SCALE >> 1)) >> FRAC
182 );
183}
184
185// ---- 16-bit gamma correction for a single pixel value ----
186// Computes: clamp(round(pow(x/255, gamma) * 65535), 0, 65535)

Callers 3

operator()Method · 0.85
FL_TEST_FILEFunction · 0.85

Calls 1

pow_fpFunction · 0.85

Tested by

no test coverage detected