summaryrefslogtreecommitdiff
path: root/gnuradio-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src')
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc14
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc1
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc2
-rw-r--r--gnuradio-core/src/lib/filter/gr_sincos.c4
-rw-r--r--gnuradio-core/src/lib/filter/gr_single_pole_iir.h6
-rw-r--r--gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.cc.t33
-rw-r--r--gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t18
-rw-r--r--gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_ccf.h119
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc35
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.h7
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.cc35
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.h7
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.cc36
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.h7
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.cc35
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.h7
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.cc35
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.h9
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.cc35
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.h7
-rw-r--r--gnuradio-core/src/lib/general/gr_circular_file.cc7
-rw-r--r--gnuradio-core/src/lib/general/gr_fll_band_edge_cc.cc5
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_complex.cc4
-rw-r--r--gnuradio-core/src/lib/general/gr_skiphead.cc8
-rw-r--r--gnuradio-core/src/lib/general/gr_skiphead.h10
-rw-r--r--gnuradio-core/src/lib/general/gr_skiphead.i8
-rw-r--r--gnuradio-core/src/lib/gengen/gr_add_XX.cc.t2
-rw-r--r--gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t4
-rw-r--r--gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t2
-rw-r--r--gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t4
-rw-r--r--gnuradio-core/src/lib/runtime/gr_preferences.cc24
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio.i2
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py11
33 files changed, 316 insertions, 227 deletions
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
index 399632003..84b0c578f 100644
--- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
+++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
@@ -71,7 +71,7 @@ gr_pfb_arb_resampler_ccf::gr_pfb_arb_resampler_ccf (float rate,
// Create an FIR filter for each channel and zero out the taps
std::vector<float> vtaps(0, d_int_rate);
- for(int i = 0; i < d_int_rate; i++) {
+ for(unsigned int i = 0; i < d_int_rate; i++) {
d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
d_diff_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
}
@@ -97,8 +97,6 @@ gr_pfb_arb_resampler_ccf::create_taps (const std::vector<float> &newtaps,
std::vector< std::vector<float> > &ourtaps,
std::vector<gr_fir_ccf*> &ourfilter)
{
- int i,j;
-
unsigned int ntaps = newtaps.size();
d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_int_rate);
@@ -114,10 +112,10 @@ gr_pfb_arb_resampler_ccf::create_taps (const std::vector<float> &newtaps,
}
// Partition the filter
- for(i = 0; i < d_int_rate; i++) {
+ for(unsigned int i = 0; i < d_int_rate; i++) {
// Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
ourtaps[d_int_rate-1-i] = std::vector<float>(d_taps_per_filter, 0);
- for(j = 0; j < d_taps_per_filter; j++) {
+ for(unsigned int j = 0; j < d_taps_per_filter; j++) {
ourtaps[d_int_rate - 1 - i][j] = tmp_taps[i + j*d_int_rate];
}
@@ -173,14 +171,16 @@ gr_pfb_arb_resampler_ccf::general_work (int noutput_items,
return 0; // history requirements may have changed.
}
- int i = 0, j, count = d_start_index;
+ int i = 0, count = d_start_index;
+ unsigned int j;
gr_complex o0, o1;
// Restore the last filter position
j = d_last_filter;
// produce output as long as we can and there are enough input samples
- while((i < noutput_items) && (count < ninput_items[0]-1)) {
+ int max_input = ninput_items[0]-(int)d_taps_per_filter;
+ while((i < noutput_items) && (count < max_input)) {
// start j by wrapping around mod the number of channels
while((j < d_int_rate) && (i < noutput_items)) {
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc
index cb67b8104..db16a634b 100644
--- a/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc
+++ b/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc
@@ -55,7 +55,6 @@ gr_pfb_channelizer_ccf::gr_pfb_channelizer_ccf (unsigned int numchans,
// This tests the specified input sample rate to see if it conforms to this
// requirement within a few significant figures.
double intp = 0;
- double x = (10000.0*rint(numchans / oversample_rate)) / 10000.0;
double fltp = modf(numchans / oversample_rate, &intp);
if(fltp != 0.0)
throw std::invalid_argument("gr_pfb_channelizer: oversample rate must be N/i for i in [1, N]");
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc
index 8a0ad1c4c..e20bc38bb 100644
--- a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc
+++ b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc
@@ -132,7 +132,7 @@ gr_pfb_interpolator_ccf::work (int noutput_items,
int i = 0, count = 0;
while(i < noutput_items) {
- for(int j = 0; j < d_rate; j++) {
+ for(unsigned int j = 0; j < d_rate; j++) {
out[i] = d_filters[j]->filter(&in[count]);
i++;
}
diff --git a/gnuradio-core/src/lib/filter/gr_sincos.c b/gnuradio-core/src/lib/filter/gr_sincos.c
index 240a84852..57b26b22f 100644
--- a/gnuradio-core/src/lib/filter/gr_sincos.c
+++ b/gnuradio-core/src/lib/filter/gr_sincos.c
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -24,7 +24,9 @@
#include "config.h"
#endif
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE // ask for GNU extensions if available
+#endif
#include <gr_sincos.h>
#include <math.h>
diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir.h b/gnuradio-core/src/lib/filter/gr_single_pole_iir.h
index bd59e53ac..da919b35c 100644
--- a/gnuradio-core/src/lib/filter/gr_single_pole_iir.h
+++ b/gnuradio-core/src/lib/filter/gr_single_pole_iir.h
@@ -71,12 +71,12 @@ public:
d_prev_output = 0;
}
- tap_type prev_output () { return d_prev_output; }
+ o_type prev_output () { return d_prev_output; }
protected:
tap_type d_alpha;
tap_type d_one_minus_alpha;
- tap_type d_prev_output;
+ o_type d_prev_output;
};
@@ -87,7 +87,7 @@ template<class o_type, class i_type, class tap_type>
o_type
gr_single_pole_iir<o_type, i_type, tap_type>::filter (const i_type input)
{
- tap_type output;
+ o_type output;
output = d_alpha * input + d_one_minus_alpha * d_prev_output;
d_prev_output = output;
diff --git a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.cc.t b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.cc.t
index c0d061c81..154068840 100644
--- a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.cc.t
+++ b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.cc.t
@@ -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;
+ }
+}
diff --git a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t
index d566b3674..23d64b65d 100644
--- a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t
+++ b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_XXX.h.t
@@ -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.
diff --git a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_ccf.h b/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_ccf.h
deleted file mode 100644
index 2b69f8b03..000000000
--- a/gnuradio-core/src/lib/filter/gri_fir_filter_with_buffer_ccf.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-/*
- * WARNING: This file is automatically generated by generate_gri_fir_XXX.py
- * Any changes made to this file will be overwritten.
- */
-
-
-#ifndef INCLUDED_GRI_FIR_FILTER_WITH_BUFFER_CCF_H
-#define INCLUDED_GRI_FIR_FILTER_WITH_BUFFER_CCF_H
-
-#include <vector>
-#include <gr_types.h>
-#include <gr_reverse.h>
-#include <string.h>
-#include <cstdio>
-
-/*!
- * \brief FIR with internal buffer for gr_complex input,
- gr_complex output and float taps
- * \ingroup filter
- *
- */
-
-class gri_fir_filter_with_buffer_ccf {
-
-protected:
- std::vector<float> d_taps; // reversed taps
- gr_complex *d_buffer;
- unsigned int d_idx;
-
-public:
-
- // CONSTRUCTORS
-
- /*!
- * \brief construct new FIR with given taps.
- *
- * Note that taps must be in forward order, e.g., coefficient 0 is
- * stored in new_taps[0], coefficient 1 is stored in
- * new_taps[1], etc.
- */
- gri_fir_filter_with_buffer_ccf (const std::vector<float> &taps);
-
- ~gri_fir_filter_with_buffer_ccf ();
-
- // MANIPULATORS
-
- /*!
- * \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.
- *
- * \returns the filtered input value.
- */
- gr_complex filter (gr_complex input);
-
- /*!
- * \brief compute an array of N output values.
- *
- * \p input must have (n - 1 + ntaps()) valid entries.
- * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values.
- */
- void filterN (gr_complex output[], const gr_complex input[],
- unsigned long n);
-
- /*!
- * \brief compute an array of N output values, decimating the input
- *
- * \p input must have (decimate * (n - 1) + ntaps()) valid entries.
- * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to
- * compute the output values.
- */
- void filterNdec (gr_complex output[], const gr_complex input[],
- unsigned long n, unsigned decimate);
-
- /*!
- * \brief install \p new_taps as the current taps.
- */
- void set_taps (const std::vector<float> &taps);
-
- // ACCESSORS
-
- /*!
- * \return number of taps in filter.
- */
- unsigned ntaps () const { return d_taps.size (); }
-
- /*!
- * \return current taps
- */
- const std::vector<float> get_taps () const
- {
- return gr_reverse(d_taps);
- }
-};
-
-#endif /* INCLUDED_GRI_FIR_FILTER_WITH_BUFFER_CCF_H */
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc
index cff81ab13..e87d93ebf 100644
--- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc
@@ -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);
}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.h
index 411a66a9a..f9f206f66 100644
--- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.h
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.h
@@ -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 ();
};
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.cc
index f2e09db1c..c25853b1e 100644
--- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.cc
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.cc
@@ -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);
}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.h
index b80be70a7..924b4bc2e 100644
--- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.h
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccf.h
@@ -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 ();
};
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.cc
index de0da9f1c..19f270200 100644
--- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.cc
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.cc
@@ -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);
}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.h
index 81b39f488..6201800f9 100644
--- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.h
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fcc.h
@@ -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 ();
};
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.cc
index ce689a54b..8401e484b 100644
--- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.cc
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.cc
@@ -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);
}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.h
index 5bb6c3e93..54a9cdc53 100644
--- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.h
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fff.h
@@ -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 ();
};
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.cc
index f09a1d7ac..091505380 100644
--- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.cc
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.cc
@@ -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;
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.h
index 38899b352..9c901464e 100644
--- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.h
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_fsf.h
@@ -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 ();
};
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.cc
index 4ba433ebf..03cd71022 100644
--- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.cc
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.cc
@@ -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);
}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.h b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.h
index fd9fe5b76..970ca3749 100644
--- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.h
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_scc.h
@@ -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 ();
};
diff --git a/gnuradio-core/src/lib/general/gr_circular_file.cc b/gnuradio-core/src/lib/general/gr_circular_file.cc
index 468b49a10..c9222597a 100644
--- a/gnuradio-core/src/lib/general/gr_circular_file.cc
+++ b/gnuradio-core/src/lib/general/gr_circular_file.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002 Free Software Foundation, Inc.
+ * Copyright 2002,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -66,7 +66,10 @@ gr_circular_file::gr_circular_file (const char *filename,
exit (1);
}
#ifdef HAVE_MMAP /* FIXME */
- ftruncate (d_fd, size + HEADER_SIZE);
+ if(ftruncate (d_fd, size + HEADER_SIZE) != 0) {
+ perror (filename);
+ exit (1);
+ }
#endif
}
else {
diff --git a/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.cc b/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.cc
index ff997e7a9..c32398e6d 100644
--- a/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.cc
+++ b/gnuradio-core/src/lib/general/gr_fll_band_edge_cc.cc
@@ -161,8 +161,9 @@ gr_fll_band_edge_cc::work (int noutput_items,
const gr_complex *in = (const gr_complex *) input_items[0];
gr_complex *out = (gr_complex *) output_items[0];
- float *frq, *phs;
- gr_complex *err;
+ float *frq = NULL;
+ float *phs = NULL;
+ gr_complex *err = NULL;
if(output_items.size() > 2) {
frq = (float *) output_items[1];
phs = (float *) output_items[2];
diff --git a/gnuradio-core/src/lib/general/gr_float_to_complex.cc b/gnuradio-core/src/lib/general/gr_float_to_complex.cc
index 89ef18869..a392abd06 100644
--- a/gnuradio-core/src/lib/general/gr_float_to_complex.cc
+++ b/gnuradio-core/src/lib/general/gr_float_to_complex.cc
@@ -52,12 +52,12 @@ gr_float_to_complex::work (int noutput_items,
switch (input_items.size ()){
case 1:
- for (int j = 0; j < noutput_items*d_vlen; j++)
+ for (size_t j = 0; j < noutput_items*d_vlen; j++)
out[j] = gr_complex (r[j], 0);
break;
case 2:
- for (int j = 0; j < noutput_items*d_vlen; j++)
+ for (size_t j = 0; j < noutput_items*d_vlen; j++)
out[j] = gr_complex (r[j], i[j]);
break;
diff --git a/gnuradio-core/src/lib/general/gr_skiphead.cc b/gnuradio-core/src/lib/general/gr_skiphead.cc
index ea7e9405f..1670eb7cf 100644
--- a/gnuradio-core/src/lib/general/gr_skiphead.cc
+++ b/gnuradio-core/src/lib/general/gr_skiphead.cc
@@ -27,7 +27,7 @@
#include <gr_io_signature.h>
#include <string.h>
-gr_skiphead::gr_skiphead (size_t itemsize, size_t nitems_to_skip)
+gr_skiphead::gr_skiphead (size_t itemsize, uint64_t nitems_to_skip)
: gr_block ("skiphead",
gr_make_io_signature(1, 1, itemsize),
gr_make_io_signature(1, 1, itemsize)),
@@ -36,7 +36,7 @@ gr_skiphead::gr_skiphead (size_t itemsize, size_t nitems_to_skip)
}
gr_skiphead_sptr
-gr_make_skiphead (size_t itemsize, size_t nitems_to_skip)
+gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip)
{
return gnuradio::get_initial_sptr(new gr_skiphead (itemsize, nitems_to_skip));
}
@@ -55,11 +55,11 @@ gr_skiphead::general_work(int noutput_items,
while (ii < ninput_items){
- long long ni_total = ii + d_nitems; // total items processed so far
+ uint64_t ni_total = ii + d_nitems; // total items processed so far
if (ni_total < d_nitems_to_skip){ // need to skip some more
int n_to_skip = (int) std::min(d_nitems_to_skip - ni_total,
- (long long)(ninput_items - ii));
+ (uint64_t)(ninput_items - ii));
ii += n_to_skip;
}
diff --git a/gnuradio-core/src/lib/general/gr_skiphead.h b/gnuradio-core/src/lib/general/gr_skiphead.h
index 965feff9b..933c126e3 100644
--- a/gnuradio-core/src/lib/general/gr_skiphead.h
+++ b/gnuradio-core/src/lib/general/gr_skiphead.h
@@ -39,11 +39,11 @@ typedef boost::shared_ptr<gr_skiphead> gr_skiphead_sptr;
class gr_skiphead : public gr_block
{
- friend gr_skiphead_sptr gr_make_skiphead (size_t itemsize, size_t nitems_to_skip);
- gr_skiphead (size_t itemsize, size_t nitems_to_skip);
+ friend gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip);
+ gr_skiphead (size_t itemsize, uint64_t nitems_to_skip);
- long long d_nitems_to_skip;
- long long d_nitems; // total items seen
+ uint64_t d_nitems_to_skip;
+ uint64_t d_nitems; // total items seen
public:
@@ -54,7 +54,7 @@ class gr_skiphead : public gr_block
};
gr_skiphead_sptr
-gr_make_skiphead (size_t itemsize, size_t nitems_to_skip);
+gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip);
#endif /* INCLUDED_GR_SKIPHEAD_H */
diff --git a/gnuradio-core/src/lib/general/gr_skiphead.i b/gnuradio-core/src/lib/general/gr_skiphead.i
index 52c0808f0..45cbd0437 100644
--- a/gnuradio-core/src/lib/general/gr_skiphead.i
+++ b/gnuradio-core/src/lib/general/gr_skiphead.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2007 Free Software Foundation, Inc.
+ * Copyright 2005,2007,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -22,9 +22,9 @@
GR_SWIG_BLOCK_MAGIC(gr,skiphead);
-gr_skiphead_sptr gr_make_skiphead (size_t itemsize, size_t nitems_to_skip);
+gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip);
class gr_skiphead : public gr_block {
- friend gr_skiphead_sptr gr_make_skiphead (size_t itemsize, size_t nitems_to_skip);
- gr_skiphead (size_t itemsize, size_t nitems_to_skip);
+ friend gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip);
+ gr_skiphead (size_t itemsize, uint64_t nitems_to_skip);
};
diff --git a/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t
index 58a25325a..0e8b23ee1 100644
--- a/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t
+++ b/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t
@@ -52,7 +52,7 @@ int
int ninputs = input_items.size ();
- for (int i = 0; i < noutput_items*d_vlen; i++){
+ for (size_t i = 0; i < noutput_items*d_vlen; i++){
@I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
for (int j = 1; j < ninputs; j++)
acc += ((@I_TYPE@ *) input_items[j])[i];
diff --git a/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t
index 1200145fa..ea245b57b 100644
--- a/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t
+++ b/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t
@@ -53,13 +53,13 @@ int
int ninputs = input_items.size ();
if (ninputs == 1){ // compute reciprocal
- for (int i = 0; i < noutput_items*d_vlen; i++)
+ for (size_t i = 0; i < noutput_items*d_vlen; i++)
*optr++ = (@O_TYPE@) ((@O_TYPE@) 1 /
((@I_TYPE@ *) input_items[0])[i]);
}
else {
- for (int i = 0; i < noutput_items*d_vlen; i++){
+ for (size_t i = 0; i < noutput_items*d_vlen; i++){
@I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
for (int j = 1; j < ninputs; j++)
acc /= ((@I_TYPE@ *) input_items[j])[i];
diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t
index 13ec0c8b3..5d270c763 100644
--- a/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t
+++ b/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t
@@ -52,7 +52,7 @@ int
int ninputs = input_items.size ();
- for (int i = 0; i < noutput_items*d_vlen; i++){
+ for (size_t i = 0; i < noutput_items*d_vlen; i++){
@I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
for (int j = 1; j < ninputs; j++)
acc *= ((@I_TYPE@ *) input_items[j])[i];
diff --git a/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t
index f0ed75217..1dcdf81ad 100644
--- a/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t
+++ b/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t
@@ -53,12 +53,12 @@ int
int ninputs = input_items.size ();
if (ninputs == 1){ // negate
- for (int i = 0; i < noutput_items*d_vlen; i++)
+ for (size_t i = 0; i < noutput_items*d_vlen; i++)
*optr++ = (@O_TYPE@) -((@I_TYPE@ *) input_items[0])[i];
}
else {
- for (int i = 0; i < noutput_items*d_vlen; i++){
+ for (size_t i = 0; i < noutput_items*d_vlen; i++){
@I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
for (int j = 1; j < ninputs; j++)
acc -= ((@I_TYPE@ *) input_items[j])[i];
diff --git a/gnuradio-core/src/lib/runtime/gr_preferences.cc b/gnuradio-core/src/lib/runtime/gr_preferences.cc
index e0be2db62..5f7412248 100644
--- a/gnuradio-core/src/lib/runtime/gr_preferences.cc
+++ b/gnuradio-core/src/lib/runtime/gr_preferences.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2003 Free Software Foundation, Inc.
+ * Copyright 2003,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -77,11 +77,20 @@ gr_preferences::get (const char *key)
static char buf[1024];
FILE *fp = fopen (pathname (key), "r");
- if (fp == 0)
+ if (fp == 0) {
+ perror (pathname (key));
return 0;
+ }
memset (buf, 0, sizeof (buf));
- fread (buf, 1, sizeof (buf) - 1, fp);
+ size_t ret = fread (buf, 1, sizeof (buf) - 1, fp);
+ if(ret == 0) {
+ if(ferror(fp) != 0) {
+ perror (pathname (key));
+ fclose (fp);
+ return 0;
+ }
+ }
fclose (fp);
return buf;
}
@@ -97,6 +106,13 @@ gr_preferences::set (const char *key, const char *value)
return;
}
- fwrite (value, 1, strlen (value), fp);
+ size_t ret = fwrite (value, 1, strlen (value), fp);
+ if(ret == 0) {
+ if(ferror(fp) != 0) {
+ perror (pathname (key));
+ fclose (fp);
+ return;
+ }
+ }
fclose (fp);
};
diff --git a/gnuradio-core/src/lib/swig/gnuradio.i b/gnuradio-core/src/lib/swig/gnuradio.i
index 7d0241f1c..e15a0059c 100644
--- a/gnuradio-core/src/lib/swig/gnuradio.i
+++ b/gnuradio-core/src/lib/swig/gnuradio.i
@@ -46,6 +46,8 @@
typedef std::complex<float> gr_complex;
typedef std::complex<double> gr_complexd;
+typedef unsigned long long uint64_t;
+typedef long long int64_t;
// instantiate the required template specializations
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py
index e40d9636a..cd9289fa5 100644
--- a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py
@@ -31,15 +31,22 @@ class pfb_arb_resampler_ccf(gr.hier_block2):
streams. This block is provided to be consistent with the interface to the
other PFB block.
'''
- def __init__(self, rate, taps, flt_size=32):
+ def __init__(self, rate, taps=None, flt_size=32, atten=80):
gr.hier_block2.__init__(self, "pfb_arb_resampler_ccf",
gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
self._rate = rate
- self._taps = taps
self._size = flt_size
+ if taps is not None:
+ self._taps = taps
+ else:
+ # Create a filter that covers the full bandwidth of the input signal
+ bw = 0.5
+ tb = 0.1
+ self._taps = gr.firdes.low_pass_2(self._size, self._size, bw, tb, atten)
+
self.pfb = gr.pfb_arb_resampler_ccf(self._rate, self._taps, self._size)
self.connect(self, self.pfb)