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

◆ buildRgbSolveMatrixQ16()

bool fl::buildRgbSolveMatrixQ16 ( const colorimetric_response::EmitterProfile & profile,
EmitterSolveMatrixQ16 * out )

Invert the emitter matrix for a three-emitter profile.

The profile stores float; its fields are converted by their bits (q16FromFloatBits) and the build is buildRgbSolveMatrixFromQ16, so this links no float runtime either (FastLED#4458).

False when the emitter chromaticities are non-finite, degenerate, or collinear, any of which makes the matrix singular and the solve meaningless.

Definition at line 355 of file device_solve.cpp.hpp.

356 {
357 if (out == nullptr) {
358 return false;
359 }
360 // The profile stores float; its fields come across by their bits, and
361 // the whole derivation runs in s16.16 (FastLED#4458). The Q16 build
362 // refuses what the float one did: a non-positive or out-of-simplex
363 // chromaticity, a non-positive luminance, a singular matrix -- and NaN,
364 // infinity or an out-of-range value never gets past the conversion.
365 EmitterChromaticitiesQ16 q16;
366 if (!q16FromFloatBits(profile.xy_r[0], &q16.xy_r[0]) ||
367 !q16FromFloatBits(profile.xy_r[1], &q16.xy_r[1]) ||
368 !q16FromFloatBits(profile.xy_g[0], &q16.xy_g[0]) ||
369 !q16FromFloatBits(profile.xy_g[1], &q16.xy_g[1]) ||
370 !q16FromFloatBits(profile.xy_b[0], &q16.xy_b[0]) ||
371 !q16FromFloatBits(profile.xy_b[1], &q16.xy_b[1]) ||
372 !q16FromFloatBits(profile.lum_r, &q16.lum_r) ||
373 !q16FromFloatBits(profile.lum_g, &q16.lum_g) ||
374 !q16FromFloatBits(profile.lum_b, &q16.lum_b)) {
375 return false;
376 }
377 return buildRgbSolveMatrixFromQ16(q16, out);
378}
bool buildRgbSolveMatrixFromQ16(const EmitterChromaticitiesQ16 &profile, EmitterSolveMatrixQ16 *out) FL_NO_EXCEPT
Build the inverse emitter matrix from a Q16 profile, without floats.
bool q16FromFloatBits(float value, i32 *out) FL_NO_EXCEPT
s16.16 of a float, rounded to nearest, computed from its IEEE-754 bits with integer arithmetic only –...

References buildRgbSolveMatrixFromQ16(), FL_NO_EXCEPT, and q16FromFloatBits().

Referenced by buildGamutMapQ16(), buildGamutMapRgbwQ16(), buildGamutMapRgbwwQ16(), buildStreamingPipelineQ16(), buildTwoWhiteAllocationQ16(), and buildWhiteAllocationQ16().

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