Alright now I'm getting excited. I have been planning a distance measurement system with images and this transformation could fit the bill nicely. Although I won't be worried about support 10.5 clients.

Coooool,

Ben
On Sep 18, 2009, at 11:50 AM, Christopher Wright wrote:

Hmm.. that's making my head hurt just thinking about it ;)

Yep, mine too :) DSP absolutely kicked my butt with Laplace transforms and FFT stuff... don't melt your brains :)

FFTW sounds interesting too. Any idea how fast these things are in
practice? FFTW has a benchmark page but everything's measured in
MFLOPs. How long it took to do something would be more useful. Is it
reasonable to expect it to handle say 1024x1024 images at 15fps?


I haven't used FFTW in several years, but it was very fast when I used it (I never touched 2D FFT except for in theory, so I can't give any estimates on speed, even for 2003-2004-era hardware). Accelerate.framework is also extraordinarily fast -- we use that in AudioTools to get our nice frequency spectrum stuff out (NSNumber is our biggest bottleneck there, believe it or not, not actual computation).

I _think_ 2D FFT is just doing a bunch of 1D FFTs (first horizontally, then vertically) (conceptually -- the library should do this for you without you caring about the details). So, if correct, you'd in effect be doing 1024 row FFTs, and then 1024 column FFTs on the output rows. So that's about 2048 1024-point FFTs. 15fps is 66.67ms per frame, so you're looking at spending no more than 0.03ms per FFT... Let's run some numbers:

I did some testing on AudioTools, and doing a 1024-point FFT takes about this long:
9/18/09 11:37:18 AM Quartz Composer[84793] now-then = 0.000022 sec
9/18/09 11:37:18 AM Quartz Composer[84793] now-then = 0.000024 sec
9/18/09 11:37:18 AM Quartz Composer[84793] now-then = 0.000024 sec
9/18/09 11:37:18 AM Quartz Composer[84793] now-then = 0.000023 sec
9/18/09 11:37:18 AM Quartz Composer[84793] now-then = 0.000021 sec
9/18/09 11:37:18 AM Quartz Composer[84793] now-then = 0.000021 sec
9/18/09 11:37:18 AM Quartz Composer[84793] now-then = 0.000020 sec

so you're looking at about 0.023 milliseconds per FFT (using Accelerate.framework), so if my math is right above, that'll be 0.023ms*2048 = 47ms a piece, or just under your limit. This is assuming everything is done serially, and with minimal overhead. You can actually do rows in parallel, and the columns too (if 2D is in fact just a 2nd pass). My measurements above include the necessary data swizzling, so that shouldn't be an extra hidden cost, though frame capture and other filtering will be.

(I don't know if Accelerate.framework will automatically parallelize a 2D transform -- thread creation isn't cheap, so it might be beyond the scope of Accelerate).

I'm thinking 15fps is _possible_ (this is on an old 1.83GHz Core2Duo macbook, so everyone else is likely to be faster), 10 is realistic (given all the other stuff that's going to be taking place per-frame).

--
[ christopher wright ]
[email protected]
http://kineme.net/

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected] )
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/ben%40cogs.com

This email sent to [email protected]

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to