[pulseaudio-discuss] Purpose of 8-byte buffer alignment in cpu-mix-test.c

Peter Meerwald-Stadler pmeerw at pmeerw.net
Sun Nov 20 09:28:06 UTC 2016


Hi Tanu,

> > Do you happen to remember why the audio buffers in run_mix_test() in
> > src/tests/cpu-mix-test.c are forced to have 8-byte alignment? I plan to
> > replace the stack-allocated buffers with regular memblocks, and the
> > memblock backing memory is only aligned to 4 bytes on 32-bit machines.
> > It's possible to still have the old alignment behaviour, but that
> > requires extra code, and if 4-byte alignment is equally fine, then I'd
> > prefer to avoid the extra code.
> 
> Also, why is the alignment so carefully controlled? All tests are run
> on a buffer that begins one sample after the 8-byte alignment boundary.
> Is this done to catch bugs related to weird (but valid) sample
> alignments?

probably this also constitutes a worst-case runtime-wise; I can't remember 
really

it would be nice to have explicit alignment requirements/guarantees on 
buffers that are potentially processed by SIMDy code; alignment might make 
the code run faster

regards, p.

-- 

Peter Meerwald-Stadler
+43-664-2444418 (mobile)


More information about the pulseaudio-discuss mailing list