GNU Radio's DAB Package
dab_moving_sum_cc.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2004 Free Software Foundation, Inc.
4 *
5 * This file is part of GNU Radio
6 *
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
10 * any later version.
11 *
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
21 */
22#ifndef INCLUDED_DAB_MOVING_SUM_CC_H
23#define INCLUDED_DAB_MOVING_SUM_CC_H
24
25#include <gr_sync_block.h>
26
28
29typedef std::shared_ptr<dab_moving_sum_cc> dab_moving_sum_cc_sptr;
30
31dab_moving_sum_cc_sptr dab_make_moving_sum_cc (int length);
32
33/*!
34 * \brief Moving sum over a stream of complex floats.
35 * \ingroup filter
36 * \param length length of the moving sum (=number of taps)
37 *
38 * input: complex
39 * output: complex
40 *
41 * This is the same as an FIR filter with length taps 1, but much faster
42 * (linear time instead of O(n*m)). On the other hand, since only the diff is
43 * calculated for each sample, there is some chance of an accumulating error.
44 */
45class dab_moving_sum_cc : public gr_sync_block
46{
47private:
48 // The friend declaration allows dab_make_moving_sum_cc to
49 // access the private constructor.
50
51 friend dab_moving_sum_cc_sptr dab_make_moving_sum_cc (int length);
52
53 dab_moving_sum_cc (int length); // private constructor
54
55 gr_complexd d_sum;
56 int d_length;
57
58 public:
59 ~dab_moving_sum_cc (); // public destructor
60 int length() const {return d_length;}
61 void reset() {d_sum=0;}
62
63 // Where all the action really happens
64
65 int work (int noutput_items,
66 gr_vector_const_void_star &input_items,
67 gr_vector_void_star &output_items);
68};
69
70#endif /* INCLUDED_DAB_MOVING_SUM_CC_H */
Moving sum over a stream of complex floats.
Definition dab_moving_sum_cc.h:46
void reset()
Definition dab_moving_sum_cc.h:61
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
int length() const
Definition dab_moving_sum_cc.h:60
friend dab_moving_sum_cc_sptr dab_make_moving_sum_cc(int length)
dab_moving_sum_cc_sptr dab_make_moving_sum_cc(int length)