extern "C" void cudaFFT(float * DataIn, float *DataOut, int size_x, int size_y)
{
	cufftHandle plan1;
	cufftHandle plan2;
	cufftComplex *odata;
	cufftReal *idata;
	cufftResult cufftRes;

	//CopyClearBuffer<<<size_x * size_y * 2 /128, 128>>>(DataIn, idata, size_x, size_y);
	cudaMalloc((void **)&odata, sizeof(cufftComplex)*size_x*size_y);

	cufftRes = cufftPlan2d(&plan1, size_x, size_y, CUFFT_R2C);
	if (cufftRes != CUFFT_SUCCESS)
	{
		printf("Plan2d failed:%d\n", cufftRes);
	}

	cufftRes = cufftExecR2C(plan1, DataIn, odata);
	if (cufftRes != CUFFT_SUCCESS)
	{
		printf("FFT failed error:%d\n", cufftRes);
	}

	cufftRes = cufftPlan2d(&plan2, size_x, size_y, CUFFT_C2R);
	cufftExecC2R(plan2, odata, DataOut);

      cufftDestroy(plan1);
	cufftDestroy(plan2);
	cudaFree(odata);

	cutilSafeCall( cudaThreadSynchronize() );
}