Repository navigation
Description
Summary
#2705 added a source-RGB → LED-XYZ transform to the colorimetric solvers, with kRgbwDefaultProfile.input_xy_* defaulting to Rec709/sRGB primaries + D65. That choice is wrong for the typical FastLED use case: it silently clips inputs to the sRGB sub-volume of the LED's native gamut, leaving most of the chromatic range the user paid for unreachable.
The default should be "native LED gamut + D65 white" — input primaries equal the LED's measured primaries, target white stays D65 (or user-supplied). Standard color-space input (Rec709, Rec2020, DCI-P3 D65, DCI-P3 D60) is a real use case for ambilight-style apps and video bridges, but it should be opt-in via an API the user explicitly invokes — not the silent default.
Concrete impact
For an SK6812-class RGBW strip with LED red at xy(0.7006, 0.2993) and the current Rec709 input default:
RGB = (255, 0, 0)→ solver targets sRGB red at xy(0.640, 0.330) → LED red diode drives to ~70 % of its capability; the remaining ~30 % of saturation is unreachable via the public API.- User has no indication this is happening; they expect FastLED to drive their LEDs at full saturation as it always has.
For the user already explicitly using a content workflow (Rec709 sRGB → ambilight, etc.), they currently get the right answer by accident. After this fix they'll need one explicit call to opt in — a small UX cost that's worth it to fix the silent gamut truncation for everyone else.
Proposed change
Default: native input gamut
kRgbwDefaultProfile.input_xy_r/g/b defaults to the same chromaticities as xy_r/g/b (the LED primaries). input_xy_w stays at D65 so neutral inputs land on a standard daylight white. With these defaults:
RGB = (255, 0, 0)→ LED red full-driveRGB = (255, 255, 255)→ D65-balanced output (mostly W with small RGB residuals)- Pure primaries hit the full LED gamut
- Out-of-hull projection from bug(rgbw): out-of-hull source colors return (0,0,0,0) — missing NNLS projection (gist §3) #2708 still works for the rare case of saturated edges
Opt-in: named color spaces
Add a small API for users who explicitly want named-gamut input semantics:
namespace fl {
enum class InputGamut : u8 {
Native, // Input primaries == LED primaries (default)
Rec709, // sRGB / Rec.709 + D65
Rec2020, // Rec.2020 + D65
DciP3D65, // DCI-P3 with D65 white (consumer displays)
DciP3D60, // DCI-P3 with ACES D60 white (cinema mastering)
};
// Reconfigure `profile`'s input_xy_* fields for one of the named gamuts.
// For Native, copies the profile's own xy_r/g/b into input_xy_r/g/b and
// keeps input_xy_w at D65 (or the supplied override).
void set_input_gamut(DiodeProfile* profile, InputGamut g) noexcept;
void set_input_gamut(DiodeProfile* profile, InputGamut g,
const float input_white_xy[2]) noexcept;
}Users who want sRGB content workflows write one line at setup:
fl::set_input_gamut(&my_profile, fl::InputGamut::Rec709);Update tests
- Default-profile test in
tests/fl/gfx/rgbw_colorimetric.cppasserting Rec709/sRGB values needs to flip to assert input_xy_* == LED xy_*. - Ground-truth reference port already uses an explicit
reference_profile()that sets sRGB — should be relabeled / kept as the "Rec709 input gamut" comparison. - Add tests for
set_input_gamutcovering each named gamut.
References
- Implementing PR fix(rgbw): source RGB color space + differentiated boosted solver + Hermite LUT #2707 (source space added with sRGB default)
- Follow-up PR fix(rgbw): NNLS out-of-hull projection (#2708) + in-test ground truth #2709 (NNLS hull projection for out-of-hull)
- Parent issue feat(rgbw): sub-gamut white-extraction algorithm for chromaticity-accurate RGBW output #2545 (math model)
- Math model gist primary list: https://gist.github.com/JChalka/cebc5a018066cae05d98cf9088c3b3b9 (see
_NAMED_GAMUTSfor the reference's naming + EOTF table)
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
docs(cpp): drop grandfathered allowlist; require wrapper for all glob…
docs(cpp): wrap fl::set_input_gamut on CFastLED per Public Settings P…
fix(rgbw): default source = native LED gamut + D65; named-gamut opt-in (
docs(cpp): drop grandfathered allowlist; require wrapper for all glob…
docs(cpp): enforce Public Settings Pattern for global setters (#2715)