[PATCH] more Fir<> tests
Nathan (Jasper) Myers
ncm at codesourcery.com
Mon Oct 10 06:34:33 UTC 2005
I have also checked in the patch below.
It adds Fir<> accessor tests, and a bit of instrumentation for
benchmarking.
Nathan Myers
ncm
Index: ChangeLog
===================================================================
RCS file: /home/cvs/Repository/vpp/ChangeLog,v
retrieving revision 1.289
diff -u -p -r1.289 ChangeLog
--- ChangeLog 10 Oct 2005 01:22:30 -0000 1.289
+++ ChangeLog 10 Oct 2005 06:31:44 -0000
@@ -1,5 +1,11 @@
2005-10-09 Nathan Myers <ncm at codesourcery.com>
+ * src/vsip/impl/signal-fir.hpp: support Fir<>::impl_performance()
+ command "count".
+ * tests/fir.cpp: add tests for accessors, default template arg.
+
+2005-10-09 Nathan Myers <ncm at codesourcery.com>
+
Implement FIR filter, all modes.
* src/vsip/impl/signal-fir.hpp, tests/fir.cpp: New.
* src/vsip/signal.hpp: Include new impl/signal-fir.hpp.
Index: src/vsip/impl/signal-fir.hpp
===================================================================
RCS file: /home/cvs/Repository/vpp/src/vsip/impl/signal-fir.hpp,v
retrieving revision 1.1
diff -u -p -r1.1 signal-fir.hpp
--- src/vsip/impl/signal-fir.hpp 10 Oct 2005 01:22:30 -0000 1.1
+++ src/vsip/impl/signal-fir.hpp 10 Oct 2005 06:31:44 -0000
@@ -76,6 +76,7 @@ public:
decimation_(decimation),
skip_(0),
state_saved_(0),
+ op_calls_(0),
state_(this->order_, T(0)),
kernel_(this->order_ + 1)
{
@@ -163,6 +164,7 @@ public:
this->state_saved_ = new_save;
this->state_(d_type(new_save)) = data(d_type(start, 1, new_save));
}
+ ++ this->op_calls_;
return oix;
}
@@ -186,6 +188,8 @@ public:
}
else if (!strcmp(what, "time"))
return this->timer_.total();
+ else if (!strcmp(what, "count"))
+ return this->op_calls_;
return 0.f;
}
@@ -196,6 +200,7 @@ private:
vsip::length_type decimation_;
vsip::length_type skip_; // how much of next input to skip
vsip::length_type state_saved_; // number of elements saved
+ unsigned long op_calls_;
vsip::Vector<T,typename impl::Fir_aligned<T>::block_type> state_;
vsip::Vector<T,typename impl::Fir_aligned<T>::block_type> kernel_;
Index: tests/fir.cpp
===================================================================
RCS file: /home/cvs/Repository/vpp/tests/fir.cpp,v
retrieving revision 1.1
diff -u -p -r1.1 fir.cpp
--- tests/fir.cpp 10 Oct 2005 01:22:30 -0000 1.1
+++ tests/fir.cpp 10 Oct 2005 06:31:44 -0000
@@ -59,10 +59,29 @@ test_fir(
convinput(vsip::Domain<1>(pad, 1, insize)) = input;
conv(convinput, convout); // emulate chained FIR
+ vsip::Fir<> dummy(
+ vsip::const_Vector<>(vsip::length_type(3),vsip::scalar_f(1)), N*10);
+ assert(dummy.decimation() == 1);
vsip::Fir<T,sym,vsip::state_save,1> fir1a(kernel, N, D);
vsip::Fir<T,sym,vsip::state_save,1> fir1b(kernel, N, D);
vsip::Fir<T,sym,vsip::state_no_save,1> fir2(kernel, N, D);
+ assert(fir1a.symmetry == sym);
+ assert(fir2.symmetry == sym);
+ assert(fir1a.continuous_filter == vsip::state_save);
+ assert(fir2.continuous_filter == vsip::state_no_save);
+
+ const vsip::length_type order = (sym == vsip::nonsym) ? M :
+ (sym == vsip::sym_even_len_even) ? 2 * M : (2 * M) - 1;
+ assert(fir1a.kernel_size() == order);
+ assert(fir1a.filter_order() == order);
+ // assert(fir1a.symmetry()
+ assert(fir1a.input_size() == N);
+ assert(fir1a.output_size() == (N+D-1)/D);
+ assert(fir1a.continuous_filtering() == fir1a.continuous_filter);
+ assert(fir2.continuous_filtering() == fir2.continuous_filter);
+ assert(fir1a.decimation() == D);
+
vsip::length_type got = 0;
for (vsip::length_type i = 0; i < 2 * M; ++i) // chained
{
More information about the vsipl++
mailing list