[pulseaudio-discuss] Resampler quality evaluation: now with room noise!

David Henningsson david.henningsson at canonical.com
Tue Sep 30 01:21:42 PDT 2014



On 2014-09-30 09:04, David Henningsson wrote:
> On 2014-09-27 17:56, Alexander E. Patrakov wrote:
>> 26.09.2014 02:56, David Henningsson wrote:
>>>
>>>
>>> On 2014-09-25 21:54, Alexander E. Patrakov wrote:
>>>> The conclusion of that work was that we need to use speex-float-5 to
>>>> match the metric of "never introducing audible distortions" (that other
>>>> operating systems meet by default) when resampling from 44.1 to 48 kHz.
>>>> However, David Henningsson argued that this "never" included a lot of
>>>> unrealistic worst-case conditions, i.e. that the quality achieved in
>>>> proprietary OSes is actually overkill.
>>>
>>> To elaborate, I'm not saying they're completely unrealistic, I'm don't
>>> doubt that the resampler noises are hearable in *some* environments. The
>>> question is how common it is.
>>>
>>> We need to find a balance between quality on one side and CPU
>>> consumption on the other side.
>>>
>>> We used to have speex-float-3 but changed to speex-float-1 because
>>> distros had changed, which in turn was because people complained that PA
>>> took too much CPU. So speex-float-3 was causing problems for some
>>> people.
>>
>> I think (but cannot claim this yet as a scientific fact) that we can
>> safely ignore these CPU-overuse or battery-life complaints at least on
>> Sandy Bridge CPUs if speex has been compiled with SSE support. I have
>> directly checked the impact of the resampler choice on the battery life
>> of my Sony Vaio Z23A4R laptop, under the following conditions:
>>
>> 1. The whole system is in initramfs. The initramfs just plays a
>> CD-quality wav file with some music of ~1 minute length in a loop with
>> paplay, and after each loop, logs the battery energy until less than 2%
>> of energy remains in the battery. Then it saves the log to the SSD. I.e.
>> there is no SSD access until the final saving of the log.
>>
>> 2. The screen is turned off. The hardware radio switch is also off.
>>
>> 3. Absolutely no keyboard/touchpad interaction.
>>
>> 4. Default volume, headphones connected, resampling from 44.1 to 48 kHz
>> achieved by setting both default and alternate rates to 48000 Hz in
>> daemon.conf.
>>
>> 5. laptop-mode-tools are installed, in their default configuration.
>>
>> 6. The kernel version is 3.17-rc5, PulseAudio is from the yesterday's
>> git. Everything else is from yesterday's Gentoo amd64.
>>
>> All these conditions are aimed at obtaining reproducible results and
>> saving as much energy as possible, so that any variations due to the
>> resampler are clearly visible.
>>
>> The CPU is: Intel(R) Core(TM) i7-2640M CPU @ 2.80GHz (with available
>> frequencies from 0.8 to 3.5 GHz).
>>
>> Result: with speex-float-1, the laptop lasted 26371 seconds, while with
>> speex-float-5, the result was "only" 25997 seconds. I.e. less than 1.5%
>> of difference (and even less under more realistic conditions, i.e. with
>> the SSD, WiFi and display being on), or only 81 mW of extra power
>> consumed. And I don't yet know the standard error (will repeat the test
>> several times and report separately).
>>
>> Note: for "real" mobile devices like phones, the impact will be more
>> significant. So I limit my "ignore complaints as invalid" proposal only
>> to laptops with Sandy Bridge CPUs.
>
> Thanks for the test. i7 Sandy Bridge CPUs are not my primary concern
> either (if you have an i7 CPU then you probably have a big battery to
> fuel it, too), but what about Raspberry Pi, tablets, etc. And everything
> in between.
>
> That said, even for an i7 Sandy bridge, the question is how often will
> you be annoyed because of resampler noises, vs how often will you be
> annoyed because you've run out of battery.
>
> As a related question, when you say that we have a worse resampler than
> "proprietary OSes", that's only desktop OSes you're comparing us to, I
> assume - not iOS, Android, etc.

I did a quick test here. I have an old laptop that runs Ubuntu 12.04, 
with default installed PulseAudio 1.1. Its processor is Intel Pentium M 
@ 1.4 GHz [1], single core, with an AC'97 codec.

Running speaker-test will automatically cause resampling from 48 kHz 
down to 44.1 kHz, as verified with "pactl list sink-inputs".

Under speex-float-1, PulseAudio consumes about 4.3% CPU. With 
speex-float-3, PA consumes ~8% CPU. With speex-float-5, PA consumes ~13% 
CPU.


-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic

[1] I think it's this one: http://ark.intel.com/products/27575


More information about the pulseaudio-discuss mailing list