mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
resample: completely fill resampler
start with a completely filled resampler so that the first input byte immediately gives an output sample. When then have n_taps/2 leading (almost) 0 samples. Also make the passthrough resampler act like the real resampler by introducing an n_taps/2 delay.
This commit is contained in:
parent
b1bfc900d6
commit
a232e67dd8
2 changed files with 4 additions and 3 deletions
|
|
@ -59,7 +59,7 @@ void do_resample_##type##_##arch(struct resample *r, \
|
|||
DEFINE_RESAMPLER(copy,arch) \
|
||||
{ \
|
||||
struct native_data *data = r->data; \
|
||||
uint32_t index, n_taps = data->n_taps; \
|
||||
uint32_t index, n_taps = data->n_taps, n_taps2 = n_taps/2; \
|
||||
uint32_t c, olen = *out_len, ilen = *in_len; \
|
||||
\
|
||||
if (r->channels == 0) \
|
||||
|
|
@ -72,7 +72,8 @@ DEFINE_RESAMPLER(copy,arch) \
|
|||
for (c = 0; c < r->channels; c++) { \
|
||||
const float *s = src[c]; \
|
||||
float *d = dst[c]; \
|
||||
memcpy(&d[offs], &s[index], to_copy * sizeof(float)); \
|
||||
memcpy(&d[offs], &s[index + n_taps2], \
|
||||
to_copy * sizeof(float)); \
|
||||
} \
|
||||
index += to_copy; \
|
||||
offs += to_copy; \
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ static void impl_native_reset (struct resample *r)
|
|||
{
|
||||
struct native_data *d = r->data;
|
||||
memset(d->hist_mem, 0, r->channels * sizeof(float) * d->n_taps * 2);
|
||||
d->hist = d->n_taps / 2;
|
||||
d->hist = d->n_taps - 1;
|
||||
d->phase = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue