Skip to content

Optimizations and audio gating#744

Merged
davepl merged 9 commits into
pdpwoprfrom
audioupdates
Aug 13, 2025
Merged

Optimizations and audio gating#744
davepl merged 9 commits into
pdpwoprfrom
audioupdates

Conversation

@davepl

@davepl davepl commented Aug 12, 2025

Copy link
Copy Markdown
Contributor

Description

Use std algorithms, optimize chroma key fill, fix audio gating for quiet rooms

  • I read the contribution guidelines in CONTRIBUTING.md.
  • I understand the BlinkenPerBit metric, and maximized it in this PR.
  • I selected main as the target branch.
  • All code herein is subjected to the license terms in COPYING.txt.

Comment thread platformio.ini Outdated
@davepl
davepl requested a review from Copilot August 12, 2025 19:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::accumulate to 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.

Comment thread include/soundanalyzer.h Outdated
Comment thread include/soundanalyzer.h
Comment thread include/soundanalyzer.h Outdated
Comment thread include/soundanalyzer.h Outdated
Comment thread include/ledmatrixgfx.h Outdated

@robertlipe robertlipe left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I wonder if this is worth hoisting outside the loop, but we have so much CPU left. Over on our strip effects,. IDC

Comment thread include/soundanalyzer.h

@rbergen rbergen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@davepl
davepl merged commit e462b21 into pdpwopr Aug 13, 2025
96 checks passed
@rbergen
rbergen deleted the audioupdates branch December 26, 2025 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants