113 constexpr float kPrimaryEps = 1e-6f;
114 auto close = [](
const float a[2],
const float b[2])
FL_NO_EXCEPT {
115 const float dx = a[0] - b[0];
116 const float dy = a[1] - b[1];
117 return (dx * dx + dy * dy) < kPrimaryEps;
119 return close(p.input_xy_r, p.xy_r)
120 && close(p.input_xy_g, p.xy_g)
121 && close(p.input_xy_b, p.xy_b);
133 constexpr float kTopoEps = 1.0f / 65535.0f;
135 if (s_r > kTopoEps) ++n;
136 if (s_g > kTopoEps) ++n;
137 if (s_b > kTopoEps) ++n;
200 if (cool_cct == warm_cct)
return 0.5f;
201 const float t = (
static_cast<float>(target_cct) - warm_cct)
202 / (
static_cast<float>(cool_cct) - warm_cct);
237 float s_g,
float s_b,
246 const float xy_t[2],
float source_value,
273 float s_b,
float overdrive_ratio,
290 return build_lut(cache, grid_n, LutInterp::Hermite);
Shared colorimetric primitives reusable by the RGBW and (future) RGB colorimetric paths (issue #3255)...
Functions for red, green, blue, white (RGBW) output.
void solve_wx_overdrive(const ProfileCache &cache, float s_r, float s_g, float s_b, float overdrive_ratio, float out_rgbw[4]) FL_NO_EXCEPT
void solve_rgbcct(const RgbcctProfile &profile, float s_r, float s_g, float s_b, float eta, float out[5]) FL_NO_EXCEPT
constexpr int kLutStrideHermite
int count_active_channels(float s_r, float s_g, float s_b) FL_NO_EXCEPT
bool is_native_input_gamut(const DiodeProfile &p) FL_NO_EXCEPT
LutTable build_lut(const ProfileCache &cache, int grid_n, LutInterp interp) FL_NO_EXCEPT
void lookup_lut(const LutTable &lut, const float xy_t[2], float source_value, float out_rgbw[4]) FL_NO_EXCEPT
constexpr float kDefaultOverdriveRatio
bool solve_strict_subgamut_xy(const ProfileCache &cache, const float xy_t[2], float source_value, float out_rgbw[4]) FL_NO_EXCEPT
float rgbcct_eta_for_cct(int target_cct, int warm_cct, int cool_cct) FL_NO_EXCEPT
bool solve_wx_lp_legacy(const ProfileCache &cache, float s_r, float s_g, float s_b, float out_rgbw[4]) FL_NO_EXCEPT
bool solve_strict_subgamut(const ProfileCache &cache, float s_r, float s_g, float s_b, float out_rgbw[4]) FL_NO_EXCEPT
void build_profile_cache(const DiodeProfile *p, int cct_override, ProfileCache *cache) FL_NO_EXCEPT
constexpr int kLutStrideBilinear
fl::unique_ptr< i16[]> cells
const DiodeProfile * profile
EmitterProfile RgbColorimetricProfile
u8 quantize_u8(float v) FL_NO_EXCEPT
void hermite_basis(float t, float out[4]) FL_NO_EXCEPT
void matvec3(const float M[3][3], const float v[3], float out[3]) FL_NO_EXCEPT
bool invert3x3(const float in[3][3], float out[3][3]) FL_NO_EXCEPT
bool barycentric_xy(const float t[2], const float A[2], const float B[2], const float C[2], float bary[3]) FL_NO_EXCEPT
constexpr int kLutStrideBilinear
void nnls3(const float M[3][3], const float b[3], float t_out[3], float *residual_out) FL_NO_EXCEPT
bool build_source_matrix(const float xy_r[2], const float xy_g[2], const float xy_b[2], const float xy_w[2], float M_out[3][3]) FL_NO_EXCEPT
constexpr int kLutStrideHermite
void rgb_source_to_XYZ(const RgbColorimetricCache &cache, float s_r, float s_g, float s_b, float X_t[3]) FL_NO_EXCEPT
void xyY_to_XYZ(float x, float y, float Y, float out[3]) FL_NO_EXCEPT
bool solve_rgb_colorimetric(const RgbColorimetricCache &cache, float s_r, float s_g, float s_b, float out_rgb[3]) FL_NO_EXCEPT
void cct_to_xy(int cct, float out[2]) FL_NO_EXCEPT
bool build_rgb_colorimetric_cache(const EmitterProfile &p, RgbColorimetricCache *cache) FL_NO_EXCEPT
i16 quantize_lut_cell(float v) FL_NO_EXCEPT
u8 u8 fract8 blur_amount FL_NO_EXCEPT
constexpr enable_if< is_fixed_point< T >::value, T >::type clamp(T x, T lo, T hi) FL_NO_EXCEPT
Base definition for an LED controller.