Adding ability for FIR filter with internal buffer to decimate.
authorTom Rondeau <trondeau@vt.edu>
Tue, 2 Nov 2010 16:47:46 +0000 (12:47 -0400)
committerTom Rondeau <trondeau@vt.edu>
Tue, 2 Nov 2010 16:47:46 +0000 (12:47 -0400)
Also adds QA code to test decimate by 2 and 5.

Removes lib/filter/gri_fir_filter_with_buffer_ccf.h that is autogenerated.

15 files changed:
gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.cc.t
gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t
gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_ccf.h
gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc
gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.h
gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.cc
gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.h
gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.cc
gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.h
gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.cc
gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.h
gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.cc
gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.h
gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.cc
gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.h

index c0d061c81773c51c9c3314aa6fde5cbc91c28aa6..1540688403c555c11cd4cf389dbfe5ff909eeaa7 100644 (file)
@@ -77,6 +77,26 @@ void
   return (@O_TYPE@)out;
 }
 
+@O_TYPE@
+@NAME@::filter (const @I_TYPE@ input[], unsigned long dec)
+{
+  unsigned int i;
+
+  for(i = 0; i < dec; i++) {
+    d_buffer[d_idx] = input[i];
+    d_buffer[d_idx+ntaps()] = input[i];
+    d_idx++;
+    if(d_idx >= ntaps())
+      d_idx = 0;
+  }
+
+  @ACC_TYPE@ out = 0;
+  for(i = 0; i < ntaps(); i++) {
+    out += @INPUT_CAST@ d_buffer[d_idx + i] * d_taps[i];
+  }
+  return (@O_TYPE@)out;
+}
+
 void
 @NAME@::filterN (@O_TYPE@ output[],
                 const @I_TYPE@ input[],
@@ -86,3 +106,16 @@ void
     output[i] = filter(input[i]);
   }
 }
+
+void
+@NAME@::filterNdec (@O_TYPE@ output[],
+                   const @I_TYPE@ input[],
+                   unsigned long n,
+                   unsigned long decimate)
+{
+  unsigned long j = 0;
+  for(unsigned long i = 0; i < n; i++) {
+    output[i] = filter(&input[j], decimate);
+    j += decimate;
+  }
+}
index d566b367465908aec6525ed2814dadf303221c94..23d64b65dd82ff12a0787e8c5c712c8c48785dd0 100644 (file)
@@ -69,13 +69,25 @@ public:
   /*!
    * \brief compute a single output value.
    *
-   * \p input must have ntaps() valid entries.
-   * input[0] .. input[ntaps() - 1] are referenced to compute the output value.
+   * \p input is a single input value of the filter type
    *
    * \returns the filtered input value.
    */
   @O_TYPE@ filter (@I_TYPE@ input);
 
+  
+  /*!
+   * \brief compute a single output value; designed for decimating filters.
+   *
+   * \p input is a single input value of the filter type. The value of dec is the
+   *    decimating value of the filter, so input[] must have dec valid values.
+   *    The filter pushes dec number of items onto the circ. buffer before computing
+   *    a single output.
+   *
+   * \returns the filtered input value.
+   */
+  @O_TYPE@ filter (const @I_TYPE@ input[], unsigned long dec);
+
   /*!
    * \brief compute an array of N output values.
    *
@@ -93,7 +105,7 @@ public:
    * compute the output values.
    */
   void filterNdec (@O_TYPE@ output[], const @I_TYPE@ input[],
-                  unsigned long n, unsigned decimate);
+                  unsigned long n, unsigned long decimate);
 
   /*!
    * \brief install \p new_taps as the current taps.
index 2b69f8b036ae9331b8313c2ef16b641f556b11a1..bd7fa33cf6f58424dde25aa1cb23cb5052f7e7da 100644 (file)
@@ -69,13 +69,25 @@ public:
   /*!
    * \brief compute a single output value.
    *
-   * \p input must have ntaps() valid entries.
-   * input[0] .. input[ntaps() - 1] are referenced to compute the output value.
+   * \p input is a single input value of the filter type
    *
    * \returns the filtered input value.
    */
   gr_complex filter (gr_complex input);
 
+  
+  /*!
+   * \brief compute a single output value; designed for decimating filters.
+   *
+   * \p input is a single input value of the filter type. The value of dec is the
+   *    decimating value of the filter, so input[] must have dec valid values.
+   *    The filter pushes dec number of items onto the circ. buffer before computing
+   *    a single output.
+   *
+   * \returns the filtered input value.
+   */
+  gr_complex filter (const gr_complex input[], unsigned long dec);
+
   /*!
    * \brief compute an array of N output values.
    *
@@ -93,7 +105,7 @@ public:
    * compute the output values.
    */
   void filterNdec (gr_complex output[], const gr_complex input[],
-                  unsigned long n, unsigned decimate);
+                  unsigned long n, unsigned long decimate);
 
   /*!
    * \brief install \p new_taps as the current taps.
index cff81ab13c0dec4824903b6f30674a53ffdc4e3a..e87d93ebff4ca641e32faf284ee04f0c1c5a6bc9 100644 (file)
@@ -73,14 +73,31 @@ ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
   return sum;
 }
 
+void
+qa_gri_fir_filter_with_buffer_ccc::t1 ()
+{
+  test_decimate(1);
+}
+
+void
+qa_gri_fir_filter_with_buffer_ccc::t2 ()
+{
+  test_decimate(2);
+}
+
+void
+qa_gri_fir_filter_with_buffer_ccc::t3 ()
+{
+  test_decimate(5);
+}
+
 //
 // Test for ntaps in [0,9], and input lengths in [0,17].
 // This ensures that we are building the shifted taps correctly,
 // and exercises all corner cases on input alignment and length.
 //
-
 void
-qa_gri_fir_filter_with_buffer_ccc::t1 ()
+qa_gri_fir_filter_with_buffer_ccc::test_decimate(unsigned int decimate)
 {
   const int    MAX_TAPS        = 9;
   const int    OUTPUT_LEN      = 17;
@@ -107,11 +124,13 @@ qa_gri_fir_filter_with_buffer_ccc::t1 ()
 
       // compute expected output values
       memset(dline, 0, INPUT_LEN*sizeof(i_type));
-      for (int o = 0; o < ol; o++){
+      for (int o = 0; o < (int)(ol/decimate); o++){
        // use an actual delay line for this test
-       for(int oo = INPUT_LEN-1; oo > 0; oo--)
-         dline[oo] = dline[oo-1];
-       dline[0] = input[o];
+       for(int dd = 0; dd < (int)decimate; dd++) {
+         for(int oo = INPUT_LEN-1; oo > 0; oo--)
+           dline[oo] = dline[oo-1];
+         dline[0] = input[decimate*o+dd];
+       }
        expected_output[o] = ref_dotprod (dline, taps, n);
       }
 
@@ -121,7 +140,7 @@ qa_gri_fir_filter_with_buffer_ccc::t1 ()
 
       // zero the output, then do the filtering
       memset (actual_output, 0, sizeof (actual_output));
-      f1->filterN (actual_output, input, ol);
+      f1->filterNdec (actual_output, input, ol/decimate, decimate);
 
       // check results
       //
@@ -130,7 +149,7 @@ qa_gri_fir_filter_with_buffer_ccc::t1 ()
       // arithmetic, while the SSE version is using 32 bit float point
       // arithmetic.
       
-      for (int o = 0; o < ol; o++){
+      for (int o = 0; o < (int)(ol/decimate); o++){
        CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o],
                                       abs (expected_output[o]) * ERR_DELTA);
       }
index 411a66a9aa8f36204450b27b4d10b9cd02fb0c92..f9f206f66425a24d607ae8c410a00cf0fa3c6fd7 100644 (file)
@@ -29,13 +29,16 @@ class qa_gri_fir_filter_with_buffer_ccc : public CppUnit::TestCase {
 
   CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_ccc);
   CPPUNIT_TEST (t1);
+  CPPUNIT_TEST (t2);
+  CPPUNIT_TEST (t3);
   CPPUNIT_TEST_SUITE_END ();
 
  private:
+  void test_decimate(unsigned int decimate);
 
   void t1 ();
-  // void t2 ();
-  // void t3 ();
+  void t2 ();
+  void t3 ();
 
 };
 
index f2e09db1cf0ae96d3d0839bda5914ae89dfa0663..c25853b1e40c8cb392cdd37fa5c10ed44b1e8c47 100644 (file)
@@ -80,14 +80,31 @@ ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
   return sum;
 }
 
+void
+qa_gri_fir_filter_with_buffer_ccf::t1 ()
+{
+  test_decimate(1);
+}
+
+void
+qa_gri_fir_filter_with_buffer_ccf::t2 ()
+{
+  test_decimate(2);
+}
+
+void
+qa_gri_fir_filter_with_buffer_ccf::t3 ()
+{
+  test_decimate(5);
+}
+
 //
 // Test for ntaps in [0,9], and input lengths in [0,17].
 // This ensures that we are building the shifted taps correctly,
 // and exercises all corner cases on input alignment and length.
 //
-
 void
-qa_gri_fir_filter_with_buffer_ccf::t1 ()  
+qa_gri_fir_filter_with_buffer_ccf::test_decimate (unsigned int decimate)
 {
   const int    MAX_TAPS        = 9;
   const int    OUTPUT_LEN      = 17;
@@ -114,11 +131,13 @@ qa_gri_fir_filter_with_buffer_ccf::t1 ()
 
       // compute expected output values
       memset(dline, 0, INPUT_LEN*sizeof(i_type));
-      for (int o = 0; o < ol; o++){
+      for (int o = 0; o < (int)(ol/decimate); o++){
        // use an actual delay line for this test
-       for(int oo = INPUT_LEN-1; oo > 0; oo--)
-         dline[oo] = dline[oo-1];
-       dline[0] = input[o];
+       for(int dd = 0; dd < (int)decimate; dd++) {
+         for(int oo = INPUT_LEN-1; oo > 0; oo--)
+           dline[oo] = dline[oo-1];
+         dline[0] = input[decimate*o+dd];
+       }
        expected_output[o] = ref_dotprod (dline, taps, n);
       }
 
@@ -128,7 +147,7 @@ qa_gri_fir_filter_with_buffer_ccf::t1 ()
 
       // zero the output, then do the filtering
       memset (actual_output, 0, sizeof (actual_output));
-      f1->filterN (actual_output, input, ol);
+      f1->filterNdec (actual_output, input, ol/decimate, decimate);
 
       // check results
       //
@@ -137,7 +156,7 @@ qa_gri_fir_filter_with_buffer_ccf::t1 ()
       // arithmetic, while the SSE version is using 32 bit float point
       // arithmetic.
       
-      for (int o = 0; o < ol; o++){
+      for (int o = 0; o < (int)(ol/decimate); o++){
        CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o],
                                       abs (expected_output[o]) * ERR_DELTA);
       }
index b80be70a79f896fd20d38a719eb2e56ba6c3e321..924b4bc2e53e2afdadbb5aab4e9faf6fa5cbf53d 100644 (file)
@@ -29,13 +29,16 @@ class qa_gri_fir_filter_with_buffer_ccf : public CppUnit::TestCase {
 
   CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_ccf);
   CPPUNIT_TEST (t1);
+  CPPUNIT_TEST (t2);
+  CPPUNIT_TEST (t3);
   CPPUNIT_TEST_SUITE_END ();
 
  private:
+  void test_decimate(unsigned int decimate);
 
   void t1 ();
-  // void t2 ();
-  // void t3 ();
+  void t2 ();
+  void t3 ();
 
 };
 
index de0da9f1ca9557ac3c06c92fc38a879af3adec0c..19f270200dfd377b006a1c81134f0eec764fe8f7 100644 (file)
@@ -80,14 +80,32 @@ ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
   return sum;
 }
 
+void
+qa_gri_fir_filter_with_buffer_fcc::t1()
+{
+  test_decimate(1);
+}
+
+void
+qa_gri_fir_filter_with_buffer_fcc::t2()
+{
+  test_decimate(2);
+}
+
+void
+qa_gri_fir_filter_with_buffer_fcc::t3()
+{
+  test_decimate(5);
+}
+
+
 //
 // Test for ntaps in [0,9], and input lengths in [0,17].
 // This ensures that we are building the shifted taps correctly,
 // and exercises all corner cases on input alignment and length.
 //
-
 void
-qa_gri_fir_filter_with_buffer_fcc::t1 ()
+qa_gri_fir_filter_with_buffer_fcc::test_decimate(unsigned int decimate)
 {
   const int    MAX_TAPS        = 9;
   const int    OUTPUT_LEN      = 17;
@@ -114,11 +132,13 @@ qa_gri_fir_filter_with_buffer_fcc::t1 ()
 
       // compute expected output values
       memset(dline, 0, INPUT_LEN*sizeof(i_type));
-      for (int o = 0; o < ol; o++){
+      for (int o = 0; o < (int)(ol/decimate); o++){
        // use an actual delay line for this test
-       for(int oo = INPUT_LEN-1; oo > 0; oo--)
-         dline[oo] = dline[oo-1];
-       dline[0] = input[o];
+       for(int dd = 0; dd < (int)decimate; dd++) {
+         for(int oo = INPUT_LEN-1; oo > 0; oo--)
+           dline[oo] = dline[oo-1];
+         dline[0] = input[decimate*o+dd];
+       }
        expected_output[o] = ref_dotprod (dline, taps, n);
       }
 
@@ -128,7 +148,7 @@ qa_gri_fir_filter_with_buffer_fcc::t1 ()
 
       // zero the output, then do the filtering
       memset (actual_output, 0, sizeof (actual_output));
-      f1->filterN (actual_output, input, ol);
+      f1->filterNdec (actual_output, input, ol/decimate, decimate);
 
       // check results
       //
@@ -137,7 +157,7 @@ qa_gri_fir_filter_with_buffer_fcc::t1 ()
       // arithmetic, while the SSE version is using 32 bit float point
       // arithmetic.
       
-      for (int o = 0; o < ol; o++){
+      for (int o = 0; o < (int)(ol/decimate); o++){
        CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o],
                                       abs (expected_output[o]) * ERR_DELTA);
       }
index 81b39f4884725634c18467fdb87c9b3ebc06fae0..6201800f9deb8c7e802b27f05a8e28d59ab2c233 100644 (file)
@@ -29,13 +29,16 @@ class qa_gri_fir_filter_with_buffer_fcc : public CppUnit::TestCase {
 
   CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_fcc);
   CPPUNIT_TEST (t1);
+  CPPUNIT_TEST (t2);
+  CPPUNIT_TEST (t3);
   CPPUNIT_TEST_SUITE_END ();
 
  private:
+  void test_decimate(unsigned int decimate);
 
   void t1 ();
-  // void t2 ();
-  // void t3 ();
+  void t2 ();
+  void t3 ();
 
 };
 
index ce689a54bbbd9cc0cbbf5ffec4e46dc7335e0e24..8401e484bf79828fe5746521289ee7ea4058ff40 100644 (file)
@@ -69,14 +69,31 @@ ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
   return sum;
 }
 
+void
+qa_gri_fir_filter_with_buffer_fff::t1 ()  
+{
+  test_decimate(1);
+}
+
+void
+qa_gri_fir_filter_with_buffer_fff::t2 ()
+{
+  test_decimate(2);
+}
+
+void
+qa_gri_fir_filter_with_buffer_fff::t3 ()
+{
+  test_decimate(5);
+}
+
 //
 // Test for ntaps in [0,9], and input lengths in [0,17].
 // This ensures that we are building the shifted taps correctly,
 // and exercises all corner cases on input alignment and length.
 //
-
 void
-qa_gri_fir_filter_with_buffer_fff::t1 ()  
+qa_gri_fir_filter_with_buffer_fff::test_decimate(unsigned int decimate)
 {
   const int    MAX_TAPS        = 9;
   const int    OUTPUT_LEN      = 17;
@@ -103,11 +120,13 @@ qa_gri_fir_filter_with_buffer_fff::t1 ()
 
       // compute expected output values
       memset(dline, 0, INPUT_LEN*sizeof(i_type));
-      for (int o = 0; o < ol; o++){
+      for (int o = 0; o < (int)(ol/decimate); o++){
        // use an actual delay line for this test
-       for(int oo = INPUT_LEN-1; oo > 0; oo--)
-         dline[oo] = dline[oo-1];
-       dline[0] = input[o];
+       for(int dd = 0; dd < (int)decimate; dd++) {
+         for(int oo = INPUT_LEN-1; oo > 0; oo--)
+           dline[oo] = dline[oo-1];
+         dline[0] = input[decimate*o+dd];
+       }
        expected_output[o] = ref_dotprod (dline, taps, n);
       }
 
@@ -117,7 +136,7 @@ qa_gri_fir_filter_with_buffer_fff::t1 ()
 
       // zero the output, then do the filtering
       memset (actual_output, 0, sizeof (actual_output));
-      f1->filterN (actual_output, input, ol);
+      f1->filterNdec (actual_output, input, ol/decimate, decimate);
 
       // check results
       //
@@ -126,7 +145,7 @@ qa_gri_fir_filter_with_buffer_fff::t1 ()
       // arithmetic, while the SSE version is using 32 bit float point
       // arithmetic.
       
-      for (int o = 0; o < ol; o++){
+      for (int o = 0; o < (int)(ol/decimate); o++){
        CPPUNIT_ASSERT_DOUBLES_EQUAL(expected_output[o], actual_output[o],
                                     fabsf (expected_output[o]) * ERR_DELTA);
       }
index 5bb6c3e937ae71943b54eb9f008291deadae9bc2..54a9cdc53a46fcc34f86f0fd79f23616e6c2035f 100644 (file)
@@ -29,13 +29,16 @@ class qa_gri_fir_filter_with_buffer_fff : public CppUnit::TestCase {
 
   CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_fff);
   CPPUNIT_TEST (t1);
+  CPPUNIT_TEST (t2);
+  CPPUNIT_TEST (t3);
   CPPUNIT_TEST_SUITE_END ();
 
  private:
+  void test_decimate(unsigned int decimate);
 
   void t1 ();
-  // void t2 ();
-  // void t3 ();
+  void t2 ();
+  void t3 ();
 
 };
 
index f09a1d7ac6eb02be7df0806ac99de9df1a3a6edb..091505380cf2de00142c964519498882922204b5 100644 (file)
@@ -67,14 +67,31 @@ ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
   return (o_type)sum;
 }
 
+void
+qa_gri_fir_filter_with_buffer_fsf::t1 ()
+{
+  test_decimate(1);
+}
+
+void
+qa_gri_fir_filter_with_buffer_fsf::t2 ()
+{
+  test_decimate(2);
+}
+
+void
+qa_gri_fir_filter_with_buffer_fsf::t3 ()
+{
+  test_decimate(5);
+}
+
 //
 // Test for ntaps in [0,9], and input lengths in [0,17].
 // This ensures that we are building the shifted taps correctly,
 // and exercises all corner cases on input alignment and length.
 //
-
 void
-qa_gri_fir_filter_with_buffer_fsf::t1 ()  
+qa_gri_fir_filter_with_buffer_fsf::test_decimate (unsigned int decimate)  
 {
   const int    MAX_TAPS        = 9;
   const int    OUTPUT_LEN      = 17;
@@ -101,11 +118,13 @@ qa_gri_fir_filter_with_buffer_fsf::t1 ()
 
       // compute expected output values
       memset(dline, 0, INPUT_LEN*sizeof(i_type));
-      for (int o = 0; o < ol; o++){
+      for (int o = 0; o < (int)(ol/decimate); o++){
        // use an actual delay line for this test
-       for(int oo = INPUT_LEN-1; oo > 0; oo--)
-         dline[oo] = dline[oo-1];
-       dline[0] = input[o];
+       for(int dd = 0; dd < (int)decimate; dd++) {
+         for(int oo = INPUT_LEN-1; oo > 0; oo--)
+           dline[oo] = dline[oo-1];
+         dline[0] = input[decimate*o+dd];
+       }
        expected_output[o] = ref_dotprod (dline, taps, n);
       }
 
@@ -115,10 +134,10 @@ qa_gri_fir_filter_with_buffer_fsf::t1 ()
 
       // zero the output, then do the filtering
       memset (actual_output, 0, sizeof (actual_output));
-      f1->filterN (actual_output, input, ol);
+      f1->filterNdec (actual_output, input, ol/decimate, decimate);
 
       // check results
-      for (int o = 0; o < ol; o++){
+      for (int o = 0; o < (int)(ol/decimate); o++){
        CPPUNIT_ASSERT_EQUAL(expected_output[o], actual_output[o]);
       }
       delete f1;
index 38899b35208d9f0200cb5512151ed3485e2d9f0f..9c901464ed7b8c474843636ca0f62dcf5317f3d3 100644 (file)
@@ -29,13 +29,16 @@ class qa_gri_fir_filter_with_buffer_fsf : public CppUnit::TestCase {
 
   CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_fsf);
   CPPUNIT_TEST (t1);
+  CPPUNIT_TEST (t2);
+  CPPUNIT_TEST (t3);
   CPPUNIT_TEST_SUITE_END ();
 
  private:
-
+  void test_decimate(unsigned int decimate);
+  
   void t1 ();
-  // void t2 ();
-  // void t3 ();
+  void t2 ();
+  void t3 ();
 
 };
 
index 4ba433ebfd7c27116a2ba735586c47e9454b4bad..03cd7102232ccf4ffb09cd2fa6aaec35186f1eda 100644 (file)
@@ -80,14 +80,31 @@ ref_dotprod (const i_type input[], const tap_type taps[], int ntaps)
   return sum;
 }
 
+void
+qa_gri_fir_filter_with_buffer_scc::t1 ()
+{
+  test_decimate(1);
+}
+
+void
+qa_gri_fir_filter_with_buffer_scc::t2 ()
+{
+  test_decimate(2);
+}
+
+void
+qa_gri_fir_filter_with_buffer_scc::t3 ()
+{
+  test_decimate(5);
+}
+
 //
 // Test for ntaps in [0,9], and input lengths in [0,17].
 // This ensures that we are building the shifted taps correctly,
 // and exercises all corner cases on input alignment and length.
 //
-
 void
-qa_gri_fir_filter_with_buffer_scc::t1 ()  
+qa_gri_fir_filter_with_buffer_scc::test_decimate (unsigned int decimate)
 {
   const int    MAX_TAPS        = 9;
   const int    OUTPUT_LEN      = 17;
@@ -114,11 +131,13 @@ qa_gri_fir_filter_with_buffer_scc::t1 ()
 
       // compute expected output values
       memset(dline, 0, INPUT_LEN*sizeof(i_type));
-      for (int o = 0; o < ol; o++){
+      for (int o = 0; o < (int)(ol/decimate); o++){
        // use an actual delay line for this test
-       for(int oo = INPUT_LEN-1; oo > 0; oo--)
-         dline[oo] = dline[oo-1];
-       dline[0] = input[o];
+       for(int dd = 0; dd < (int)decimate; dd++) {
+         for(int oo = INPUT_LEN-1; oo > 0; oo--)
+           dline[oo] = dline[oo-1];
+         dline[0] = input[decimate*o+dd];
+       }
        expected_output[o] = ref_dotprod (dline, taps, n);
       }
 
@@ -128,7 +147,7 @@ qa_gri_fir_filter_with_buffer_scc::t1 ()
 
       // zero the output, then do the filtering
       memset (actual_output, 0, sizeof (actual_output));
-      f1->filterN (actual_output, input, ol);
+      f1->filterNdec (actual_output, input, ol/decimate, decimate);
 
       // check results
       //
@@ -137,7 +156,7 @@ qa_gri_fir_filter_with_buffer_scc::t1 ()
       // arithmetic, while the SSE version is using 32 bit float point
       // arithmetic.
 
-      for (int o = 0; o < ol; o++){
+      for (int o = 0; o < (int)(ol/decimate); o++){
        CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o],
                                       abs (expected_output[o]) * ERR_DELTA);
       }
index fd9fe5b767faef38c60fb0d99dcaa6b888cd1083..970ca3749834a91efdb6680d957970d2121b4e99 100644 (file)
@@ -29,13 +29,16 @@ class qa_gri_fir_filter_with_buffer_scc : public CppUnit::TestCase {
 
   CPPUNIT_TEST_SUITE (qa_gri_fir_filter_with_buffer_scc);
   CPPUNIT_TEST (t1);
+  CPPUNIT_TEST (t2);
+  CPPUNIT_TEST (t3);
   CPPUNIT_TEST_SUITE_END ();
 
  private:
+  void test_decimate(unsigned int decimate);
 
   void t1 ();
-  // void t2 ();
-  // void t3 ();
+  void t2 ();
+  void t3 ();
 
 };