Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

micd.py: optimize processing with real FFT and cached hanning window #33104

Closed
wants to merge 1 commit into from

Conversation

deanlee
Copy link
Contributor

@deanlee deanlee commented Jul 27, 2024

This PR enhances performance in the micd processing code by:

  1. Replaced the complex FFT (fft) with the real FFT (rfft), this changes Improved efficiency for real-valued audio data.
  2. Caching the Hanning Window: Reduced computation overhead by precomputing and caching the window.

Changes:

  1. Replaced np.fft.fft with np.fft.rfft.
  2. Replaced np.fft.ifft with np.fft.irfft.
  3. Cached the Hanning window used in apply_a_weighting. saving ~1.5 ms on every update.

These optimizations improve the speed and efficiency of micd processing. Simple tests using the htop tool show a 3-4% reduction in CPU usage.

Copy link
Contributor

github-actions bot commented Jul 27, 2024

Thanks for contributing to openpilot! In order for us to review your PR as quickly as possible, check the following:

  • Convert your PR to a draft unless it's ready to review
  • Read the contributing docs
  • Before marking as "ready for review", ensure:
    • the goal is clearly stated in the description
    • all the tests are passing
    • the change is something we merge
    • include a route or your device' dongle ID if relevant

@sshane
Copy link
Contributor

sshane commented Jul 28, 2024

trigger-jenkins

@sshane
Copy link
Contributor

sshane commented Jul 28, 2024

Was ~4%

image

Copy link
Contributor

github-actions bot commented Aug 7, 2024

This PR has had no activity for 9 days. It will be automatically closed in 2 days if there is no activity.

@github-actions github-actions bot added the stale label Aug 7, 2024
Copy link
Contributor

github-actions bot commented Aug 9, 2024

This PR has been automatically closed due to inactivity. Feel free to re-open once activity resumes.

@github-actions github-actions bot closed this Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants