[pulseaudio-discuss] [PATCH] resmple: Switch to speex-float-1 by default

Peter Meerwald pmeerw at pmeerw.net
Mon Mar 25 03:55:28 PDT 2013


Hello,

> This consumes less power, has low (no?) perceivable difference, and
> allows the default configuration to work out of the box on low-end
> systems (such as netbooks).

I can confirm the claim w.r.t. lower CPU requirements

here are some benchmark results I have sitting around:

ARM Cortex/A8, speex with NEON patch:
float speex-float-0 244049 254090 410431 183777 208527
float speex-float-1 287354 294861 301880 175690 264252
float speex-float-3 683045 465271 495545 349732 555481
float speex-float-7 930664 889618 1373138 781769 1069061
float trivial 972809 1226593 995636 339997 898194
float src-linear 455963 464508 490814 437317 536163
float src-sinc-fastest 459565 462586 496368 577454 434021
float src-sinc-medium-quality 454834 467682 642304 381592 430115
s16 speex-fixed-0 379944 394593 527587 283386 318298
s16 speex-fixed-1 416473 436401 451111 477662 372162
s16 speex-fixed-3 587738 604034 874023 421630 543090
s16 speex-fixed-7 1242645 1033325 1519623 852295 1182068
s16 trivial 926270 1015777 1066528 324401 636840
s16 ffmpeg 723023 604553 869476 503754 594849

Core i7, 64bit:
float speex-float-0 29805 41759 109823 19529 33292
float speex-float-1 40288 35410 131886 24464 33816
float speex-float-3 60871 62089 212634 48750 53208
float speex-float-7 97132 99978 447325 93265 109369
float trivial 38604 38853 37175 16705 27732
float src-linear 52791 50727 58739 20928 36922
float src-sinc-fastest 524501 531380 540299 434588 502243
float src-sinc-medium-quality 1054445 1056684 1183020 968456 1016723
s16 speex-fixed-0 36327 29911 109888 23129 37487
s16 speex-fixed-1 34938 43595 129149 28608 39536
s16 speex-fixed-3 62584 57430 217398 51916 62352
s16 speex-fixed-7 101670 98314 444393 100910 99825
s16 trivial 41626 36157 38977 27114 26112
s16 ffmpeg 57997 59671 66401 57464 62370

columns are
(1) working format (s16 or float)
(2) resampler used (src-* are from libsamplerate)
(3) 16000 -> 48000
(4) 32000 -> 48000
(5) 44100 -> 48000
(6) 48000 -> 16000
(7) 48000 -> 32000

observations:
* float-1 is faster than float-3
* quality assessment is missing
* speex-float is faster than speex-fixed
* libresample is slow and GPL
* trivial is not fast
* ffmpeg is not fast but does not depend on the conversion ratio significantly
* float is faster than fixed on ARM

regards, p.

> ---
>  man/pulse-daemon.conf.5.xml.in | 2 +-
>  src/pulsecore/core.c           | 2 +-
>  src/pulsecore/resampler.c      | 6 +++---
>  3 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/man/pulse-daemon.conf.5.xml.in b/man/pulse-daemon.conf.5.xml.in
> index 744e94e..2509ba1 100644
> --- a/man/pulse-daemon.conf.5.xml.in
> +++ b/man/pulse-daemon.conf.5.xml.in
> @@ -100,7 +100,7 @@ USA.
>        desktop CPUs the float point resampler is a lot faster, and it
>        also offers slightly better quality. See the output of
>        <opt>dump-resample-methods</opt> for a complete list of all
> -      available resamplers. Defaults to <opt>speex-float-3</opt>. The
> +      available resamplers. Defaults to <opt>speex-float-1</opt>. The
>        <opt>--resample-method</opt> command line option takes precedence.
>        Note that some modules overwrite or allow overwriting of the
>        resampler to use.</p>
> diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c
> index 98ad16e..2ca50c2 100644
> --- a/src/pulsecore/core.c
> +++ b/src/pulsecore/core.c
> @@ -141,7 +141,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, pa_bool_t shared, size_t shm_size) {
>      c->disable_remixing = FALSE;
>      c->disable_lfe_remixing = FALSE;
>      c->deferred_volume = TRUE;
> -    c->resample_method = PA_RESAMPLER_SPEEX_FLOAT_BASE + 3;
> +    c->resample_method = PA_RESAMPLER_SPEEX_FLOAT_BASE + 1;
>  
>      for (j = 0; j < PA_CORE_HOOK_MAX; j++)
>          pa_hook_init(&c->hooks[j], c);
> diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c
> index 0a3a678..bc45f06 100644
> --- a/src/pulsecore/resampler.c
> +++ b/src/pulsecore/resampler.c
> @@ -236,7 +236,7 @@ pa_resampler* pa_resampler_new(
>  
>      if (method == PA_RESAMPLER_AUTO) {
>  #ifdef HAVE_SPEEX
> -        method = PA_RESAMPLER_SPEEX_FLOAT_BASE + 3;
> +        method = PA_RESAMPLER_SPEEX_FLOAT_BASE + 1;
>  #else
>          if (flags & PA_RESAMPLER_VARIABLE_RATE)
>              method = PA_RESAMPLER_TRIVIAL;
> @@ -565,10 +565,10 @@ pa_resample_method_t pa_parse_resample_method(const char *string) {
>              return m;
>  
>      if (pa_streq(string, "speex-fixed"))
> -        return PA_RESAMPLER_SPEEX_FIXED_BASE + 3;
> +        return PA_RESAMPLER_SPEEX_FIXED_BASE + 1;
>  
>      if (pa_streq(string, "speex-float"))
> -        return PA_RESAMPLER_SPEEX_FLOAT_BASE + 3;
> +        return PA_RESAMPLER_SPEEX_FLOAT_BASE + 1;
>  
>      return PA_RESAMPLER_INVALID;
>  }
> 

-- 

Peter Meerwald
+43-664-2444418 (mobile)


More information about the pulseaudio-discuss mailing list