Is there a ready-made function in cuda used for pading '0' for a 2D image before cufft

i want to pad zeros around an image before cufft_R2C, but it has be an 1D array, is there any method to do, any suggestion is expected, thanks! by the way, i also want to do fftshift like matlab after pading.

You could allocate memory for the padded image, cudaMemset it to 0, then use cudaMemcpy2d to copy your image to it.

Quite possibly I’m missing something here, but the cudaMemset may be unecessary if the array is in global space, reading this.

thanks, i find the ‘nppiCopyConstBorder_32f_C1R’ function in CUDA NPP library, but the (0,0) point is the center of image, i want move it to top left corner, any method to do

for all i know, this method is put my image to the top left corner of the pad image, what if i want put my image to the center of the pad image