# How to deinterlace complex from real data

## How to deinterlace complex from real data

I need to apply separate functions to real and complex data like so:for (int i = 1; i < res / 2 + 1; i++) {output[2 * i] = magnitudes[i] * cosf(phases[i]); output[2 * i + 1] = magnitudes[i] * sinf(phases[i]);}
My IPP code looks like this (+1s are due to CCS format):ippsCos_32f_A11(phases + 1, phaseCos + 1, res / 2);ippsSin_32f_A11(phases + 1, phaseSin + 1, res / 2);
// deinterlace CCS format data output into real[] and imag[] arrays (?)ippsMul_32f_A24(phaseCos + 1, magnitudes + 1, real, res / 2);ippsMul_32f_A24(phaseSin + 1, magnitudes + 1, imag, res / 2);
To my knowledge there are no FFT formats that pack data into contiguous real and imaginary parts. Thanks

4 posts / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.

Aha! Just found ippsCplxToReal_32fc. Guess I used poor search keywords.

These IPPs are really having bad sense of Grammar. For instance ippsRealToCplx_32f should mean it converts real numbers to complex whereas it does just the opposite - it is converting Complex to real. Just nuts !! what say ?

>>...How to deinterlace complex from real data...

There are two functions in DSP domain of IPP and here are short descriptions from ipps.h header file:

ippsCplxToReal - form the real and imaginary parts of the input complex vector

and

ippsRealToCplx - form complex vector from the real and imaginary components

and, as you can see, ippsRealToCplx needs to be used in your case.