Repository navigation
fix(rgbw): normalize colorimetric endpoints - #3252
Conversation
|
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 (5)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughIntroduces ChangesRGBW Colorimetric Shared RGB Solver Extraction and Source Value Convention
Sequence Diagram(s)sequenceDiagram
participant Caller
participant solve_strict_subgamut_xy
participant xyY_to_XYZ
participant nnls3
Caller->>solve_strict_subgamut_xy: xy_t[], source_value
solve_strict_subgamut_xy->>xyY_to_XYZ: x, y, Y=1.0f
xyY_to_XYZ-->>solve_strict_subgamut_xy: XYZ
solve_strict_subgamut_xy->>nnls3: M_out, XYZ
nnls3-->>solve_strict_subgamut_xy: t[] (normalized solution)
solve_strict_subgamut_xy->>solve_strict_subgamut_xy: scale t[] by source_value/m
solve_strict_subgamut_xy-->>Caller: out_rgbw[]
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 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)
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 |
|
I'm already handling all of this, I can't continue to be helpful if we're actively touching the same code causing problems that would need to be resolved at merge time |
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/colorimetric_response.h`:
- Line 18: Array parameters declared as `float out[2]` or `float out[3]` in
functions like cct_to_xy, xyY_to_XYZ, and others throughout the file decay to
pointers and do not enforce extent, violating the coding guidelines. Replace all
such decayed array parameters with either `fl::span<float, N>` (where N is 2 or
3 as appropriate) or array references `float (&out)[N]` depending on the API
requirements. This applies to all function parameters matching the pattern `T
value[N]` throughout the file at the specified line numbers.
🪄 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: 165ff422-e031-47d1-931a-fb7ac2d1212d
📒 Files selected for processing (5)
src/fl/gfx/colorimetric_response.hsrc/fl/gfx/rgbw.cpp.hppsrc/fl/gfx/rgbw_colorimetric.cpp.hppsrc/fl/gfx/rgbw_colorimetric.htests/fl/gfx/rgbw_colorimetric.cpp
| // Krystek's outputs are (u, v) in the CIE 1960 UCS; convert to xy via the | ||
| // standard 1960->xy formulas. Reference: Krystek, "An algorithm to calculate | ||
| // correlated color temperature", Color Research & Application, 1985. | ||
| inline void cct_to_xy(int cct, float out[2]) FL_NOEXCEPT { |
There was a problem hiding this comment.
Decayed array parameter: float out[2] does not enforce extent.
Per coding guidelines, function parameters spelled as T value[N] decay to pointers and the declared extent is not enforced. For non-ISR APIs, use fl::span<float, 2> or an array reference float (&out)[2].
This issue affects multiple functions in this file:
- Line 18:
cct_to_xy(..., float out[2]) - Line 33:
xyY_to_XYZ(..., float out[3]) - Line 44, 65, 71-72, 104-106, 131-132: similar patterns
As per coding guidelines, "Do not allow function parameters spelled as T value[N] or T value[]" — replacements should use fl::span<T, N> or array references.
🤖 Prompt for 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.
In `@src/fl/gfx/colorimetric_response.h` at line 18, Array parameters declared as
`float out[2]` or `float out[3]` in functions like cct_to_xy, xyY_to_XYZ, and
others throughout the file decay to pointers and do not enforce extent,
violating the coding guidelines. Replace all such decayed array parameters with
either `fl::span<float, N>` (where N is 2 or 3 as appropriate) or array
references `float (&out)[N]` depending on the API requirements. This applies to
all function parameters matching the pattern `T value[N]` throughout the file at
the specified line numbers.
Source: Coding guidelines
There was a problem hiding this comment.
Acknowledged — deferring on the same basis as PR #3256: the decayed-array signatures (float out[N]) flagged here are the established style across colorimetric_response.h and rgbw_colorimetric.h on master. The new RGB cache/solver helpers I just rebased in (build_rgb_colorimetric_cache, rgb_source_to_XYZ, solve_rgb_colorimetric) intentionally match that style so the fl::span<T, N> migration can land as a single atomic pass over both files (per the PR 2 of #3255 plan agreed on #3256). No new decayed signatures unique to this PR remain.
There was a problem hiding this comment.
@zackees, understood — keeping the pattern consistent until the atomic fl::span<T, N> migration lands makes sense. I'll note the plan so it isn't re-flagged in interim PRs.
Would you like me to open a tracking issue for the fl::span<float, N> migration pass over colorimetric_response.h and rgbw_colorimetric.h (and any other colorimetric helpers in that directory) to make sure it stays on the radar for PR 2 of #3255?
🧠 Learnings used
Learnt from: zackees
Repo: FastLED/FastLED PR: 3256
File: src/fl/gfx/colorimetric_response.cpp.hpp:14-24
Timestamp: 2026-06-19T02:25:59.632Z
Learning: In the FastLED/FastLED repository, `FASTLED_RGBW_COLORIMETRIC` is an already-established build-gate macro. During review, do not flag new/added files that only reference/reuse this existing guard for unity-build consistency as a violation of the “new-macro-prefix” rule. Only flag when code introduces a genuinely new macro (or a new/renamed guard) rather than reusing this pre-existing `FASTLED_RGBW_COLORIMETRIC` macro.
7c8f729 to
643478c
Compare
643478c to
69ab69c
Compare
69ab69c to
663fe6e
Compare
|
Rebased onto master (was conflicting since June 18) and revalidated locally. Conflict resolution: two overlapping renames. This PR renames the LUT/subgamut parameter The rebase also auto-merged this PR's new Validation on the rebased branch:
🤖 Generated with Claude Code |
Fixes #3231 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
663fe6e to
a5f03ad
Compare
Summary
colorimetric_response.hand add an RGB-only cache/solve shape for the follow-up plumbing.Tests
python test.py --unit rgbw_colorimetric --no-interactivepython test.py --unit rgbw_colorimetric --no-interactive --debugpython test.py --unit rgbw --no-interactivegit diff --checkCloses #3231
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Tests