mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-25 06:46:40 -04:00
audioconvert: avoid some float/double/int conversions
This commit is contained in:
parent
9c9a5ac435
commit
a0518e28bb
1 changed files with 3 additions and 2 deletions
|
|
@ -7,6 +7,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include <spa/support/plugin.h>
|
#include <spa/support/plugin.h>
|
||||||
#include <spa/support/cpu.h>
|
#include <spa/support/cpu.h>
|
||||||
|
|
@ -1687,7 +1688,7 @@ static struct spa_pod *generate_ramp_seq(struct impl *this, struct volume_ramp_p
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
float pos = (samples == 0) ? end :
|
float pos = (samples == 0) ? end :
|
||||||
SPA_CLAMP(start + (end - start) * offs / samples,
|
SPA_CLAMPF(start + (end - start) * offs / samples,
|
||||||
SPA_MIN(start, end), SPA_MAX(start, end));
|
SPA_MIN(start, end), SPA_MAX(start, end));
|
||||||
float vas = get_volume_at_scale(vrp, pos);
|
float vas = get_volume_at_scale(vrp, pos);
|
||||||
|
|
||||||
|
|
@ -2496,7 +2497,7 @@ static uint32_t resample_update_rate_match(struct impl *this, bool passthrough,
|
||||||
match_size = resample_out_len(&this->resample, size);
|
match_size = resample_out_len(&this->resample, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = (uint32_t)round(fdelay);
|
delay = lround(fdelay);
|
||||||
delay_frac = (int32_t)((fdelay - delay) * 1e9);
|
delay_frac = (int32_t)((fdelay - delay) * 1e9);
|
||||||
}
|
}
|
||||||
match_size -= SPA_MIN(match_size, queued);
|
match_size -= SPA_MIN(match_size, queued);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue