Re:vDSP_conv very slow?
Re:vDSP_conv very slow?
- Subject: Re:vDSP_conv very slow?
- From: Ian Kemmish <email@hidden>
- Date: Thu, 8 Feb 2007 14:18:21 +0000
On 8 Feb 2007, at 12:37 pm, "Cor Jansen" <email@hidden> wrote:
I finally have a simple FIR filter working.
It uses the vDSP_conv function from the Aceleration framework.
But at a filter size of 2000 it already uses 50% of the cpu time.
I'm using a duo Intel core mac-Mini.
1) Make sure everything is quadword aligned. I can't remember which
of the malloc() functions do and don't align - check the manual
pages. I never trust automatic variables to be aligned to anything
larger than their natural alignment, so if you have any automatic
arrays, you might want to double-check them too.
2) Use memmove for copying stuff around. It generally uses vector
instruction in cases where using them will yield an impovement.
3) Instead of making bufSignal[] jsut large enough, and copying
samples around on every call, make it a ring buffer twice (or more)
as big as necssaary, and gradually march through it. Then, you'll
only need to copy samples from the end to the beginning when it wraps
around. You may need to experiment to find the best size here - the
bigger the buffer is, the less copying you do, but the greater the
chance of taking a performance hit from cache misses.
4) Your copy-out loop has a scalar multiply in it. Either vectorise
this, or even better, factor the gain into the filter coefficients in
the first place.
5) Unroll your "add new samples" and "copy result" loops. (Type
"Duff's device" into your favourite search engine.)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
Ian Kemmish 18 Durham Close, Biggleswade, Beds
SG18 8HZ
email@hidden Tel: +44 1767 601361 Mob: +44 7952
854387
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden