views:

334

answers:

1

Hi.

I'm looking for a fast way to turn an array of complex numbers into polar representation.

E.g, given a complex number X I want to turn it into polar representation like this:

  Q.phase    = atan2 (X.imag / X.real);
  Q.magniude = sqrt  (X.imag * X.imag + X.real * X.real);

I need to do this conversion around 400 thousand times per second on a fixed point DSP. My numbers are in 1.15.16 fixed point format and I'd like to keep it that way.

The DSP is very fast when I execute things in unconditional loops, e.g. when the loop-count known in advance. It crawls when it has to do subroutine calls and divisions. Cache misses are very slow as well, so I'd like not to use large lookup-tables if possible (4k would be okay.. I can set aside a bit of on-chip memory for that task).

Currently I process atan2 as a polynomial approximation and use the well-known bitwise algorithm for the integer square-root. That's not fast enough.

I have the feeling that there should be a more efficient way to get the result. Maybe some of the computations from sqrt and atan can be shared? Or is there an iterative way to get my results?

+1  A: 

Check out this CORDIC DSP optimization Hard to tell if it helps in your case though.

MaR
Nice article! Love the idea to use multipliers to speed up the computation and remove the branches.. I'll give that a try.
Nils Pipenbrinck
That's what I was looking for.. Thank you very much.
Nils Pipenbrinck
On the same subject see also http://www.ddj.com/cpp/207000448
Clifford