FastLED 3.10.6
Loading...
Searching...
No Matches

◆ gamutDrivesAreInRange()

bool fl::anonymous_namespace{gamut_map.cpp.hpp}::gamutDrivesAreInRange ( const i32(&) drives[3],
i32 slack )

True when every drive is inside [0, 1], allowing slack ULP either side.

Named for this file because .cpp.hpp files share a translation unit under the unity build, so an anonymous namespace does not isolate it.

Both bounds matter. Checking only the lower one accepts a target that needs drives above full scale – too bright rather than too saturated – which no device can produce, and the mapper would then hand it back unchanged.

The slack is a parameter rather than a constant because the two callers want different things. The entry check wants it, so a colour the device reproduces exactly is not compressed over a few ULP of rounding. The halving loop must not have it: a candidate accepted while a drive sits slightly negative gets that drive clamped to zero afterwards, and since this profile's blue emitter carries a Z near 13, even 64 ULP of blue is enough to visibly rotate the hue – which is the one thing the mapper exists to preserve. Measured at 1.5 degrees on a near-boundary target before the loop was made strict.

Definition at line 77 of file gamut_map.cpp.hpp.

77 {
78 for (int i = 0; i < 3; ++i) {
79 if (drives[i] < -slack || drives[i] > kGamutFullDrive + slack) {
80 return false;
81 }
82 }
83 return true;
84}
constexpr i32 kGamutFullDrive
Full drive, as an s16.16 raw value.

References fl::FL_NO_EXCEPT, gamutDrivesAreInRange(), and kGamutFullDrive.

Referenced by gamutDrivesAreInRange(), and fl::anonymous_namespace{gamut_map.cpp.hpp}::RgbFeasible::operator()().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: