[pulseaudio-discuss] [RFC PATCH] softvolume: implement fast volume translation

Maarten Bosmans mkbosmans at gmail.com
Wed Oct 19 02:00:03 PDT 2011


2011/10/19 Wang Xingchao <wangxingchao2011 at gmail.com>:
> hi,
>
> I got not stable results, which means the optimization is not as good
> as expected.
> All results based on plain c volume function, not touch sse part.

It's good to test your optimizations. Be sure to also test with
various lengths of the memblock (1021 below). In realworld usage, I
saw numbers like 4, 1021, 20000.

Also don't make assumptions on what method is faster. For example in the line
        if (PA_UNLIKELY(++channel >= channels))
in the exisiting svolume code, it actually is a performance
improvement to remove the PA_UNLIKELY. That's just to show that the
original author probably didn't test this.

> All tests are for format s16ne.
>
> Result1: channels 4, with same volume, with patch; samples 1021, loop 1000;
> Result2: channels 4, with same volume, without patch; samples 1021, loop 1000;
> Result1: channels 4, with different volumes; samples 1021, loop 1000;

> Attached the raw patch for the test. As Maarten had done some work, i
> decide to check them first.

Why do do you two channels at the same time? Won't that cause problems
when the number of samples that is being processed isn't even? The
test case in the commit I linked to earlier should have caught this.
It might also be faster to treat the samples just as a mono stream.

I like the for(;length;length--) approach better than introducing a
separate counter i.

Maarten


More information about the pulseaudio-discuss mailing list