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

Optimize waveform generation #6035

Merged
merged 1 commit into from
Sep 16, 2024
Merged

Optimize waveform generation #6035

merged 1 commit into from
Sep 16, 2024

Conversation

cjcolvar
Copy link
Member

Changes propsed in this PR:

  • FFmpeg downmix to mono wav instead of having waveform code check both channels for min/max peaks.
  • Bring gather_peaks method into get_normalized_peaks so overall absolute value max can be computed while gathering peaks instead of needing a separate pass through the peaks after.
  • Scale peaks in place instead of allocating another array
  • Explicitly close both reader and IO instead of waiting for FFmpeg to terminate
  • Avoid flatten since it is expensive when run so frequently

Note that the waveform fixture has slightly different values. I found that running the waveform job on a real item on mco-staging yielded different length and values even when run with the same code. But the small differences did not affect how it rendered in the SME so shouldn't be problem.

Resolves #5155

Copy link
Contributor

@masaball masaball left a comment

Choose a reason for hiding this comment

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

Looks good!

@cjcolvar cjcolvar merged commit bdf83fb into develop Sep 16, 2024
2 checks passed
@cjcolvar cjcolvar deleted the ride_the_waves branch September 16, 2024 21:06
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.

2 participants