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

◆ solve_rgb_colorimetric()

bool fl::colorimetric_response::solve_rgb_colorimetric ( const RgbColorimetricCache & cache,
float s_r,
float s_g,
float s_b,
float out_rgb[3] )
inline

Definition at line 537 of file colorimetric_response.h.

539 {
540 float X_t[3];
541 rgb_source_to_XYZ(cache, s_r, s_g, s_b, X_t);
542 matvec3(cache.P_RGB_inv, X_t, out_rgb);
543 out_rgb[0] = fl::max(out_rgb[0], 0.0f);
544 out_rgb[1] = fl::max(out_rgb[1], 0.0f);
545 out_rgb[2] = fl::max(out_rgb[2], 0.0f);
546 const float m = fl::max(fl::max(out_rgb[0], out_rgb[1]), out_rgb[2]);
547 if (m > 1.0f) {
548 const float inv_m = 1.0f / m;
549 out_rgb[0] *= inv_m;
550 out_rgb[1] *= inv_m;
551 out_rgb[2] *= inv_m;
552 }
553 return true;
554}
void matvec3(const float M[3][3], const float v[3], float out[3]) FL_NO_EXCEPT
void rgb_source_to_XYZ(const RgbColorimetricCache &cache, float s_r, float s_g, float s_b, float X_t[3]) FL_NO_EXCEPT
constexpr common_type_t< T, U > max(T a, U b) FL_NO_EXCEPT
Definition math.h:75

References fl::FL_NO_EXCEPT, matvec3(), fl::max(), and rgb_source_to_XYZ().

+ Here is the call graph for this function: