73 Commits

Author SHA1 Message Date
Frank
bc7cf062e8 effect math sppedup - up to 3x faster
-> distortion waves 3x speedup
-> hiphotic 2x speedup
-> waving cell 1.5x speedup

* replace sin8_t by lookup-table with pre-computed values
* moved integer sin and cos to fcn_declare.h (inlined by the compiler)
* moved gamma32 to fcn_declare.h (inlined by the compiler)
* a few other small tweaks
2025-12-17 21:59:22 +01:00
Frank
36648d1936 hot path optimization: make gamma correction inline
* make sure that gamma LUT is always initialized
* remove some unnecessary safety checks
* make gamma8() inline, for more speed
* use fast unGamma8 for preview
* add super-fast unGamma8 for HUB75 - old function lost 3-10 fps, this version does not reduce fps at all *grins*
2025-11-10 23:17:16 +01:00
Frank
a956b22a16 unGamma8() accuracy improvement
based on upstream changes by @DedeHai
2025-11-05 22:01:07 +01:00
Frank
297a2c2b9c bring back lost function ColorFromPaletteWLED (WLEDMM_SAVE_FLASH only)
this change was somehow lost - ColorFromPaletteWLED existed in colorTools.hpp (for fast inline) but was missing in colors.cpp (WLEDMM_SAVE_FLASH fallback).
2025-11-01 14:16:47 +01:00
Frank
eec3e6d64d Merge pull request #269 from MoonModules/bus_sPC_gPC_optimizations
Bus level setPixelColor and getPixelColor optimizations
2025-11-01 13:39:25 +01:00
Frank
96c3244318 removing deactivated code 2025-11-01 13:30:51 +01:00
Frank
56380ce04c slightly faster to keep IRAM_ATTR for sPC and color_add 2025-10-26 01:41:30 +02:00
Frank
0071677340 (experimental) tweak optimization level of color functions 2025-10-25 23:59:29 +02:00
Frank
4713f26bb8 additional constants to improve upstream compatibility
* a few new error constants
*  WLED_O2_ATTR - ask the compiler for stronger optimization of a single function
*  WLED_O3_ATTR (WLEDMM) optimize even more
2025-10-25 23:43:44 +02:00
Frank
9968ed9a22 fix merge error 2025-10-25 22:17:13 +02:00
Damian Schneider
82ba119402 fix low brightness gradient "jumpyness"
during testing at low brightness I noticed that gradients can be "jumping" in colors quite wildly, turning a smooth gradient into a flickering mess. This is due to the color hue preservation being inaccurate and a bit too aggressive. This can be seen for example using a gradient palette and "Running" FX.
Removing the hue preservation completely fixes it but leaves color artefacts for example visible in PS Fire at very low brightness: the bright part of the flames gets a pink hue. This change is a compromise to fix both problems to a "good enough" state
2025-10-25 22:08:09 +02:00
Frank
6e8ab94ee9 colorKtoRGB optimization and bugfix
* bug: logf(temp-10) result becomes NaN when kelvin < 1200
* bug (RISC-V only): parameter of Bus::setCCT must be signed, to avoid undefined behaviour
* minor optimization by replacing constrain() with min(max())
2025-10-20 21:53:37 +02:00
Frank
8067f1f70c bus.setPicelColor optimization: move colorBalanceFromKelvin into busmanager.cpp
colorBalanceFromKelvin() is only called from inside bus_manager.cpp, so we can help the compiler optimize by making it a local (static) fuction
2025-10-20 21:49:09 +02:00
Frank
985fa1fd3f inline frequently used color utilities (up to 15% faster)
* moving color_blend, color_add, and color_fade to a seperate file, to allow the compiler to inline the functions.

* inlining slightly increases firmware size - original non-inline functions get used on 8266, or when WLEDMM_SAVE_FLASH is defined.
2025-01-17 21:42:26 +01:00
Frank
d6dedd025d color_fade optimizations
* removed unnecessary conditions
* optimized bit-shifting logic
* use uint16_t for colors, to prevent the compiler from using 64bit integer
2024-11-15 20:12:01 +01:00
Frank
6ef0578613 color_blend accuracy improvements
For 8bit blends, we adopt the new blend8() logic from FastLED.

The WLED color_clend function is based on very old FastLED code, that was replaced 3 years ago due to serious rounding problems.
2024-11-15 15:14:44 +01:00
Frank
81facea82f color_fade small improvement
avoids over-blending, and gives a tiny speedup.
2024-11-14 14:14:36 +01:00
Frank
4aa9c2607d prevent overflow in color_blend 2024-10-23 14:22:57 +02:00
Frank
7f9da309c9 const const const
adding hints for the compiler for optimization.
In case your custom build complains about "const", just remove the keyword. based on e82f38e277, but going further :-)

* "const" class functions : function does not modify any class attributes ( --> "this" becomes const)

* __attribute__((pure)) :  function return value depends only on the parameters and/or global variables. The function does not modify any global or static variables.
* __attribute__((const)) : function only examines arguments (no globals), and has no effects except the return value. This slightly more strict than "pure"
* hot: tells the compiler "this functions is called very often"
* cold: the opposite of hot
2024-08-07 14:58:38 +02:00
Frank
078bd70775 HUB75 speedups and minor improvements
* HUB75: allow to use native driver gamma correction - requires to undo WLED gamma
* added unGamma24() function
* HUB75: optimized setPixelColor()
* some experimental HUB75 stuff
2024-08-05 17:28:03 +02:00
Frank
2edfcb3343 small optimization for color_blend
* Early exit when color1 == color2 (nothing to blend)
* pre-calculate `blendmax - blend` (repeated 4 times)
2024-06-20 12:26:43 +02:00
Frank
93b8c63e2b post PR3904 fixes and improvements
* fix compiler warnings (uninitialized vars, ambiguous  functions calls)
* restore some lost function prototypes
* avoid negative pixel indices
* only use "fast" color_add when there is no risk of  "overshooting" results
* minor optimizations
2024-04-18 21:09:14 +02:00
Blaž Kristan
48c64aecff Merge pull request #3904 from DedeHai/FX_fcn_improvements
added improvements to color scaling and blurring
2024-04-18 19:26:57 +02:00
Frank
8905992a89 code spell checking - part4 (MM specific) 2023-12-15 00:14:57 +01:00
Frank
8e678ffa5e allow gamma corrected preview without gamma corrected LEDs 2023-08-05 00:06:58 +02:00
Frank
f010adfe24 experimental: preview with gamma correction
.... actually we undo gamma adjustments, because screens (laptop, pad, etc) will apply their own gamma corrections.

Activate in LED settings: "Use Gamma correction for preview"

Colors in WLED are sometimes gamma corrected, sometimes not. This change tries to make the best out of the color mess, but its still not working properly in all configurations.
2023-08-04 22:03:53 +02:00
Frank
adb3a12129 small speedup: IRAM_ATTR_YN colorBalanceFromKelvin 2023-07-28 21:04:59 +02:00
Frank
4984c578cc minor speedups
* added IRAM_ATTR_YN to some frequently used color functions
* small optimization for fade_out: pixel already has "target color"
2023-07-21 15:59:32 +02:00
Frank
7d0e627e14 some effect optimizations
* getpixelcolor: attribute pure - it reads memory, but does not write
* some optimizations for SEGMENT.blur() and SEGMENT.fadeToBlackBy()

* FX.c:pp remove double calls to blur() and fade_out()
* FX.cpp: SEGMENT.setUpLeds() added to effects, to enable LED buffering (safe some time because getPixelColor does not need to access NeopixelBus)

* a few other optimizations to safe time and avoid "expensive" operations
* set I2C bus speed to 400kHz (default is 100Khz)

* a few other small optimizations and tweaks
* pio: esp32 V4 builds use "patch5" toolchain version, which contains a few bugfixes especially for memory management.
2023-05-03 20:33:23 +02:00
Frank
40c96c14f5 a bunch of smaller speedups to core functions
*  make local functions "static"
* use fast_ int types where possible
* use native min/max instead of MIN/MAX macros. Macros evaluate each parameter TWICE!!
* adding __attribute__((pure)) and __attribute((const)) to help the compiler optimize
* ws.cpp: reduce max "live leds" in fastpath mode
2023-04-30 18:41:30 +02:00
Frank
292c4e25ba small updates
* colors.cpp: disable gamma calculation if CIE table mode is active (WLED_USE_CIE_BRIGHTNESS_TABLE)
* fx.cpp: small improvement to FreqMap, and bugfix for effects that modify binNum / maxVol
* pio: update for Line-In shield pins (final hardware version)
2023-04-01 22:13:46 +02:00
Ewoud
8485be27f2 Merge remote-tracking branch 'upstream/main' into mdev 2023-03-21 11:39:30 +01:00
Blaz Kristan
11b687cdc2 Float vs. double. 2023-03-19 11:24:59 +01:00
Ewoud
66b15d32d9 Merge remote-tracking branch 'upstream/main' into mdev 2023-01-07 12:01:03 +01:00
Blaž Kristan
506b6b51ce whitespace cleanup 2023-01-06 09:24:29 +01:00
Frank
125017f57d small updates
- colors: add clarification that alternative table does not affect NeopPixelBus colors
- npm run build
- build number up
2022-11-29 22:20:37 +01:00
Frank
c8bc917aaf color management: experimental CIE1931 lookup table
CIE table is better to preserve low brightness colors (original gamma table will map many low values to 0)
2022-11-29 21:26:34 +01:00
Blaz Kristan
b141ec7ea7 Fix for #2880 (stateChanged on segment on/off)
Added comments.
Added X1, X2, X3, M1, M2, M3 segment options to HTTP API.
Added "on" handling with "ps".
2022-11-13 12:13:49 +01:00
Blaz Kristan
787f5f06df Global gamma.
Randomcycle palette bugfix.
2022-09-04 20:17:05 +02:00
Blaz Kristan
d0a08a55d1 Memory management! 2022-08-03 21:36:47 +02:00
Blaz Kristan
f02616acd1 Some fixes. 2022-07-31 19:52:07 +02:00
Blaz Kristan
d328db543e Bugfixes.
- gamma on *Color palettes
- gamma moved out of WS2812FX
- palette fade (JSON) fix
2022-07-30 23:58:29 +02:00
Blaz Kristan
d9f2c2b968 Segment API
- moved all drawing logic to segment
- moved transitions to segment
Conditional 2D compile.
Rearranged effect IDs.
Implemented dynamic effect arrays.
2022-07-10 22:23:25 +02:00
Blaz Kristan
64fd207533 Refactoring WS2812FX class.
- effect functions no longer part of class
- methods to access private members
- separate Segment, Segment_runtime, ColorTransition from WS2812FX
2022-07-06 13:13:54 +02:00
Blaz Kristan
4d10c9de95 Removed unnecessary set call.
Fixed incorrect colorUpdated call.
Fixed white +/- in IR40 remote.
2022-02-27 16:18:37 +01:00
Blaž Kristan
8af445e72b Merge branch 'master' into merge-master 2022-02-22 10:42:00 +01:00
Blaz Kristan
41b6f3ffa7 Merge branch 'master' into merge-master 2022-02-20 22:24:11 +01:00
cschwinne
7b969bb8c2 Various state changed logic simplifications
Changed main segment, must be selected
2022-02-16 21:12:33 +01:00
Blaz Kristan
a5b19bbc83 Multiple changes:
- added segment capabilities utility
- removed colorFromUinXX functions
- rewritten IR color handling (changeColor())
2022-02-10 13:24:51 +01:00
Blaz Kristan
e35ad7551b Apply IR to main or selected segments.
Refactored IR code.
2022-02-07 00:40:45 +01:00