[pulseaudio-discuss] A pulseaudio appliance

Lennart Poettering lennart at poettering.net
Sat Oct 13 05:27:22 PDT 2007


On Sat, 13.10.07 00:15, Seth Forshee (seth.forshee at gmail.com) wrote:

> 
> Hi Lennart,
> 
> On Sat, Oct 13, 2007 at 01:05:16AM +0200, Lennart Poettering wrote:
> > > 1) Resampling.  PA uses libsamplerate, which uses a lot of
> > >    floating-point math.  There was some discussion about a fixed-point
> > >    resampling library a while back (I think it came from the Speex
> > >    project), but I haven't seen anything about it in a while.
> > 
> > The code has been available in the "lennart" branch in SVN for a
> > while. Just pass --resample-method=speex-float-0 or similar.
> 
> Cool, that's good to hear.

Of course, this should read --resample-method=speex-fixed-0, sorry
for the confusion.


> > > 2) Volume scaling.  PA converts its internal, dB-based volume level into
> > >    a floating-point linear scale that is applied to each sample of a
> > >    stream.  The code that does this for a single stream is reasonably
> > >    sane (although I would argue that the internal volume representation
> > >    should be the linear version instead of the dB version so that it
> > >    would only need to be converted when the volume is set), but the code
> > >    for scaling multiple streams is horrendously inefficient.  I did a
> > >    quick rewrite of this code that took CPU utilization on a P4 class PC
> > >    from over 30% to under 10% when playing multiple streams (I don't
> > >    remember exactly how many, probably 2-3).  I never cleaned up the
> > >    code enough to bother with submitting a patch though.
> > 
> > Hmm, the current code translates the volume spec first, and only
> > after that runs the inner loop. Should be OK. It's not liboil
> > accelerated, but should be good enough.
> > 
> > http://pulseaudio.org/browser/branches/lennart/src/pulsecore/sample-util.c#L344
> 
> Yes, this code looks fairly good at first glance.  But I was actually
> referring to another section of code.  It's the volume scaling in
> pa_mix() for per-stream volumes that I found to be extremely slow.

Indeed, the code sucks. I'll fix that. Thanks for the pointer.

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net         ICQ# 11060553
http://0pointer.net/lennart/           GnuPG 0x1A015CC4



More information about the pulseaudio-discuss mailing list