FFTW: successive real2complex 1-D FFTs fail
- From: "labis" <dlampridis@xxxxxxxxx>
- Date: Fri, 10 Jul 2009 08:53:35 -0500
Hi everybody,
I've been experimenting lately with the great FFTW library in C, and I've
just encountered some very strange behavior.
I have a 1024x1024 image (w=1024, h=1024), on which I want to do the
following processing:
a) Perform 1-D FFTs on every column of the image array
b) Perform 1-D FFTs on every row of the same image array
c) more computations using the outputs of the two previous steps ...
The image is stored in RAM following a row-major order.
I've read the FFTW documentation and I came up with the following two
plans that make use of the advanced API:
fftw_p = fftw_plan_many_dft_r2c (1, &h, w, fftw_in, NULL, w, 1, fftw_out,
NULL, w, 1, FFTW_MEASURE);
fftw_p_T = fftw_plan_many_dft_r2c (1, &w, h, fftw_in, NULL, 1, fftw_out_T,
NULL, 1, h, FFTW_MEASURE);
So fftw_in is real (double), of size w*h and there are two output arrays,
fftw_out and fftw_out_T, both of size w*h/2+1.
I first create the plans, then I load the image into fftw_in, and then I
run the two plans, one after the other:
fftw_execute(fftw_p);
fftw_execute(fftw_p_T);
The strange thing is that the second transform produces wrong results. If
I comment out the first transform, then the second one works fine.
My original version used a complex2complex transform. That one did work
like a charm. So it must be something related to the real2complex version
of the plans.
I have tried the following:
1. switch to standard malloc instead of fftw_malloc for the input array
2. Use FFTW_ESTIMATE instead of FFTW_MEASURE
3. As ub 2m but also move the creation of the 2nd plan after the execution
of the 1st transform
4. As in 3, but also destroy the 1st plan before executing the 2nd one
5. As in 4, but also call fftw_cleanup() in between
6. I checked out the values of w and h before and after executing the 1st
transform, and they are always equal to 1024.
None of these steps helped me in any way. If I execute the 1st transform,
the 2nd one goes always wrong. If I dont, the 2nd one goes fine.
Furthermore, the whole idea of planning first, is that I want to reuse the
plans for real-time processing of a stream of images, so destroying and
cleaning up is not a realistic option anyway.
Does anybody have an idea what am I doing wrong? I'm very tempted to start
shouting that I've discovered a bug, but simple reasoning dictates that I'm
just a newbie in FFTW and I'm doing something incredibly stupid.
Just for the record, I'm working on an Intel Core 2 Duo T7200, running
32-bit Debian GNU/Linux, GCC version 4.3.3, and FFTW 3.1.2.
Thank you,
Dimitris
.
- Follow-Ups:
- Re: FFTW: successive real2complex 1-D FFTs fail
- From: Steven G. Johnson
- Re: FFTW: successive real2complex 1-D FFTs fail
- From: glen herrmannsfeldt
- Re: FFTW: successive real2complex 1-D FFTs fail
- From: alexryu
- Re: FFTW: successive real2complex 1-D FFTs fail
- From: Verictor
- Re: FFTW: successive real2complex 1-D FFTs fail
- Prev by Date: www.dudes-mall.com Ed hardy,(tshirt$13,swim strunk$25,jean$30,handbag$34,cap$13,sunglass$12,shoes$25)nike shoes:$32,handbag:$35,NFL:$20,jean:$30,air force one shoes,lv,gucci,D&G,bbc,coachUGG boot:$50,.free shipping!
- Next by Date: Re: Comparing timing between sinusoids at different freqs
- Previous by thread: New Affliction Mens T-shirts - Cheapest
- Next by thread: Re: FFTW: successive real2complex 1-D FFTs fail
- Index(es):
Relevant Pages
|