remap: support S32NE work format

So far PulseAudio only supported two different work formats: S16NE if
it's sufficient to represent the input and output formats without loss
of precision and FLOAT32NE in all other cases. For systems that use
S32NE exclusively, this results in unnecessary conversions from S32NE to
FLOAT32NE and back again.

Add S32NE remap operations and make use of them (for the COPY and
TRIVIAL resamplers) if both input and output format are S32NE. This
avoids the back and forth conversions between S32NE and FLOAT32NE,
significantly improving performance for those cases.
This commit is contained in:
Sascha Silbe 2019-03-26 10:35:55 +01:00 committed by Arun Raghavan
parent 1e4fb61436
commit 034b77823a
7 changed files with 327 additions and 14 deletions

View file

@ -286,6 +286,14 @@ static pa_sample_format_t choose_work_format(
work_format = a;
break;
}
/* If both input and output are using S32NE and we don't
* need any resampling we can use S32NE directly, avoiding
* converting back and forth between S32NE and
* FLOAT32NE. */
if ((a == PA_SAMPLE_S32NE) && (b == PA_SAMPLE_S32NE)) {
work_format = PA_SAMPLE_S32NE;
break;
}
/* Else fall through */
case PA_RESAMPLER_PEAKS:
/* PEAKS, COPY and TRIVIAL do not benefit from increased