Problem Installing FFTW as a delegate on windows

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
shekhar.mehta

Problem Installing FFTW as a delegate on windows

Post by shekhar.mehta »

I am trying to install the fft dll as a delegate on WIndows and am not doing the right thing. Please let me know what I should be doing to install the 3 dll's to the right location in windows. I copied the 3 dll;s to the imagemagick directory and restarted

Here is my configure file

ath: [built-in]

Name Value
-------------------------------------------------------------------------------
NAME ImageMagick

Path: C:\Program Files\ImageMagick-6.6.0-Q16\config\configure.xml

Name Value
-------------------------------------------------------------------------------
CC vs8
COPYRIGHT Copyright (C) 1999-2010 ImageMagick Studio LLC
DELEGATES bzlib freetype jpeg jp2 lcms png tiff x11 xml wmf zlib
HOST windows-unknown-linux-gnu
LIB_VERSION 0x660
LIB_VERSION_NUMBER 6,6,0,4
NAME ImageMagick
RELEASE_DATE 2010-03-15
VERSION 6.6.0
WEBSITE http://www.imagemagick.org

Path: configure.xml

Name Value
-------------------------------------------------------------------------------
CC vs8
COPYRIGHT Copyright (C) 1999-2010 ImageMagick Studio LLC
DELEGATES bzlib freetype jpeg jp2 lcms png tiff x11 xml wmf zlib
HOST windows-unknown-linux-gnu
LIB_VERSION 0x660
LIB_VERSION_NUMBER 6,6,0,5
NAME ImageMagick
RELEASE_DATE 2010-03-15
VERSION 6.6.0
WEBSITE http://www.imagemagick.org


I copied the def and the 3 dll files into C:/program files/image magick-6.6.0-Q16 directory and then reinstalled image magick one more time. Can someone tell me if I can do this without recompiling.


Thanks in advanceŠ please point me in the right direction if you are not the right person.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem Installing FFTW as a delegate on windows

Post by fmw42 »

what 3 fft dlls? I am not a windows programmer so don't understand this. But it is not just copying but properly installing per below.

But the process should be.

1) download FFTW see http://www.fftw.org/download.html
2) install FFTW (see installation instructions with package)
3) re-install IM (see IM installation instructions)

If that works then you should see fftw listed in your delegates

convert -list configure

For example:

DELEGATES bzlib fftw fontconfig freetype gs jpeg jng jp2 lcms lqr openexr png tiff x11 xml zlib


Perhaps some kind Windows expert can provide further install help.

Has any Windows user been able to install FFTW and use the -fft and -ift functions in IM?
shekhar.mehta

Re: Problem Installing FFTW as a delegate on windows

Post by shekhar.mehta »

I installed imagemagick
then I "installed" FFTW by copying the dll's into the Image magick directory
then I reinstalled imagemagick

I thought that this would work for Windows.

FFTW did NOT show up as a delegate when I said

convert -list configure

Very confused. Maybe I am not doing this right at all.

THank you in advance

Shekhar
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem Installing FFTW as a delegate on windows

Post by fmw42 »

You have to properly install FFTW not just copy things. At least that was what I had to do on my Mac. For example,

cd to FFTW directory
follow instructions such as
./configure
make
sudo make install


or whatever is the equivalent on Windows
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Problem Installing FFTW as a delegate on windows

Post by el_supremo »

I tried installing FFTW on my WIndows XP system. It is not simply a matter of copying the .dll files. You have to install from source, reconfigure it to use fftw and then recompile.
BUT - when the compiler gets to fourier.c it generates an error because it cannot find the included file <complex.h>. This isn't in the IM source, the FFTW binary or source distributions and it's not an MSVC file either. There are a few other complications which can be worked around but this is the showstopper so far.

Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Problem Installing FFTW as a delegate on windows

Post by el_supremo »

The include file, complex.h, is part of the MINGW package. It looks like you would have to recompile both FFTW and IM using the MINGW gcc compiler.
There is a contributed VC2008 project on the FFTW site which might help but I have a much earlier version of the MSVC compiler so I can't try it out.

Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem Installing FFTW as a delegate on windows

Post by fmw42 »

Pete,

Would that be the same with Cygwin?

Are you saying that you must use MINGW or Cygwin to install FFTW and run IM versions of the same to be able to do -fft,-ift functions on Windows?

Would it work with normal Windows IM, if Magick included the complex.h file in the IM downloads or is complex.h needed to get FFTW to compile?

Fred
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Problem Installing FFTW as a delegate on windows

Post by el_supremo »

fmw42 wrote:Would that be the same with Cygwin?
Hi Fred,
Cygwin doesn't have complex.h so it won't work.
Would it work with normal Windows IM, if Magick included the complex.h file in the IM downloads or is complex.h needed to get FFTW to compile?
The Windows IM binary distributions do not contain the code in fourier.c which is required to interface to the FFTW DLL.
I tried recompiling IM from source with the fourier.c code and pointed the MSVC compiler at the mingw and FFTW include files but it blows up because there are even more dependencies which can't be resolved.
The problem is that fourier.c has to do some manipulation of complex quantities before and after it calls some of the FFTW functions. To do this it uses the MINGW complex functions carg, cimag, creal etc. which do not exist in MSVC. It also uses a few other MINGW-specific operations involving complex quantities. If these could be written in a way which worked with MSVC so that fourier.c compiled, then all that would be required after that is that the Windows binary version of FFTW be installed in a suitable directory. Unfortunately, MSVC doesn't seem to have as much support for complex operations as does MINGW.

BTW - Re: the "three" DLLs.
In the FFTW Windows binary distribution there are three DLL files but only one of them is required (assuming that IM can be compiled). There's one for each size of real number:
libfftw3-3.dll is the default for standard double precision real numbers.
libfftw3f-3.dll is for single precision floats.
libfftw3l-3.dll is for long double precision which requires that your compiler have sizeof(long double) == 12

Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem Installing FFTW as a delegate on windows

Post by fmw42 »

I will check with Magick next week and see what he thinks.

Fred
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Problem Installing FFTW as a delegate on windows

Post by el_supremo »

It may be that part of my problem is that I'm using a relatively old version of MSVC. It's possible that a newer version such as VC8 has the complex.h file, in which case it should be possible to recompile IM to use FFTW. If I can find a free version of VC8 express I'll see if I can compile IM.

But it should also be possible to rewrite fourier.c so that it doesn't need complex.h at all. I'm not sure, but it looks like there are only about 6 lines of code which depend upon complex.h and I think it wouldn't be too difficult to change them so that complex.h isn't required. For example, this statement in fourier.c:

Code: Select all

phase[i]=cimag(fourier[i]);
could be written as:

Code: Select all

phase[i]=fourier[i][1];
because the basic complex number used in fftw3 is defined:

Code: Select all

typedef double fftw_complex[2];
and a statement like this:

Code: Select all

fourier[i]=magnitude[i]*cos(phase[i])+I*magnitude[i]*sin(phase[i]);
can be rewritten:

Code: Select all

fourier[i][0]=magnitude[i]*cos(phase[i]);
fourier[i][1]=magnitude[i]*sin(phase[i]);
Not as pretty but it would work.

I'll fiddle with it and see if I get anywhere.
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Problem Installing FFTW as a delegate on windows

Post by el_supremo »

I've created a version of fourier.c which doesn't need complex.h and recompiled IM 6.6.0-7. When I copy libfftw3-3.dll in to the same directory as the new convert program, it works with the -fft and -ifft options.
Whether it is actually computing correct values is another matter. I created a cropped version of the logo: image so that it was 480x480 (logo_sq.png) and then tried creating the fft and then feeding the results in to ifft:

Code: Select all

convert.exe logo_sq.png -fft +adjoin logo_sq_fft.png
convert.exe logo_fft-0.png logo_fft-1.png -ift logo_ifft.png
But the output logo_ifft.png doesn't look anything like the original image. I'll have to check the changes I made.

Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
shekhar.mehta

Re: Problem Installing FFTW as a delegate on windows

Post by shekhar.mehta »

So back to my original question.

Is there a way to install FFTW without a source recompile.

THank you

Shekhar Mehta
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Problem Installing FFTW as a delegate on windows

Post by magick »

Is there a way to install FFTW without a source recompile.
No.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem Installing FFTW as a delegate on windows

Post by fmw42 »

Magick,

I think one other question that needs answering is whether you can include/install complex.h into the Windows IM compile rather than assuming it will come from compiling FFTW or MINGW or CYGWIN, etc. Apparently the IM compile fails when trying to compile fourier.c because it cannot find complex.h (as best I can tell from the above topic)

Fred
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Problem Installing FFTW as a delegate on windows

Post by magick »

If someone provides a complex.h for Windows we will consider including it. We're perplexed why its not already supported by Windows given its part of the C library standard.
Post Reply