Skip to content

Animartrix usermod improvements and speedups #323

@softhack007

Description

@softhack007

This tickets is a summary of ongoing improvements for Animartrix effects.

Currently achieved speedup: 20-40% depending on effect used.

Generic fixes

  • bugfix: some effects call the 1D version of setPixelColor(), leading to unwanted behaviour in case that the last 1D segment expand mode was not "pixels". --> enforce using 2D
  • bugfix: changing segment size, or changing "mirror" or "transpose" must lead to effect re-init
  • feature: add checkbox for optional gamma correction
Image

Effect framerate

All Animartrix effects are calculated in pure float. This means there is no possibility for speedups, unless core animartrix functions would be re-written for fixed point (integer) math. But some tweaks could help

  • overwrite math functions like sinf() cosf() etc with speed-optimized approximations (wled_math.h)
  • raise compiler optimization temporarily: -ffast-math (= ditch IEEE compliance, allows for unfair/inaccurate math optimizations)
  • tell the compiler to treat all "literals" as float (normally a single value without ".0f" means that the compiler has to use double) -fsingle-precision-constant

RAM usage

Large lookup tables in RAM: effects use two huge lookup tables (2D vectors) that need 4*width*height bytes each. For 64x64 pixels this is 32KB extra RAM, fragmented into blocks of 256 bytes.

  • Try to force tables into PSRAM (needs a custom allocator for the vector template)
    --> can only be done in Animartix core - separate PR for original repo

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions