FFT packing Pakcing format in CUFFT

I am using the CUFFT library for calculating the Fourier Transform of images. I am trying to display the magnitude of the Fourier transform calculated, but the displayed FFT is not what it should look like. I am trying to display the square-root of sum of real value and complex value in the FFT matrix. Attached image shows the display. I am assuming there is some sort of packing happening in CUDA for the FFT matrix (I guess this from the fact that the last dimension in the FFT matrix is reduced in half by CUFFT to avoid saving redundant values - the documentation says so). Can someone explain what that packing scheme is, because I want to make changes to the FFT values in the matrix.

Also, the CUFFT documentation is a little unclear about what they mean by rows and columns of the FFT. They say on page 6 of CUDA CUFFT 1.1 library documentation “The transform size in X dimension (number of rows)” and “The transform size in Y dimension (number of columns)”. Does that mean the FFT X dimension is vertical and Y dimension is horizontal?

I am trying to attach an image that shows the input image, the CUFA FFT image, and the expected FFT. Does anyone have any suggestions?

This can be confusing, I found the FFTW documentation to be useful (CUFFT uses the same conventions):

Thanks for your reply, Simon.

FFTW documentation says the last dimension is reduced by half since it holds redundant information anyway. I guess, that explains why half the image is zero. I should be able to recover the bottom half of the image from the top half. But I still cant figure out why the top half of the image is skewed and compressed. Is it possible I am messing up the reading out into the image (I am reading from a cufftComplex array to an array of floats (magnitude of the complex numbers) and then displaying the array of floats as an image you see in the center.

I appreciate your help.

Try making the horizontal dimension half the original width + 1, then reflecting horizontally?

That is, maybe the “last dimension” is width, and not height.

That does work, But you cant just reflect horizontally, I think. Hermitic symmetry works.