3 * Copyright 2007 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
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 2, or (at your option)
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.
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.
22 #ifndef INCLUDED_CVSD_DECODE_BS_H
23 #define INCLUDED_CVSD_DECODE_BS_H
25 #include <gr_sync_interpolator.h>
29 typedef boost::shared_ptr<cvsd_decode_bs> cvsd_decode_bs_sptr;
31 cvsd_decode_bs_sptr cvsd_make_decode_bs (short min_step=10,
33 double step_decay=0.9990234375,
34 double accum_decay= 0.96875,
37 short pos_accum_max=32767,
38 short neg_accum_max=-32767);
40 class cvsd_decode_bs : public gr_sync_interpolator
43 friend cvsd_decode_bs_sptr cvsd_make_decode_bs (short min_step,
52 cvsd_decode_bs (short min_step, short max_step, double step_decay,
53 double accum_decay, int K, int J,
54 short pos_accum_max, short neg_accum_max);
56 int cvsd_round(double input);
57 unsigned int cvsd_pow (short radix, short power);
58 unsigned char cvsd_bitwise_sum (unsigned int input);
65 //! \brief Size of shift register; the number of output bits remembered in shift register
68 //! \brief Number of bits in the shift register that are equal; size of run of 1s, 0s
71 short d_pos_accum_max;
72 short d_neg_accum_max;
76 unsigned int d_runner;
77 unsigned int d_runner_mask; // 4 bytes, 0 .. 4,294,967,295
81 ~cvsd_decode_bs (); // public destructor
83 short min_step() { return d_min_step; }
84 short max_step() { return d_max_step; }
85 double step_decay() { return d_step_decay; }
86 double accum_decay() { return d_accum_decay; }
87 int K() { return d_K; }
88 int J() { return d_J; }
89 short pos_accum_max() { return d_pos_accum_max; }
90 short neg_accum_max() { return d_neg_accum_max; }
92 int work (int noutput_items,
93 gr_vector_const_void_star &input_items,
94 gr_vector_void_star &output_items);
97 #endif /* INCLUDED_CVSD_DECODE_BS_H */