Repository navigation
fix(rgbw_colorimetric) Fix dual-channel Y ratio solving, Fix 3-channel solve granularity issues, re-implement legacy_lp solver - #2752
Conversation
…hority & 3-channel linearity This patch restores the reference math-model structure while preserving the analytical FastLED runtime path. It separates native single-axis identity from native dual-edge authority, solves dual edges as fixed-topology measured-XYZ solves instead of passthrough, applies chroma/value separation for strict interior solves, and restores wx_lp_legacy as a chromaticity-preserving max-feasible-W solver separate from boosted overdrive. This PR does not aim to be entirely performant and analysis should be done to see if things could be improved to decrease actual compute time.
|
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 (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughRefactors the RGBW colorimetric solver: profile-aware source-space M_src scaling, new numeric/solver primitives for strict hull routing, native-topology fast-paths for 1–2 emitters, a bounded LP-style wx_lp_legacy solver, and adjustments to wx_overdrive RGBW construction. ChangesRGBW Colorimetric Solver Refactoring
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 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 unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/fl/gfx/rgbw_colorimetric.cpp.hpp`:
- Around line 240-246: Zero any channel <= topology epsilon before taking native
paths: update native_single_identity to test s_r, s_g, s_b against the topology
threshold used by count_active_channels() (1/65535) and set out[i]=0.0f for any
sub-threshold component before clamping/copying; likewise modify the native
dual/tri functions (and the call site in solve_native_dual_edge_fixed_topology
that passes the third channel into source_rgb_to_XYZ()) to force sub-threshold
channels to zero so the 1‑ and 2‑channel topologies cannot emit bleed or skewed
ratios (reference symbols: native_single_identity,
solve_native_dual_edge_fixed_topology, count_active_channels). Ensure the check
uses the same epsilon constant and is performed before any native-path color
conversions or outputs are computed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1cfdf376-ccfb-4eae-9f8b-077e60f02fe2
📒 Files selected for processing (2)
src/fl/gfx/rgbw_colorimetric.cpp.hppsrc/fl/gfx/rgbw_colorimetric.h
|
I seem to have accidentally removed some documentation, so before this gets merged I'll attach updated files that are properly documented. FastLED is too large a project to have missing function documentation so I recognize this as "should be fixed now, not later" |
add back documentation for rgbw_colorimetric
|
Just an informational follow-up as I've run a full 1885 patch set verification against the sub-gamut model (lp_legacy was not checked for dE but the output values were still compared against the 256 LP cube to see how close it is to the tetrahedral interpolated values from the LUT) fastled_rgbw_nativegamut_d65whitepoint_subgamut_model_fullpatch.csv I ran a full 1,885-row native/D65/full-patch verification against this PRs analytical implementation and compared it row-by-row against the 256-cube outputs generated by the reference math models. LUT Output values are not expected to be 1:1 with the math model or FastLED implementation of the math model, as tetrahedral interpolation and no 1:1 LUT means we introduce some interpolation error when solving. The key structural checks now pass:
Measured dE is now in the same broad range as the cube/math-model verifier runs. These are wall-reflected bench captures, so the remaining failures are expected to include wall/backdrop spectral effects, low-Y noise, green-biased wall reflectance, and current light leak at black.
FastLED strict output vs the sub-gamut 256 cube:
FastLED LP column vs the
Representative rows:
One nuance: for strict/sub-gamut, some |
…ted project_automation.yml (closes #2757) (#2759) * ci: hard-block external-fork PRs from all workflow runs; ban pull_request_target (#2757) Two related hardening changes: 1. **Hard-block fork PRs** on the 6 workflows that trigger on `pull_request:` — `build_esp32s3`, `build_teensy41`, `build_uno`, `build_wasm`, `example_test_linux`, `unit_test_linux`. Add a job-level `if:` guard: if: github.event.pull_request == null || github.event.pull_request.head.repo.full_name == github.repository The first clause lets `push` / `workflow_dispatch` / `schedule` / etc. continue to run (those events have no `pull_request` context). The second clause matches only when the PR head repo IS the base repo (i.e. branch in FastLED/FastLED, never a fork). Behavior change: external-fork PRs now skip the entire build matrix silently (the jobs evaluate to `skipped`, not failed). Internal-branch PRs and pushes are unaffected. 2. **Ban pull_request_target** entirely. The only active user was `project_automation.yml`, which used it to keep a project board in sync with PR open/close/draft events. That trigger is removed; the `issues:` trigger remains. PR-driven board sync is intentionally dropped — the trigger has historically been the highest-risk surface in GitHub Actions (it runs in trusted context with secrets even on fork PRs) and the user explicitly banned it. The `build_clone_and_compile.yml` file already had `pull_request_target` disabled via comment — that pre-existing decision is now in line with repo policy. Verification: - `grep -rln 'pull_request_target' .github/` returns only two files, both showing the trigger inside a comment (one historical, one new), zero active uses. - `bash lint` clean. Filed under issue #2757 (which surfaced the cost-control concern after external PR #2752 triggered the full CI matrix; user's follow-up directives during review escalated to a hard block on fork PRs and a full ban on pull_request_target). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * ci(project_automation): restore pull_request_target after audit; document safety invariants Reverses the part of the previous commit that removed pull_request_target from project_automation.yml. The trigger is needed for PR-side project board sync (open / close / draft state changes) — a vanilla pull_request trigger has no access to the App private key required to write to the project, so pull_request_target is the only viable option. The pull_request_target ban from the previous commit still applies to the rest of the repo — project_automation.yml is the documented exception. This commit also adds a 30-line security comment block above the trigger declaration encoding the FIVE invariants that make this specific pull_request_target usage safe: 1. NEVER add `ref:` to actions/checkout (must stay on base ref) 2. NEVER run a fork-controlled script (only `python ci/github_project_sync.py`) 3. NEVER interpolate PR-controlled data into `run:` blocks (use `env:` only) 4. Keep `permissions:` minimal (currently `contents: read`) 5. App token must remain project-scoped only A second comment marker is placed directly on the actions/checkout step warning future editors not to add `ref:`. Audit performed 2026-06-04 under #2757. All five invariants verified holding. The script `ci/github_project_sync.py` was also audited: - inputs read only via `os.environ.get()` - passed to `gh api` via `-f`/`-F` positional flags (no shell) - GraphQL queries use `$variable` placeholders (no string concat) - env vars contain only GitHub-controlled metadata + repo vars + App token Net effect: identical functional behavior to pre-#2759 state on project_automation.yml; the explicit invariant comments are maintenance-grade documentation to prevent future regressions. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
medium Verification session from the rgbw_colorimetric contained in this PR:
fastled_rgbw_nativegamut_d65whitepoint_subgamut_model_mediumpatchset_dualchannel_3channelfix.csv
No more illegal topology solves, no more bad-ratio dual-channel solves, 3-channel & LP_legacy solver now very closely match the math model output
current dE failures are mostly a symptom of the actual capture test bench : Measured primaries are wall-captured primaries, not direct diode. Colorimeter/FastLED/Model is collecting/using those wall-reflected xy coordinates for solves which is really "LED primary blended into wall color, not direct-diode measured xy coordinates" so some error, especially at low Y, is expected.
This PR does not focus on being entirely performant, although the math model & FastLED analytical model are now aligned as of this PR. Checks should be made to make sure that things are still hitting performance targets. I have not tested the modified max-white LP endpoint solver within this verification run, just sub-gamut & legacy_lp that was re-implemented. The good news is that the legacy_LP solver now very closely matches the math model implementation
Summary by CodeRabbit
Bug Fixes
New Features
Refactor
Documentation