2006-07-05 Roland Levillain <roland(a)lrde.epita.fr>
Fix tests using the FFTW.
* oln/convol/fast_convolution.hh: s/HAVE_LIBfft/HAVE_FFTW/.
* tests/convol/tests/fast_convol [HAVE_FFTW]: Invoke
convol::fast::convolv and compare its result with
convol::slow::convolve only if the FFTW is available.
Index: 10.234/olena/oln/convol/fast_convolution.hh
--- 10.234/olena/oln/convol/fast_convolution.hh Tue, 13 Jul 2004 11:48:20 +0200 palma_g
(oln/r/12_fast_convo 1.4 600)
+++ 10.234(w)/olena/oln/convol/fast_convolution.hh Wed, 05 Jul 2006 14:25:27 +0200
levill_r (oln/r/12_fast_convo 1.4 600)
@@ -98,7 +98,7 @@
** using namespace ntg;
**
** int main() {
- ** #ifdef HAVE_LIBfft
+ ** #ifdef HAVE_FFTW
** image2d<int_u8> src(IMG_IN "lena.pgm");
** float_d sigma = 2.5;
** float_d radius = 3;
@@ -126,7 +126,7 @@
convolve(const abstract::image< I >& input,
const abstract::image< J >& k)
{
-# ifdef HAVE_LIBfft
+# ifdef HAVE_FFTW
mlc::eq<I::dim, J::dim>::ensure();
mlc::eq<I::dim, 2>::ensure();
@@ -191,7 +191,7 @@
return output;
# else
assert(0);
-# endif // !HAVE_LIBfft
+# endif // !HAVE_FFTW
}
/*!
Index: 10.234/olena/tests/convol/tests/fast_convol
--- 10.234/olena/tests/convol/tests/fast_convol Tue, 15 Jun 2004 20:36:26 +0200 odou_s
(oln/r/13_fast_convo 1.2 600)
+++ 10.234(w)/olena/tests/convol/tests/fast_convol Wed, 05 Jul 2006 14:27:05 +0200
levill_r (oln/r/13_fast_convo 1.2 600)
@@ -19,10 +19,15 @@
for_all(i)
f_src[i] = cast::bound<float_d>(src[i]);
- image2d<float_d> tmp = convol::fast::convolve<float_d>(f_src, k);
- image2d<float_d> tmp2 = convol::slow::convolve<float_d>(f_src, k);
+ image2d<float_d> tmp = convol::slow::convolve<float_d>(f_src, k);
+
+// Compare the slow convolution with the fast one if it is available
+// (i.e., if the FFTW is available).
+#ifdef HAVE_FFTW
+ image2d<float_d> tmp2 = convol::fast::convolve<float_d>(f_src, k);
for_all(i)
if (tmp[i] != tmp2[i])
return false;
+#endif
}
Show replies by date