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

Function solve_rgbcct

src/fl/gfx/rgbw_colorimetric.cpp.hpp:1042–1070  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1040}
1041
1042void solve_rgbcct(const RgbcctProfile& profile, float s_r, float s_g,
1043 float s_b, float eta, float out[5]) FL_NOEXCEPT {
1044 ProfileCache warm_cache;
1045 ProfileCache cool_cache;
1046 build_profile_cache(&profile.warm_path, 0, &warm_cache);
1047 build_profile_cache(&profile.cool_path, 0, &cool_cache);
1048
1049 float warm_rgbw[4] = {0};
1050 float cool_rgbw[4] = {0};
1051 solve_strict_subgamut(warm_cache, s_r, s_g, s_b, warm_rgbw);
1052 solve_strict_subgamut(cool_cache, s_r, s_g, s_b, cool_rgbw);
1053
1054 eta = fl::clamp(eta, 0.0f, 1.0f);
1055 const float w_warm = 1.0f - eta;
1056 const float w_cool = eta;
1057
1058 out[0] = w_warm * warm_rgbw[0] + w_cool * cool_rgbw[0];
1059 out[1] = w_warm * warm_rgbw[1] + w_cool * cool_rgbw[1];
1060 out[2] = w_warm * warm_rgbw[2] + w_cool * cool_rgbw[2];
1061 out[3] = w_warm * warm_rgbw[3];
1062 out[4] = w_cool * cool_rgbw[3];
1063
1064 const float m = fl::max(
1065 fl::max(fl::max(out[0], out[1]), fl::max(out[2], out[3])), out[4]);
1066 if (m > 1.0f) {
1067 const float inv_m = 1.0f / m;
1068 for (int k = 0; k < 5; ++k) out[k] *= inv_m;
1069 }
1070}
1071
1072} // namespace colorimetric_detail
1073} // namespace fl

Callers 2

rgb_2_rgbww_colorimetricFunction · 0.85

Calls 4

solve_strict_subgamutFunction · 0.85
clampFunction · 0.85
maxFunction · 0.85
build_profile_cacheFunction · 0.70

Tested by

no test coverage detected