mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
resample-native: only do full resample when rate == 1.0
Otherwise choose the interpollating resampler.
This commit is contained in:
parent
80face4b92
commit
93006d6d90
1 changed files with 4 additions and 3 deletions
|
|
@ -94,8 +94,9 @@ static inline uint32_t calc_gcd(uint32_t a, uint32_t b)
|
||||||
static void impl_native_update_rate(struct resample *r, double rate)
|
static void impl_native_update_rate(struct resample *r, double rate)
|
||||||
{
|
{
|
||||||
struct native_data *data = r->data;
|
struct native_data *data = r->data;
|
||||||
uint32_t in_rate, out_rate, phase, gcd;
|
uint32_t in_rate, out_rate, phase, gcd, old_out_rate;
|
||||||
|
|
||||||
|
old_out_rate = data->out_rate;
|
||||||
in_rate = r->i_rate / rate;
|
in_rate = r->i_rate / rate;
|
||||||
out_rate = r->o_rate;
|
out_rate = r->o_rate;
|
||||||
phase = data->phase;
|
phase = data->phase;
|
||||||
|
|
@ -105,7 +106,7 @@ static void impl_native_update_rate(struct resample *r, double rate)
|
||||||
out_rate /= gcd;
|
out_rate /= gcd;
|
||||||
|
|
||||||
data->rate = rate;
|
data->rate = rate;
|
||||||
data->phase = phase * out_rate / data->out_rate;
|
data->phase = phase * out_rate / old_out_rate;
|
||||||
data->in_rate = in_rate;
|
data->in_rate = in_rate;
|
||||||
data->out_rate = out_rate;
|
data->out_rate = out_rate;
|
||||||
|
|
||||||
|
|
@ -118,7 +119,7 @@ static void impl_native_update_rate(struct resample *r, double rate)
|
||||||
if (data->in_rate == data->out_rate)
|
if (data->in_rate == data->out_rate)
|
||||||
data->func = do_resample_copy_c;
|
data->func = do_resample_copy_c;
|
||||||
else {
|
else {
|
||||||
bool is_full = r->i_rate == in_rate;
|
bool is_full = rate == 1.0;
|
||||||
|
|
||||||
data->func = is_full ? do_resample_full_c : do_resample_inter_c;
|
data->func = is_full ? do_resample_full_c : do_resample_inter_c;
|
||||||
#if defined (HAVE_SSE)
|
#if defined (HAVE_SSE)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue