mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-03-06 01:40:26 -05:00
delay: improve delay performance
Use a wrap around delay ringbuffer. We can then avoid some modulo arithmetic and read more efficiently. Also handle the delay convolver case better by reversing the taps and reading the taps and delay buffer without extra overhead.
This commit is contained in:
parent
668055e612
commit
a57f2f25b6
4 changed files with 31 additions and 14 deletions
|
|
@ -775,16 +775,20 @@ int channelmix_init(struct channelmix *mix)
|
|||
mix->delay = (uint32_t)(mix->rear_delay * mix->freq / 1000.0f);
|
||||
mix->func_name = info->name;
|
||||
|
||||
spa_log_debug(mix->log, "selected %s delay:%d options:%08x", info->name, mix->delay,
|
||||
mix->options);
|
||||
|
||||
if (mix->hilbert_taps > 0) {
|
||||
mix->n_taps = SPA_CLAMP(mix->hilbert_taps, 15u, 255u) | 1;
|
||||
blackman_window(mix->taps, mix->n_taps);
|
||||
hilbert_generate(mix->taps, mix->n_taps);
|
||||
reverse_taps(mix->taps, mix->n_taps);
|
||||
} else {
|
||||
mix->n_taps = 1;
|
||||
mix->taps[0] = 1.0f;
|
||||
}
|
||||
if (mix->delay + mix->n_taps > BUFFER_SIZE)
|
||||
mix->delay = BUFFER_SIZE - mix->n_taps;
|
||||
|
||||
spa_log_debug(mix->log, "selected %s delay:%d options:%08x", info->name, mix->delay,
|
||||
mix->options);
|
||||
|
||||
return make_matrix(mix);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue