Skip to content

Apply gamma during realtime override#5666

Open
DedeHai wants to merge 1 commit into
wled:mainfrom
DedeHai:fix_RToverride_gamma
Open

Apply gamma during realtime override#5666
DedeHai wants to merge 1 commit into
wled:mainfrom
DedeHai:fix_RToverride_gamma

Conversation

@DedeHai
Copy link
Copy Markdown
Collaborator

@DedeHai DedeHai commented Jun 4, 2026

partial fix for #5661

Summary by CodeRabbit

  • Bug Fixes
    • Refined gamma correction application for improved color rendering consistency in real-time display modes.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9bac4860-d9f9-4200-9910-73d207a014a4

📥 Commits

Reviewing files that changed from the base of the PR and between be264fb and a73b3ee.

📒 Files selected for processing (1)
  • wled00/FX_fcn.cpp

Walkthrough

The PR refines gamma correction application in the pixel painting loop of WS2812FX::show() by introducing a local useGammaCorrection boolean that consolidates gammaCorrectCol with realtime-override and disable-gamma exceptions, then uses this flag to conditionally apply gamma32() per-pixel instead of the previous simpler realtime-based check.

Changes

Gamma Correction Logic

Layer / File(s) Summary
Gamma correction conditional gating
wled00/FX_fcn.cpp
A local useGammaCorrection flag is computed from gammaCorrectCol combined with arlsDisableGammaCorrection and realtimeOverride checks, then replaces the previous realtime-only condition in the per-pixel gamma-correction if statement.

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • wled/WLED#5225: Fixes gammaCorrectCol initialization in cfg.cpp; the main PR's gamma-correction behavior in show() depends on this flag's correct defaults.
  • wled/WLED#4722: Adds inverseGamma32 to adjust gamma-corrected colors; both PRs refine the gamma-correction pipeline by conditioning behavior on gammaCorrectCol.

Suggested labels

bug, Awaiting testing

Suggested reviewers

  • blazoncek
  • softhack007
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: applying gamma correction during realtime override mode, which directly matches the code modification in WS2812FX::show().
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

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)
wled00/FX_fcn.cpp

In file included from wled00/FX_fcn.cpp:12:
wled00/wled.h:77:10: fatal error: 'Arduino.h' file not found
77 | #include <Arduino.h>
| ^~~~~~~~~~~
1 error generated.
Error: the following clang command did not run successfully:
/opt/infer-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-18
@/tmp/coderabbit-infer/a73b3ee71e067ae0e5af0acdaa53e0808de7cf43-f109c58280734613/tmp/clang_command_.tmp.07cff5.txt
++Contents of '/tmp/coderabbit-infer/a73b3ee71e067ae0e5af0acdaa53e0808de7cf43-f109c58280734613/tmp/clang_command_.tmp.07cff5.txt':
"-cc1" "-load"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../../facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib"
"-add-plugin" "BiniouASTExporter" "-plugin-arg-BiniouASTExporter" "-"
"-plugin-arg-BiniouASTExporter" "PREPEND_CURRENT_DIR=1"
"-plugin-arg-BiniouASTExporter" "MAX_STRING_SIZE=65535" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax

... [truncated 1074 characters] ...

ins/clang/install/lib/clang/18/include"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-Wno-ignored-optimization-argument" "-Wno-everything"
"-fdeprecated-macro" "-ferror-limit" "19" "-fgnuc-version=4.2.1"
"-fskip-odr-check-in-gmf" "-fcxx-exceptions" "-fexceptions"
"-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o"
"/tmp/coderabbit-infer/f109c58280734613/file.o" "-x" "c++"
"wled00/FX_fcn.cpp" "-O0" "-fno-builtin" "-include"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../lib/clang_wrappers/global_defines.h"
"-Wno-everything"


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.

Copy link
Copy Markdown
Member

@softhack007 softhack007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very good, i like the idea to move the checking outside of the pixel loop 👍

@DedeHai
Copy link
Copy Markdown
Collaborator Author

DedeHai commented Jun 4, 2026

very good, i like the idea to move the checking outside of the pixel loop 👍

the compiler might have optimized that already, but better be explicit.
I also wanted to remove the double-checking of gammaCorrectCol inside the gamma functions but then I remembered that the table is also used by brightness-gamma. Could still remove it from Correct32(uint32_t color) as that is only used once - and is inlined so the compiler might take care of it if it is that clever.

@DedeHai DedeHai removed the bug label Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants