resample: use a float phase in update_rate

My making the phase into a float, the resampler can do finer grained
adjustments, which should improve the stability of adaptive
resampling
This commit is contained in:
Dimitrios Katsaros 2024-02-16 13:42:31 +01:00 committed by Wim Taymans
parent ffd9a8b892
commit e25f7716b5
2 changed files with 7 additions and 5 deletions

View file

@ -29,7 +29,7 @@ struct native_data {
uint32_t n_phases;
uint32_t in_rate;
uint32_t out_rate;
uint32_t phase;
float phase;
uint32_t inc;
uint32_t frac;
uint32_t filter_stride;
@ -117,11 +117,12 @@ DEFINE_RESAMPLER(full,arch) \
DEFINE_RESAMPLER(inter,arch) \
{ \
struct native_data *data = r->data; \
uint32_t index, phase, stride = data->filter_stride; \
uint32_t index, stride = data->filter_stride; \
uint32_t n_phases = data->n_phases, out_rate = data->out_rate; \
uint32_t n_taps = data->n_taps; \
uint32_t c, o, olen = *out_len, ilen = *in_len; \
uint32_t inc = data->inc, frac = data->frac; \
float phase; \
\
if (r->channels == 0) \
return; \
@ -134,7 +135,7 @@ DEFINE_RESAMPLER(inter,arch) \
phase = data->phase; \
\
for (o = ooffs; o < olen && index + n_taps <= ilen; o++) { \
float ph = (float)phase * n_phases / out_rate; \
float ph = phase * n_phases / out_rate; \
uint32_t offset = floorf(ph); \
inner_product_ip_##arch(&d[o], &s[index], \
&data->filter[(offset + 0) * stride], \