Skip to content

Animartrix plus: HUE shift, contrast & brightness boost#344

Open
softhack007 wants to merge 17 commits intomdevfrom
animartrix_plus
Open

Animartrix plus: HUE shift, contrast & brightness boost#344
softhack007 wants to merge 17 commits intomdevfrom
animartrix_plus

Conversation

@softhack007
Copy link
Collaborator

@softhack007 softhack007 commented Mar 2, 2026

  • add contrast and brightness boost checkboxes
  • add static HUE shift -> slider changes the main color (HUE)
  • add dynamic HUE cycling -> time-based, slider for speed of change
  • gamma correction moved into global UM settings
  • toDo: decide if having two sliders (static HUE shift, HUE change speed) is better
  • toDo: make HUE cycling audioreactive (slider)
  • toDo: Screenshots

Breaking: the first checkbox was previously used for "correct gamma", which is now part of the global usermod settings. This means that gamma correction needs to be switched off in UM settings, instead of setting it with each effect.
Due to the "re-purposed" slider, old preset may start HUE cycling.


Animartix_hue_cycle_part2.mp4

Future idea: alternative to CHSV32-based HUE rotation

check if the matrix-based HUE rotation described here works, too: https://agatedragon.blog/2024/04/02/hue-shift-shader/ .

It looks like three matrices (3x3) are needed: convert color vector to YIQ format, rotate (I,Q) but leave Y untouched, and finally convert back to color with another matrix. All the three matrices can be pre-calculated per frame, and pre-multiplied (use matrix multiplication!) into a single combined "color shift" matrix. Then on pixel level, a simple vector x matrix multiplication should be enough.

Summary by CodeRabbit

  • New Features

    • Hue cycling and static hue-shift controls for dynamic color movement.
    • Optional boosts for brightness and contrast plus an on/off gamma correction toggle.
    • New UI controls exposing Speed, HUE Change, cycle HUE, boost Brightness, boost Contrast.
  • Refactor

    • Unified color-processing so hue shift, brightness, contrast, and gamma apply consistently.
    • Higher-precision hue handling for smoother color transitions and accurate color conversions.

* convert pixel color from RGBW32 to CHSV32,
* shift HUE value,
* convert back to RGBW32

HUE shift is either static (slider), or continuous based on elapsed time.
* slider for HUE shift (static shift, or dynamic speed of change)
* checkbox for HUE cycling (dynamic)
* checkboxes for brightness and contrast boost
* remove checkbox for gamma correction, need to move this into usermod global settings.
@coderabbitai
Copy link

coderabbitai bot commented Mar 2, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • ✅ Review completed - (🔄 Check again to review again)
📝 Walkthrough

Walkthrough

Centralizes pixel color processing in ANIMartRIXMod (gamma, contrast, brightness, hue shift/cycling) and adds a new CHSV32 color utilities header with high-resolution hue and RGB/HSV conversion helpers.

Changes

Cohort / File(s) Summary
ANIMartRIXMod color pipeline
usermods/usermod_v2_animartrix/usermod_v2_animartrix.h
Adds centralized processColor(rgb) and static helpers enhanceContrast, enhanceBrightness, applyGamma24; introduces hueshift, public flags cycle_hue, boost_brightness, boost_contrast; routes pixel-setting through processColor; implements time/static hue shift and updates mode strings and initEffect mappings.
Color utilities
wled00/colors.h
Adds CHSV32 (16-bit hue, 8-bit sat/val, 32-bit raw) with constructors and conversion to/from CHSV; provides hsv2rgb and rgb2hsv functions for high-resolution hue operations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 I nibble bits and shift the hue,
I boost the light, then smooth it too.
Sixteen-bit dawn, a finer sweep,
ANIMartRIX wakes pixels from sleep,
Hop—small changes make colors true.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately describes the main changes: adding HUE shift (both static and dynamic cycling), contrast boost, and brightness boost to the Animartrix usermod.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch animartrix_plus

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.

coderabbitai[bot]

This comment was marked as resolved.

 UI typo: “Brighness” → “Brightness”.
coderabbitai[bot]

This comment was marked as resolved.

With strip.now in milliseconds, the fast-path overflows after ~7.5 hours and the slow-path after ~54.2 hours, causing visible hue jumps in continuous uptime scenarios.

=> Cast the multiplication operands to uint64_t before division.
avoid losing accuracy in hue shift calculation
coderabbitai[bot]

This comment was marked as resolved.

explains rationale behind enhanceBrightness fixed-point math using integer sqrt()
coderabbitai[bot]

This comment was marked as resolved.

AnimarTrix effects were designed with hardware-level gamma correction in mind => change default to apply gamma.

Note: this may create an unexpected / different look for older presets. If old behaviour is needed, disable gamma correction in UM settings (option will be added soon)
improves accuracy by embedding "<<4" into the main multiplication
coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

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