Optimizations and audio gating#744
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements performance optimizations and fixes audio gating for quiet rooms. The changes focus on replacing manual loops with standard algorithms, optimizing matrix operations, and improving audio processing for better handling of quiet environments.
- Use
std::accumulateto replace manual loop calculations across multiple files - Optimize chroma key fill operations and matrix clearing with more efficient implementations
- Enhance audio gating with quiet room detection and improved parameter tuning
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ledmatrixgfx.cpp | Optimizes chroma key fill with direct buffer access and fixes method call |
| src/improv.cpp | Replaces manual checksum loops with std::accumulate |
| src/gfxbase.cpp | Adds _ledcount member for performance optimization |
| platformio.ini | Updates M5Unified version and adds LED pin definitions |
| include/soundanalyzer.h | Adds quiet room audio gating and new audio parameters |
| include/ledstripgfx.h | Adds always_inline and noexcept optimizations |
| include/ledmatrixgfx.h | Optimizes matrix clearing and pixel operations |
| include/improvserial.h | Replaces manual checksum loops with std::accumulate |
| include/globals.h | Removes deprecated M5 pragma and unused defines |
| include/gfxbase.h | Adds performance attributes and optimizes pixel operations |
| include/effects/strip/meteoreffect.h | Refactors to use multi-channel operations |
| include/effects/strip/fireeffect.h | Replaces manual sum loops with std::accumulate |
| include/effects/matrix/PatternAnimatedGIF.h | Updates method call for consistency |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…iverStrip into audioupdates
robertlipe
left a comment
There was a problem hiding this comment.
Nice. I really like the modernizations. Much fewer nails on the chalkboard for readers.
I'll let you and Gemini argue about its suggestions. I'm about 50/50 on those and suspect you'll come to a out the same 50.
| int x = iPos[i] - j; | ||
| if ((x <= pGFX->GetLEDCount()) && (x >= 1)) | ||
| int x = static_cast<int>(iPos[i]) - j; | ||
| if ((x <= static_cast<int>(pGFX->GetLEDCount())) && (x >= 1)) |
There was a problem hiding this comment.
Nit: I wonder if this is worth hoisting outside the loop, but we have so much CPU left. Over on our strip effects,. IDC
Description
Use std algorithms, optimize chroma key fill, fix audio gating for quiet rooms
mainas the target branch.