* mln/transform/fft.hh,
* tests/transform/fft.cc:
Here.
---
milena/ChangeLog | 8 ++++++++
milena/mln/transform/fft.hh | 28 +++++++++++++---------------
milena/tests/transform/fft.cc | 29 +++++++++++++----------------
3 files changed, 34 insertions(+), 31 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 681452a..eb7148d 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,13 @@
2012-10-09 Roland Levillain <roland(a)lrde.epita.fr>
+ Update copyright headers.
+
+ * mln/transform/fft.hh,
+ * tests/transform/fft.cc:
+ Here.
+
+2012-10-09 Roland Levillain <roland(a)lrde.epita.fr>
+
* headers.mk, tests/unit_test/unit-tests.mk: Regen.
2012-10-09 Roland Levillain <roland(a)lrde.epita.fr>
diff --git a/milena/mln/transform/fft.hh b/milena/mln/transform/fft.hh
index cf0f1bb..a010e47 100644
--- a/milena/mln/transform/fft.hh
+++ b/milena/mln/transform/fft.hh
@@ -1,30 +1,28 @@
// Copyright (C) 2007, 2008, 2009, 2012 EPITA Research and Development
// Laboratory
//
-// This file is part of the Milena Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License version 2 as published by the
-// Free Software Foundation.
+// This file is part of Olena.
//
-// This library is distributed in the hope that it will be useful,
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02111-1307, USA.
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
+// software project without restriction. Specifically, if other files
// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#ifndef MLN_TRANSFORM_FFT_HH
# define MLN_TRANSFORM_FFT_HH
diff --git a/milena/tests/transform/fft.cc b/milena/tests/transform/fft.cc
index bf7b8b9..c5c5bec 100644
--- a/milena/tests/transform/fft.cc
+++ b/milena/tests/transform/fft.cc
@@ -1,30 +1,27 @@
-// -*- c++ -*-
// Copyright (C) 2004, 2012 EPITA Research and Development Laboratory
//
-// This file is part of the Milena Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License version 2 as published by the
-// Free Software Foundation.
+// This file is part of Olena.
//
-// This library is distributed in the hope that it will be useful,
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-// Boston, MA 02110-1301, USA.
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
+// software project without restriction. Specifically, if other files
// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#include <mln/transform/fft.hh>
#include <mln/value/int_u8.hh>
--
1.7.10.4
* mln/transform/fft.hh
(mln::transform::fft<T, internal::fft_real>::fft):
Properly initialize the plan of the inverse transform using
fftw_plan_dft_c2r_2d.
(mln::transform::fft<T, internal::fft_real>::transform_inv):
Use the entire complex values (not just their real parts) to
compute the inverse transform.
(mln::transform::class fft<T, internal::fft_cplx>::fft):
Call the proper function (fftw_plan_dft_2d) to create the plan of
the inverse transform.
Switch the input and the output so that the inverse transform uses
the right images.
---
milena/ChangeLog | 17 +++++++++++++++++
milena/mln/transform/fft.hh | 15 ++++++++-------
2 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 83a2c76..8bc21f5 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,20 @@
+2012-10-09 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Fix the Fast Fourier Transform.
+
+ * mln/transform/fft.hh
+ (mln::transform::fft<T, internal::fft_real>::fft):
+ Properly initialize the plan of the inverse transform using
+ fftw_plan_dft_c2r_2d.
+ (mln::transform::fft<T, internal::fft_real>::transform_inv):
+ Use the entire complex values (not just their real parts) to
+ compute the inverse transform.
+ (mln::transform::class fft<T, internal::fft_cplx>::fft):
+ Call the proper function (fftw_plan_dft_2d) to create the plan of
+ the inverse transform.
+ Switch the input and the output so that the inverse transform uses
+ the right images.
+
2012-10-09 Alexandre Abraham <abraham(a)lrde.epita.fr>
Import the FFTW-based Fast Fourier Transform.
diff --git a/milena/mln/transform/fft.hh b/milena/mln/transform/fft.hh
index 0dafa7b..cf0f1bb 100644
--- a/milena/mln/transform/fft.hh
+++ b/milena/mln/transform/fft.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008, 2009, 2012 EPITA Research and Development
+// Laboratory
//
// This file is part of the Milena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -418,8 +419,8 @@ namespace mln {
this->p = fftw_plan_dft_r2c_2d (original_im.nrows(), original_im.ncols(),
this->in, reinterpret_cast<fftw_complex*>(this->out), FFTW_ESTIMATE);
- this->p_inv = fftw_plan_dft_r2c_2d (original_im.nrows(), original_im.ncols(),
- this->in, reinterpret_cast<fftw_complex*>(this->out), FFTW_ESTIMATE);
+ this->p_inv = fftw_plan_dft_c2r_2d (original_im.nrows(), original_im.ncols(),
+ reinterpret_cast<fftw_complex*>(this->out), this->in, FFTW_ESTIMATE);
this->trans_im = image2d< std::complex<T> >(original_im.domain());
}
@@ -460,7 +461,7 @@ namespace mln {
for (unsigned row = 0; row < this->trans_im.nrows(); ++row)
for (unsigned col = 0; col <= this->trans_im.ncols() / 2; ++col)
this->out[row * (this->trans_im.ncols() / 2 + 1) + col] =
- opt::at(this->trans_im, row, col).real();
+ opt::at(this->trans_im, row, col);
fftw_execute(this->p_inv);
@@ -620,9 +621,9 @@ namespace mln {
this->p = fftw_plan_dft_2d(original_im.nrows(), original_im.ncols(),
this->in, this->out,
FFTW_FORWARD, FFTW_ESTIMATE);
- this->p_inv = fftw2d_plan_dft_2d(original_im.nrows(), original_im.ncols(),
- this->in, this->out,
- FFTW_BACKWARD, FFTW_ESTIMATE);
+ this->p_inv = fftw_plan_dft_2d(original_im.nrows(), original_im.ncols(),
+ this->out, this->in,
+ FFTW_BACKWARD, FFTW_ESTIMATE);
this->trans_im = image2d< std::complex<T> >(original_im.domain());
}
--
1.7.10.4