[pulseaudio-discuss] [PATCH 2/4] Enabled libsoxr resampler backend.
Peter Meerwald
pmeerw at pmeerw.net
Wed Jan 7 08:39:07 PST 2015
Hello,
> On Wednesday 07 January 2015 15:41:14 David Henningsson wrote:
> > On 2015-01-07 15:08, Andrey Semashev wrote:
> > > Added ID and names for the resampler presets and also corrected the
> > > working sample rate deduction to take the new resampler into account.
> > > Removed duplicate condition checks from the deduction code. ---
> > >
> > > src/pulsecore/resampler.c | 23 ++++++++++++++++++-----
> > > src/pulsecore/resampler.h | 4 ++++
> > > 2 files changed, 22 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c
> > > index 183d05f..17919a3 100644
> > > --- a/src/pulsecore/resampler.c
> > > +++ b/src/pulsecore/resampler.c
> > > @@ -111,6 +111,15 @@ static int (* const init_table[])(pa_resampler *r) =
> > > {
> > >
> > > [PA_RESAMPLER_AUTO] = NULL,
> > > [PA_RESAMPLER_COPY] = copy_init,
> > > [PA_RESAMPLER_PEAKS] = pa_resampler_peaks_init,
> > >
> > > +#ifdef HAVE_SOXR
> > > + [PA_RESAMPLER_SOXR_MQ] = pa_resampler_soxr_init,
> > > + [PA_RESAMPLER_SOXR_HQ] = pa_resampler_soxr_init,
> > > + [PA_RESAMPLER_SOXR_VHQ] = pa_resampler_soxr_init,
> > > +#else
> > > + [PA_RESAMPLER_SOXR_MQ] = NULL,
> > > + [PA_RESAMPLER_SOXR_HQ] = NULL,
> > > + [PA_RESAMPLER_SOXR_VHQ] = NULL,
> > > +#endif
> > >
> > > };
> > >
> > > static pa_resample_method_t choose_auto_resampler(pa_resample_flags_t
> > > flags) {>
> > > @@ -278,10 +287,11 @@ static pa_sample_format_t choose_work_format(
> > >
> > > }
> > >
> > > /* Else fall trough */
> > >
> > > case PA_RESAMPLER_PEAKS:
> > > - if (a == PA_SAMPLE_S16NE || b == PA_SAMPLE_S16NE)
> > > - work_format = PA_SAMPLE_S16NE;
> >
> > Were the rows above removed on purpose? I suppose the behaviour should
> > be different between SOXR and PEAKS here.
>
> Yes, I did that intentionally. The point is that audio processing should be
> done with max precision of the input and output signals. I don't see why PEAKS
> should be special in this regard - it does support both int16 and float
> samples.
in any case, such change should be in a separate, independent patch
peaks is a bit special as it just computes the maximum absolute sample
magnitude over a number of samples; switching to float does not improve
quality but causes (potentially expensive) floating point comparisions
I think the current special case code for peaks, i.e.
if (a == PA_SAMPLE_S16NE || b == PA_SAMPLE_S16NE)
work_format = PA_SAMPLE_S16NE;
makes sense
p.
> > > - else if (sample_format_more_precise(a, PA_SAMPLE_S16NE) ||
> > > - sample_format_more_precise(b, PA_SAMPLE_S16NE))
> > > + case PA_RESAMPLER_SOXR_MQ:
> > > + case PA_RESAMPLER_SOXR_HQ:
> > > + case PA_RESAMPLER_SOXR_VHQ:
> > > + if (sample_format_more_precise(a, PA_SAMPLE_S16NE) ||
> > > + sample_format_more_precise(b, PA_SAMPLE_S16NE))
> > >
> > > work_format = PA_SAMPLE_FLOAT32NE;
> > >
> > > else
> > >
> > > work_format = PA_SAMPLE_S16NE;
>
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>
--
Peter Meerwald
+43-664-2444418 (mobile)
More information about the pulseaudio-discuss
mailing list