Eric Wong <normalper...@yhbt.net> writes: > Mans Rullgard <m...@mansr.com> wrote: >> Also check for the aligned_alloc() function and alias to Microsoft's >> _aligned_malloc() if necessary. > > How much does aligned_alloc help performance for you (and with which > settings)?
It's required for the SSE2 and AVX code. Without proper alignment it simply crashes (that's how the CPU works). The speedup of the sdm filter with SSE2/AVX is substantial. > I'm on an older system with only memalign and posix_memalign, and > trying to enable it didn't change performance with "--multi-thread > --buffer=131072" on a 4-core AMD Phenom II X4 945 That CPU doesn't have AVX so 16-byte alignment is enough, and plain malloc usually provides that. It obviously doesn't hurt to add support for memalign as well even though it is considered obsolete. If you do that, you should also take care of #including malloc.h. > --- a/src/util.h > +++ b/src/util.h > @@ -194,8 +194,13 @@ > #define LSX_ALIGN(n) > #endif > > +#define HAVE_MEMALIGN > + > #ifdef HAVE_ALIGNED_ALLOC > #define aligned_free(p) free(p) > +#elif defined(HAVE_MEMALIGN) > + #define aligned_alloc(a, s) memalign(a, s) > + #define aligned_free(p) free(p) > #elif defined _MSC_VER > #define aligned_alloc(a, s) _aligned_malloc(s, a) > #define aligned_free(p) _aligned_free(p) -- Måns Rullgård ------------------------------------------------------------------------------ _______________________________________________ SoX-devel mailing list SoX-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sox-devel