summaryrefslogtreecommitdiff
path: root/gr-filter/include/filter
diff options
context:
space:
mode:
Diffstat (limited to 'gr-filter/include/filter')
-rw-r--r--gr-filter/include/filter/fir_filter.h30
-rw-r--r--gr-filter/include/filter/fir_filter_with_buffer.h113
2 files changed, 124 insertions, 19 deletions
diff --git a/gr-filter/include/filter/fir_filter.h b/gr-filter/include/filter/fir_filter.h
index 1fb3afb4d..ba82c7f48 100644
--- a/gr-filter/include/filter/fir_filter.h
+++ b/gr-filter/include/filter/fir_filter.h
@@ -51,13 +51,13 @@ namespace gr {
unsigned long n,
unsigned int decimate);
- private:
- unsigned int d_ntaps;
- float *d_taps;
- float **d_aligned_taps;
- float *d_output;
- int d_align;
- int d_naligned;
+ protected:
+ std::vector<float> d_taps;
+ unsigned int d_ntaps;
+ float **d_aligned_taps;
+ float *d_output;
+ int d_align;
+ int d_naligned;
};
/**************************************************************/
@@ -82,9 +82,9 @@ namespace gr {
unsigned long n,
unsigned int decimate);
- private:
+ protected:
+ std::vector<float> d_taps;
unsigned int d_ntaps;
- float *d_taps;
float **d_aligned_taps;
gr_complex *d_output;
int d_align;
@@ -113,9 +113,9 @@ namespace gr {
unsigned long n,
unsigned int decimate);
- private:
+ protected:
+ std::vector<gr_complex> d_taps;
unsigned int d_ntaps;
- gr_complex *d_taps;
gr_complex **d_aligned_taps;
gr_complex *d_output;
int d_align;
@@ -144,9 +144,9 @@ namespace gr {
unsigned long n,
unsigned int decimate);
- private:
+ protected:
+ std::vector<gr_complex> d_taps;
unsigned int d_ntaps;
- gr_complex *d_taps;
gr_complex **d_aligned_taps;
gr_complex *d_output;
int d_align;
@@ -175,9 +175,9 @@ namespace gr {
unsigned long n,
unsigned int decimate);
- private:
+ protected:
+ std::vector<float> d_taps;
unsigned int d_ntaps;
- float *d_taps;
float **d_aligned_taps;
short *d_output;
int d_align;
diff --git a/gr-filter/include/filter/fir_filter_with_buffer.h b/gr-filter/include/filter/fir_filter_with_buffer.h
index feebb382f..2ccb74906 100644
--- a/gr-filter/include/filter/fir_filter_with_buffer.h
+++ b/gr-filter/include/filter/fir_filter_with_buffer.h
@@ -38,10 +38,14 @@ namespace gr {
class FILTER_API fir_filter_with_buffer_fff
{
private:
- float *d_taps;
+ std::vector<float> d_taps;
+ unsigned int d_ntaps;
float *d_buffer;
unsigned int d_idx;
- unsigned int d_ntaps;
+ float *d_aligned_taps;
+ float *d_output;
+ int d_align;
+ int d_naligned;
public:
@@ -130,10 +134,14 @@ namespace gr {
class FILTER_API fir_filter_with_buffer_ccc
{
private:
- gr_complex *d_taps;
+ std::vector<gr_complex> d_taps;
+ unsigned int d_ntaps;
gr_complex *d_buffer;
unsigned int d_idx;
- unsigned int d_ntaps;
+ gr_complex *d_aligned_taps;
+ gr_complex *d_output;
+ int d_align;
+ int d_naligned;
public:
@@ -211,6 +219,103 @@ namespace gr {
std::vector<gr_complex> taps() const;
};
+
+ /**************************************************************/
+
+
+ /*!
+ * \brief FIR with internal buffer for gr_complex input, gr_complex output and gr_complex taps.
+ * \ingroup filter
+ */
+ class FILTER_API fir_filter_with_buffer_ccf
+ {
+ private:
+ std::vector<float> d_taps;
+ unsigned int d_ntaps;
+ gr_complex *d_buffer;
+ unsigned int d_idx;
+ float *d_aligned_taps;
+ gr_complex *d_output;
+ int d_align;
+ int d_naligned;
+
+ 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.
+ */
+ fir_filter_with_buffer_ccf(const std::vector<float> &taps);
+
+ ~fir_filter_with_buffer_ccf();
+
+ // MANIPULATORS
+
+ /*!
+ * \brief compute a single 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.
+ *
+ * \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 long decimate);
+
+ // ACCESSORS
+
+ /*!
+ * \return number of taps in filter.
+ */
+ unsigned int ntaps() const { return d_ntaps; }
+
+ /*!
+ * \brief install \p new_taps as the current taps.
+ */
+ void set_taps(const std::vector<float> &taps);
+
+ /*!
+ * \return current taps
+ */
+ std::vector<float> taps() const;
+ };
+
+
} /* namespace kernel */
} /* namespace filter */
} /* namespace gr */