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

◆ largestFeasibleChroma()

template<typename Feasible>
i32 fl::anonymous_namespace{gamut_map.cpp.hpp}::largestFeasibleChroma ( const i32(&) lab[3],
i32 lightness,
Feasible feasible )

Largest chroma factor the hull accepts, by a fixed count of halvings.

Shared by both mappers so the search cannot drift between them; only the feasibility predicate differs. low is the largest factor known to be feasible, high the smallest known not to be.

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

157 {
158 i32 low = 0;
159 i32 high = kGamutFullDrive;
160 for (int step = 0; step < kGamutMapHalvings; ++step) {
161 const i32 factor = (low + high) >> 1;
162 i32 candidate_xyz[3];
163 chromaCandidateXyz(lab, lightness, factor, candidate_xyz);
164 if (feasible(candidate_xyz)) {
165 low = factor;
166 } else {
167 high = factor;
168 }
169 }
170 return low;
171}
constexpr i32 kGamutFullDrive
Full drive, as an s16.16 raw value.
void chromaCandidateXyz(const i32(&lab)[3], i32 lightness, i32 factor, i32(&out_xyz)[3]) FL_NO_EXCEPT
XYZ of the candidate at factor of the target's chroma.
constexpr int kGamutMapHalvings
Number of chroma halvings the mapper runs, fixed at compile time.
Definition gamut_map.h:40
constexpr enable_if< is_fixed_point< T >::value, T >::type step(T edge, T x) FL_NO_EXCEPT

References chromaCandidateXyz(), fl::FL_NO_EXCEPT, kGamutFullDrive, fl::kGamutMapHalvings, largestFeasibleChroma(), and fl::step().

Referenced by largestFeasibleChroma().

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