Skip to content

fix(rgbw): zero-init failed cache matrices + drop duplicate comment (meta #2580 B1+B7) - #2589

Merged
zackees merged 1 commit into
masterfrom
fix/2580-rgbw-colorimetric-cleanup
May 30, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/2580-rgbw-colorimetric-cleanup

Conversation

@zackees

@zackees zackees commented May 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Two related CodeRabbit follow-ups in src/fl/gfx/rgbw_colorimetric.cpp.hpp:

  • B1: build_profile_cache warned on invert3x3 failure but still wrote garbage matrices into cache->P_*_inv. Downstream matvec3() then produced undefined output. Now zero-inits each failed matrix so output is deterministic (zero) on degenerate profiles.
  • B7: lines 43-46 and 51-54 were near-identical comment blocks. Removed the second one.

Bundled into one PR because both findings touch the same file.

Addresses meta-issue #2580 findings B1 (#2552 (comment)) and B7 (#2554 (review)).

Test plan

  • bash lint
  • CI green

Summary by CodeRabbit

  • Bug Fixes
    • Fixed color matrix inversion error handling to ensure deterministic behavior in graphics rendering. When matrix calculations encounter errors, affected values are now properly initialized with defined values instead of remaining undefined, resulting in more stable and consistent graphics performance.

Review Change Stack

…lock

Two CodeRabbit follow-ups for src/fl/gfx/rgbw_colorimetric.cpp.hpp:

- B1: build_profile_cache warned on invert3x3 failure but still wrote
  garbage matrices into cache->P_*_inv. Downstream matvec3() then
  produced undefined output. Zero-init each failed matrix so output is
  deterministic (zero) on degenerate profiles.

- B7: lines 43-46 and 51-54 were near-identical comment blocks about
  degenerate primaries. Removed the second block.

Addresses CodeRabbit findings B1 (originally #2552) and B7 (#2554) per
meta #2580.
@zackees
zackees merged commit 8d09b29 into master May 30, 2026
5 of 7 checks passed
@zackees
zackees deleted the fix/2580-rgbw-colorimetric-cleanup branch May 30, 2026 15:30
@coderabbitai

coderabbitai Bot commented May 30, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: da45c82c-f2f5-4ba2-927e-d317d912b6f9

📥 Commits

Reviewing files that changed from the base of the PR and between 0a04bda and cc8e7ec.

📒 Files selected for processing (1)
  • src/fl/gfx/rgbw_colorimetric.cpp.hpp

📝 Walkthrough

Walkthrough

This PR adds defensive initialization to the build_profile_cache function. When 3x3 matrix inversions fail during degenerate RGBW profile handling, the code now zero-initializes the corresponding inverse matrices (P_RGB_inv, P_RGW_inv, P_RBW_inv, P_BGW_inv) to prevent downstream code from using garbage or uninitialized data.

Changes

RGBW inverse matrix degenerate-case safeguarding

Layer / File(s) Summary
Failed inverse matrix zero-initialization in build_profile_cache
src/fl/gfx/rgbw_colorimetric.cpp.hpp
build_profile_cache detects failed 3x3 matrix inversions and zero-initializes corresponding sub-gamut inverse matrices to guarantee deterministic behavior in downstream matrix operations when profile inversion fails.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • FastLED/FastLED#2554: Both PRs address failed invert3x3 calls in build_profile_cache, detecting RGBW matrix inversion failures and sanitizing the resulting inverse matrices with warnings.

Poem

A matrix falls when math gets mean,
but now we catch what once was unseen.
Zero fills the gaps with care,
no garbage left to linger there. 🐰✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/2580-rgbw-colorimetric-cleanup

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant