As the title states: I'm trying to use Tamas Szalay's C# port of FFTW in Visual C# 2010 Professional (Trial), and I'm getting the above error when I try to use a two-dimensional transform. (The problem persists when I switch to dft_c2r_2d()). Other functions (in particular, fftw.malloc()) work fine.
Details:
unsafe void FFTFind(IntPtr Scan0, int stride, int width, int height, Rectangle roi)
{
IntPtr ComplexImage = fftw.malloc(width * height * 16);
double[] pComplexImage = new double[width * height * 2];
byte* pScan0 = (byte*)Scan0.ToPointer();
Console.WriteLine("3");
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
pComplexImage[x * y * 2] = pScan0[y * stride + x * 4];
//pComplexImage[x * y * 2] = pScan0[y * stride + x];
}
}
Console.WriteLine("3.05");
Marshal.Copy(pComplexImage, 0, ComplexImage, width * height * 2);
Console.WriteLine("Starting FFTFind");
FFTFindKernel(ComplexImage, stride, width, height, roi);
}
unsafe void FFTFindKernel(IntPtr imageIn, int stride, int width, int height, Rectangle roi)
{
Console.WriteLine("3.1");
IntPtr hScan0 = (IntPtr) GCHandle.Alloc(imageIn, GCHandleType.Pinned);
Console.WriteLine("3.3");
IntPtr FourierPlan;
Console.WriteLine("3.5");
int start = System.Environment.TickCount;
Console.WriteLine("3.7");
FourierPlan = fftw.dft_r2c_2d(width, height, hScan0, hScan0, 0);
Console.WriteLine("4");
fftw.execute(FourierPlan);
Console.WriteLine("Time: {0} ms", (System.Environment.TickCount - start));
}
The console prints up to "3.7". Attempting to run FourierPlan = ...
causes the program to crash and a message box to pop-up:
vshost.exe has stopped working.
Disabling the Visual Studio host process only replaces "vshost.exe" with "FFTFind".
Possibly relevant: I'm running this in an x64 environment (Windows Server Standard), but the dlls and programs are x86. This previously caused a problem in Visual C# 2010 Express, which was solved by switching to the Professional Trial and then manually changing the Configuration Target from "x86" to "Any CPU."
UPDATE: Running the provided test code works fine.