3 * Copyright 2002 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., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 #ifndef _GRATSCBITTIMINGLOOP2_H_
24 #define _GRATSCBITTIMINGLOOP2_H_
27 #include <VrSigProc.h>
28 #include <VrHistoryProc.h>
29 #include <VrDecimatingSigProc.h>
30 #include <interleaver_fifo.h>
31 #include <gr_single_pole_iir.h>
32 #include <gr_mmse_fir_interpolator.h>
35 * \brief ATSC BitTimingLoop
37 * This class accepts a single real input and produces a single real output
40 class GrAtscBitTimingLoop2 : public VrDecimatingSigProc<float,float> {
44 GrAtscBitTimingLoop2 ();
45 virtual ~GrAtscBitTimingLoop2 () { };
47 virtual const char *name () { return "GrAtscBitTimingLoop2"; }
49 virtual int forecast (VrSampleRange output,
50 VrSampleRange inputs[]);
52 virtual int work (VrSampleRange output, void *o[],
53 VrSampleRange inputs[], void *i[]);
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;
68 iType produce_sample (const iType *in, unsigned int &index);
69 float filter_error (float e);
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
77 bool use_right_p; // ...else middle
80 #endif // _GRATSCBITTIMINGLOOP2_H_