[openal] Feedback on OpenAL Soft's x86 build

Lubomir I. Ivanov neolit123 at gmail.com
Thu Jun 21 19:52:31 EDT 2018


On 22 June 2018 at 01:31, Chris Robinson <chris.kcat at gmail.com> wrote:
> Hello,
>
> I'm looking for feedback regarding the 32-bit x86-based builds for OpenAL
> Soft. Currently the build scripts use the compiler's default codegen flags,
> with whatever optimizations CMake passes in. For GCC (and I believe Clang),
> this will typically be a 586 or 686 CPU with an x87 FPU, without MMX or SSE.
> The SSE-enhanced functions are still built and selected at runtime as
> necessary, but code that's not written specifically using SSE intrinsics
> still uses the x87 instruction set.
>
> This presents some problems related to performance. Particularly with the
> biquad filters, reverb, and other kinds of decaying feedback loops, x87
> processing results in denormal (ridiculously small) numbers, which is
> extremely slow for the FPU to deal with. It is possible to disable denormal
> numbers with SSE and SSE2, instead treating them as 0, however this only
> applies to the SSE unit so the calculations done on the x87 unit are still
> subject to denormals.
>

hello,

you probably know this already, but the way to deal with denormals
when doing DSP on the x87 is with applying a small DC offset over the
"state" of the unit doing the work.

here is the Direct Form I difference equation of a biquad derived from
the bilinear transformation:

y = a0*x + a1*x1 + a2*x2 - b1*y1 - b2*y2;
x2 = x1;
x1 = x;
y2 = y1;
y1 = y;
out = y;

note that i don't know what biquad form is used in the openal code
base, but if you link me to the source code lines for this i can tell
more.

aX, bX are the BLT coefficients, x is the input, out is the output and
the rest are state variables.
the output here is y - directly.
this is prone to denormals because y can become a very small number.

to apply denormal prevention you need to introduce a small DC offset;
1e-35 should work for both IEEE's binary32 and binary64.

y = a0*x + a1*x1 + a2*x2 - b1*y1 - b2*y2 + DC;
x2 = x1;
x1 = x;
y2 = y1;
y1 = y;
out = y - DC;

notice how the DC offset is introduced in the state, but then removed
when the output is obtained.
so with a couple or less potential FLOPS (as you can also choose to
omit the `- DC` subtraction part) you prevent denormals for any order
DSP filter.
...unless the filter order is so big that the underlying numeric
format is insufficient and renders it unstable.

lubomir
--


More information about the openal mailing list