gifdecoder speedup and bugfixes

* fixed a bug that caused wrong behavior with segment mirroring
    (effects must use virtualHeight() /  virtualWidth() instead of height() / width())
* added image blur as an option (second slider)
* added very basic error reporting for users
*  up to 25% faster, especially with big animated gifs

* made all local variables "static" (don't pollute global namespace)
* drawPixelCallback: cache calculation that do not depend on x/y position
* reduced memory allocations on boards without PSRAM, to avoid crashes
This commit is contained in:
Frank
2025-11-06 22:50:59 +01:00
parent 5177ebd271
commit 10b3ac0eb1
2 changed files with 70 additions and 21 deletions

View File

@@ -4693,9 +4693,11 @@ static const char _data_FX_MODE_WASHING_MACHINE[] PROGMEM = "Washing Machine@!,!
Draws a .gif image from filesystem on the matrix/strip
*/
uint16_t mode_image(void) {
if (!strip.isMatrix) return mode_oops(); // not a 2D set-up
#ifndef WLED_ENABLE_GIF
return mode_oops();
#else
if (max(SEGMENT.virtualWidth(),SEGMENT.virtualHeight()) < 4) return mode_oops(); // too small
renderImageToSegment(SEGMENT);
return FRAMETIME;
#endif
@@ -4704,7 +4706,7 @@ uint16_t mode_image(void) {
// Serial.println(status);
// }
}
static const char _data_FX_MODE_IMAGE[] PROGMEM = "Image@!,;;;12;sx=128";
static const char _data_FX_MODE_IMAGE[] PROGMEM = "Image@!,Blur,;;;12;sx=128,ix=0";
/*
Blends random colors across palette