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

Thoughts on improving performance #122

Open
guillaumekh opened this issue Jun 3, 2022 · 2 comments
Open

Thoughts on improving performance #122

guillaumekh opened this issue Jun 3, 2022 · 2 comments

Comments

@guillaumekh
Copy link

guillaumekh commented Jun 3, 2022

libebur128's performance is well suited for live streams, but it can be a bit slow when working with files, especially large ones.

For example, running loudness-scanner w/ TP detection takes about 2 minutes to scan a 2 hours WAV file on my development machine.

Has anyone given some thoughts on how to improve the library's performance?

I have considered the following at this point:

  • multithreading: looking at the algorithm's spec (see FIGURE 1, page 3), it seems that at the very least it should be possible to parallelize the first stages on a per-channel basis. I'm also wondering if it would be possible to divide a file into multiple segments, and distribute analysis of those over multiple threads.
  • bs1770gain seems to be 3-4 times faster based on testing. I should investigate how they achieve this performance.

It's probably worth noting my employer is open to contracting w/ someone to work on this.

@sdroege
Copy link

sdroege commented Jun 3, 2022

multithreading: looking at the algorithm's spec (see FIGURE 1, page 3), it seems that at the very least it should be possible to parallelize the first stages on a per-channel basis. I'm also wondering if it would be possible to divide a file into multiple segments, and distribute analysis of those over multiple threads.

We did some experimenting with that in a Rust port of this library. Multi-threading wasn't really worth it there in the bigger picture when doing chunked analysis, see sdroege/ebur128#42 (comment) specifically and the whole PR. There's Rust API now for doing chunked processing from the application side though.

There might be other approaches to multi-threading that are more worthwhile though, or maybe chunked processing speeds up everything considerably for your use-case.

FWIW, the Rust port is slightly faster than the C version by some other optimizations but not 3x-4x faster. How much depends on your setup.

@caustik
Copy link

caustik commented Apr 25, 2023

I was able to optimize short-term and momentary full-file analysis by chunking the audio across the number of available threads and then adding some "preroll" aligned to the block boundary for each thread. Of course create unit tests to validate your results are identical to sequential processing. This doesn't handle integrated, but for my particular use case I didn't need that anyway.

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

No branches or pull requests

3 participants