GNU Radio Manual and C++ API Reference  3.7.4.1
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GrAtscBitTimingLoop2.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2002 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 
23 #ifndef _GRATSCBITTIMINGLOOP2_H_
24 #define _GRATSCBITTIMINGLOOP2_H_
25 
26 #include <gnuradio/blocks/nco.h>
27 #include <VrSigProc.h>
28 #include <VrHistoryProc.h>
29 #include <VrDecimatingSigProc.h>
31 #include <filtersingle_pole_iir.h>
32 #include <gnuradio/filter/mmse_fir_interpolator.h>
33 
34 /*!
35  * \brief ATSC BitTimingLoop
36  *
37  * This class accepts a single real input and produces a single real output
38  */
39 
40 class GrAtscBitTimingLoop2 : public VrDecimatingSigProc<float,float> {
41 
42  public:
43 
45  virtual ~GrAtscBitTimingLoop2 () { };
46 
47  virtual const char *name () { return "GrAtscBitTimingLoop2"; }
48 
49  virtual int forecast (VrSampleRange output,
50  VrSampleRange inputs[]);
51 
52  virtual int work (VrSampleRange output, void *o[],
53  VrSampleRange inputs[], void *i[]);
54 
55  // debug
56  void set_mu (float a_mu) {
57  assert (0 <= a_mu && a_mu <= 1.9);
58  use_right_p = a_mu < 1.0;
59  mu = a_mu - floor (a_mu);
60  cerr << "BTL2: mu: " << mu << " use_right_p: " << use_right_p << endl;
61  }
62 
63  protected:
64 
65  typedef float iType;
66  typedef float oType;
67 
68  iType produce_sample (const iType *in, unsigned int &index);
69  float filter_error (float e);
70 
71  VrSampleIndex next_input;
72  gr_single_pole_iir<float,float,float> dc; // used to estimate DC component
73  gr_mmse_fir_interpolator intr;
74  float mu; // fractional delay
75  iType last_right; // last right hand sample
76 
77  bool use_right_p; // ...else middle
78 };
79 
80 #endif // _GRATSCBITTIMINGLOOP2_H_
ATSC BitTimingLoop.
Definition: GrAtscBitTimingLoop2.h:40
virtual int forecast(VrSampleRange output, VrSampleRange inputs[])
virtual const char * name()
Definition: GrAtscBitTimingLoop2.h:47
iType last_right
Definition: GrAtscBitTimingLoop2.h:75
float iType
Definition: GrAtscBitTimingLoop2.h:65
void set_mu(float a_mu)
Definition: GrAtscBitTimingLoop2.h:56
float oType
Definition: GrAtscBitTimingLoop2.h:66
iType produce_sample(const iType *in, unsigned int &index)
gr_single_pole_iir< float, float, float > dc
Definition: GrAtscBitTimingLoop2.h:72
float mu
Definition: GrAtscBitTimingLoop2.h:74
virtual ~GrAtscBitTimingLoop2()
Definition: GrAtscBitTimingLoop2.h:45
VrSampleIndex next_input
Definition: GrAtscBitTimingLoop2.h:71
gr_mmse_fir_interpolator intr
Definition: GrAtscBitTimingLoop2.h:73
bool use_right_p
Definition: GrAtscBitTimingLoop2.h:77
virtual int work(VrSampleRange output, void *o[], VrSampleRange inputs[], void *i[])
float filter_error(float e)