Repository navigation
fix(rgbw): native topology authority for strict + boosted solvers (#2748) - #2749
Conversation
) The strict sub-gamut solver routed every input — even pure native single- channel and outer-edge (dual-channel) inputs — through the W-containing sub-gamut inverses, pulling W and unrelated channels into the output in violation of the reference math model's strict topology rules. The verifier session in #2748 showed: (R, 0, 0) -> (R, 0, 0, W>0) instead of (R, 0, 0, 0) (0, G, G) cyan -> (0, G', B', W>0) instead of (0, G, G, 0) cyan value-ramp -> SAME tuple instead of scaling linearly Add an `is_native_input_gamut()` predicate plus `count_active_channels()` in `rgbw_colorimetric.h`. In `solve_strict_subgamut` and `solve_wx_overdrive`, short-circuit 1- and 2-channel native inputs to the matching LED channels with W = 0, preserving the legal native topology set: single : R, G, B outer : RG, RB, BG (W = 0, edge-locked) triple : RGW, RBW, BGW (interior — existing sub-gamut routing applies) Three-channel (interior) inputs still flow through the sub-gamut solver where W participation is correct and intentional. Non-native input gamuts (Rec.709, Rec.2020, DCI-P3) bypass the guard so out-of-hull projection (#2708) still applies — verified by an explicit regression test using sRGB red on a wider-gamut LED panel. Reproducer tests cover: * native pure-R / G / B single-channel topology * native cyan / yellow / magenta outer-edge topology * value-ramp linearity (the cyan-collapse case from the report) * 3-channel interior inputs still hit sub-gamut routing * non-native input bypasses the guard * public-API round-trip through kRGBWColorimetric and kRGBWColorimetricBoosted dispatch Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR implements native topology authority fast-paths for the RGBW colorimetric solver to address issue ChangesNative Topology Authority Fix
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Infer (1.2.0)tests/fl/gfx/rgbw_colorimetric.cpptests/fl/gfx/rgbw_colorimetric.cpp:19:10: fatal error: 'test.h' file not found ... [truncated 2200 characters] ... line 4784, characters 10-1023 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Fixes #2748. The strict sub-gamut solver was routing every input — even pure native single-channel and outer-edge (dual-channel) inputs — through the W-containing sub-gamut inverses, pulling W and unrelated channels into the output in violation of the reference math model's strict topology rules.
The verifier session linked from the issue showed:
What changed
New header-inline helpers in
src/fl/gfx/rgbw_colorimetric.h:is_native_input_gamut(p)— detects when source primaries match the LED's native primariescount_active_channels(s_r, s_g, s_b)— LSB-eps classifiersrc/fl/gfx/rgbw_colorimetric.cpp.hpp:solve_strict_subgamutshort-circuits native 1- and 2-channel inputs to the matching LED channels with W=0solve_wx_overdrive(kRGBWColorimetricBoosted) inherits the same guard — W overdrive is not legal on edge-locked topologiesThree-channel (interior) inputs still flow through the existing sub-gamut solver where W participation is correct and intentional. Non-native input gamuts (Rec.709 / Rec.2020 / DCI-P3) bypass the guard so out-of-hull projection (#2708) still applies — covered by an explicit regression test.
Legal native topologies (per the reference math model)
Test plan
bash test rgbw_colorimetric --cpp— full TU passes (224+ new assertions)bash test --cpp— all 226 tests pass, no regressionsbash lint— cleanNew reproducer tests in
tests/fl/gfx/rgbw_colorimetric.cpp:kRGBWColorimetricandkRGBWColorimetricBoostedis_native_input_gamut/count_active_channelshelper coverage🤖 Generated with Claude Code
Summary by CodeRabbit