Animartrix plus: HUE shift, contrast & brightness boost#344
Animartrix plus: HUE shift, contrast & brightness boost#344softhack007 wants to merge 17 commits intomdevfrom
Conversation
thanks @DedeHai, works perfectly
* 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.
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughCentralizes 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
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
explains rationale behind enhanceBrightness fixed-point math using integer sqrt()
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
Ideas and ToDOs
oops, forgot half of the code.
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
Refactor