Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.

Packed vs extended complex format?

lkeene
Beginner
188 Views

Hello, I have a quick question regarding the RCPack2D format and extended complex format. I'd like to normalize the result of an FFT by dividing it by its magnitude. Here's what I'm doing:

1) Compute forward FFT via "ippiFFTFwd_RToPack_32f_C1R". Store in "Result1_complexPacked".

2) Compute magnitude of above result via "ippiMagnitudePack_32f_C1R". Store in "Result2_real".

3) Normalize "Result1_complexPacked" by computing (Result1_complexPacked / Result2_real). To do this:

3a) Unpack "Result1_complexPacked" via "ippiPackToCplxExtend_32f32fc_C1R". Store in "Result1_unpacked".

3b) Loop through and normalize in-place:

for(int a = 0; a < Height; a++)

{

int denominatorRowOffset = (a * Width);

int numeratorRowOffset = (a * 2) * Width;

for(b = 0; b < Width; b++)

{

float denominator = *(Result2_real + denominatorRowOffset + b);

*(Result1_unpacked + numeratorRowOffset + (b * 2)) =*(Result1_unpacked + numeratorRowOffset + (b * 2)) / denominator; // Real component.

*(Result1_unpacked + numeratorRowOffset + (b * 2) + 1) =*(Result1_unpacked + numeratorRowOffset + (b * 2) + 1) / denominator; // Imaginary component.

}

}

3c) Repack "Result1_unpacked" for inverse FFT via "ippiCplxExtendToPack_32fc32f_C1R".

Is my understanding/usage of the Packed->Unpacked->Packed operations as illustrated above correct? It's the output ordering I'm unclear on.

-L

0 Kudos
1 Reply
Chao_Y_Intel
Employee
188 Views

Hello,

This code looks fine. For step 3 ( 3a - 3c), possbilly it has some more efficient way:

It can divide the RCPack2D data by its magnitude according to RCPack2D format description in the manual. It does not need to convert to CplxExtend format, and then convert back.

Thanks,

Chao

Reply