Skip to content

bug(rgbw): default source = Rec709/sRGB silently truncates LED gamut — switch default to native LED primaries + D65 #2710

Closed

Description

@zackees

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:

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.cpp asserting 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_gamut covering each named gamut.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions