projects
/
debian
/
gnuradio
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
PFB resampler: fixes bug where filter could be looking past the number of inputs.
[debian/gnuradio]
/
gnuradio-core
/
src
/
lib
/
filter
/
gr_pfb_arb_resampler_ccf.cc
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 48eb849ab1f32ca54bdd47c003ce8674edbc8e28..00c2dab0c42bf0933093bd5e91d09a53fa63b8ca 100644
(file)
--- a/
gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
+++ b/
gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
@@
-1,6
+1,6
@@
/* -*- c++ -*- */
/*
/* -*- c++ -*- */
/*
- * Copyright 2009 Free Software Foundation, Inc.
+ * Copyright 2009
,2010
Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
*
* This file is part of GNU Radio
*
@@
-34,8
+34,8
@@
gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate,
const std::vector<float> &taps,
unsigned int filter_size)
{
const std::vector<float> &taps,
unsigned int filter_size)
{
- return g
r_pfb_arb_resampler_ccf_sptr
(new gr_pfb_arb_resampler_ccf (rate, taps,
-
filter_size));
+ return g
nuradio::get_initial_sptr
(new gr_pfb_arb_resampler_ccf (rate, taps,
+ filter_size));
}
}
@@
-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);
// 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);
}
d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
d_diff_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
}
@@
-79,8
+79,10
@@
gr_pfb_arb_resampler_ccf::gr_pfb_arb_resampler_ccf (float rate,
// Now, actually set the filters' taps
std::vector<float> dtaps;
create_diff_taps(taps, dtaps);
// Now, actually set the filters' taps
std::vector<float> dtaps;
create_diff_taps(taps, dtaps);
- set_taps(taps, d_taps, d_filters);
- set_taps(dtaps, d_dtaps, d_diff_filters);
+ create_taps(taps, d_taps, d_filters);
+ create_taps(dtaps, d_dtaps, d_diff_filters);
+
+ set_relative_rate(rate);
}
gr_pfb_arb_resampler_ccf::~gr_pfb_arb_resampler_ccf ()
}
gr_pfb_arb_resampler_ccf::~gr_pfb_arb_resampler_ccf ()
@@
-91,12
+93,10
@@
gr_pfb_arb_resampler_ccf::~gr_pfb_arb_resampler_ccf ()
}
void
}
void
-gr_pfb_arb_resampler_ccf::
set
_taps (const std::vector<float> &newtaps,
- std::vector< std::vector<float> > &ourtaps,
- std::vector<gr_fir_ccf*> &ourfilter)
+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);
unsigned int ntaps = newtaps.size();
d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_int_rate);
@@
-112,10
+112,10
@@
gr_pfb_arb_resampler_ccf::set_taps (const std::vector<float> &newtaps,
}
// Partition the filter
}
// 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);
// 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];
}
ourtaps[d_int_rate - 1 - i][j] = tmp_taps[i + j*d_int_rate];
}
@@
-171,14
+171,15
@@
gr_pfb_arb_resampler_ccf::general_work (int noutput_items,
return 0; // history requirements may have changed.
}
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
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
)) {
+ while((i < noutput_items) && (count < ninput_items[0]-
d_taps_per_filter
)) {
// start j by wrapping around mod the number of channels
while((j < d_int_rate) && (i < noutput_items)) {
// start j by wrapping around mod the number of channels
while((j < d_int_rate) && (i < noutput_items)) {