Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing FFTWLib (C#): Using fftw.dft_r2c_2d() crashes vshost.exe, or main program if vshost is not running
    primarykey
    data
    text
    <p>As the title states: I'm trying to use Tamas Szalay's <a href="http://www.sdss.jhu.edu/~tamas/bytes/fftwcsharp.html" rel="nofollow noreferrer">C# port of FFTW</a> 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.</p> <p>Details:</p> <pre><code>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 &lt; height; y++) { for (int x = 0; x &lt; 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)); } </code></pre> <p>The console prints up to "3.7". Attempting to run <code>FourierPlan = ...</code> causes the program to crash and a message box to pop-up: </p> <pre><code>vshost.exe has stopped working. </code></pre> <p>Disabling the Visual Studio host process only replaces "vshost.exe" with "FFTFind".</p> <p>Possibly relevant: I'm running this in an x64 environment (Windows Server Standard), but the dlls and programs are x86. This <a href="https://stackoverflow.com/questions/9170885/using-fftwlib-c-cannot-find-libfftw3-3-dll">previously caused a problem in Visual C# 2010 Express</a>, which was solved by switching to the Professional Trial and then manually changing the Configuration Target from "x86" to "Any CPU."</p> <p>UPDATE: Running the provided test code works fine.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload