# Real - Complex Packed (RCPack2D) Format

The forward Fourier transform of a real two-dimensional image data yields a matrix of complex results which has conjugate-symmetric properties. Intel IPP functions use packed format RCPack2D for storing and retrieving data of this type. Accordingly, real flavors of the inverse Fourier transform functions convert packed complex conjugate-symmetric data back to its real origin. The RCPack2D format exploits the complex conjugate symmetry of the transformed data to store only a half of the resulting Fourier coefficients. For the N by M transform, the respective FFT and DFT functions actually store real and imaginary parts of the complex Fourier coefficients A(i,j) for i = 0,...,M-1; j = 0,... N/2 in a single real array of dimensions (N, M). The RCPack2D storage format is slightly different for odd and even M and is arranged in accordance with the following tables:

RCPack2D Storage for Odd Number of Rows
Re A(0,0) Re A(0,1) Im A(0,1) ... Re A(0,(N-1)/2) Im A(0,(N-1)/2) Re A(0,N/2)
Re A(1,0) Re A(1,1) Im A(1,1) ... Re A(1,(N-1)/2) Im A(1,(N-1)/2) Re A(1,N/2)
Im A(1,0) Re A(2,1) Im A(2,1) ... Re A(2,(N-1)/2) Im A(2,(N-1)/2) Im A(1,N/2)
... ... ... ... ... ... ...
Re A(M/2,0) Re A(M-2,1) Im A(M-2,1) ... Re A(M-2,(N-1)/2) Im A(M-2,(N-1)/2) Re A(M/2,N/2)
Im A(M/2,0) Re A(M-1,1) Im A(M-1,1) ... Re A(M-1,(N-1)/2) Im A(M-1,(N-1)/2) Im A(M/2,N/2)
RCPack2D Storage for Even Number of Rows
Re A(0,0) Re A(0,1) Im A(0,1) ... Re A(0,(N-1)/2) Im A(0,(N-1)/2) Re A(0,N/2)
Re A(1,0) Re A(1,1) Im A(1,1) ... Re A(1,(N-1)/2) Im A(1,(N-1)/2) Re A(1,N/2)
Im A(1,0) Re A(2,1) Im A(2,1) ... Re A(2,(N-1)/2) Im A(2,(N-1)/2) Im A(1,N/2)
... ... ... ... ... ... ...
Re A(M/2-1,0) Re A(M-3,1) Im A(M-3,1) ... Re A(M-3,(N-1)/2) Im A(M-3,(N-1)/2) Re A(M/2-1,N/2)
Im A(M/2-1,0) Re A(M-2,1) Im A(M-2,1) ... Re A(M-2,(N-1)/2) Im A(M-2,(N-1)/2) Im A(M/2-1,N/2)
Re A(M/2,0) Re A(M-1,1) Im A(M-1,1) ... Re A(M-1,(N-1)/2) Im A(M-1,(N-1)/2) Re A(M/2,N/2)

The shaded columns to the right side of the tables indicate values for even N only.

Note the above tables show the arrangement of coefficients for one channel. For multichannel images the channel coefficients are clustered and stored consecutively, for example, for 3-channel image they are stored in the following way: C1-Re A(0,0); C2-Re A(0,0); C3-Re A(0,0); C1-Re A(0,1); C2-Re A(0,1); C3-Re A(0,1); C1-Im A(0,1); C2-Im A(0,1); ...

The remaining Fourier coefficients are obtained using the following relationships based on conjugate-symmetric properties:

A(i,j) = conj(A(M-i,N-j)), i = 1,..., M-1; j = 1,..., N-1

A(0,j) = conj(A(0,N-j)), j = 1,..., N-1

A(i,0) = conj(A(M-i,0)), i = 1,..., M-1