GNU Radio Manual and C++ API Reference  3.7.5.1
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
atsc_sync_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2014 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 INCLUDED_DTV_ATSC_SYNC_IMPL_H
24 #define INCLUDED_DTV_ATSC_SYNC_IMPL_H
25 
27 #include <gnuradio/dtv/atsc_sync.h>
30 
31 namespace gr {
32  namespace dtv {
33 
34  class atsc_sync_impl : public atsc_sync
35  {
36  private:
37  static const double LOOP_FILTER_TAP = 0.0005; // 0.0005 works
38  static const double ADJUSTMENT_GAIN = 1.0e-5 / (10 * ATSC_DATA_SEGMENT_LENGTH);
39  static const int SYMBOL_INDEX_OFFSET = 3;
40  static const int MIN_SEG_LOCK_CORRELATION_VALUE = 5;
41  static const int SSI_MIN = -16;
42  static const int SSI_MAX = 15;
43 
44  gr::filter::single_pole_iir<float,float,float> d_loop; // ``VCO'' loop filter
46 
47  unsigned long long d_next_input;
48  double d_rx_clock_to_symbol_freq;
49  int d_si;
50  double d_w; // ratio of PERIOD of Tx to Rx clocks
51  double d_mu; // fractional delay [0,1]
52  int d_incr;
53 
54  float sample_mem[ATSC_DATA_SEGMENT_LENGTH];
55  float data_mem[ATSC_DATA_SEGMENT_LENGTH];
56 
57  double d_timing_adjust;
58  int d_counter; // free running mod 832 counter
59  int d_symbol_index;
60  bool d_seg_locked;
61  int d_sr; // 4 bit shift register
62  signed char d_integrator[ATSC_DATA_SEGMENT_LENGTH];
63  int output_produced;
64 
65  public:
66  atsc_sync_impl(float rate);
68 
69  void reset();
70 
71  void forecast(int noutput_items,
72  gr_vector_int &ninput_items_required);
73 
74  virtual int general_work(int noutput_items,
75  gr_vector_int &ninput_items,
76  gr_vector_const_void_star &input_items,
77  gr_vector_void_star &output_items);
78  };
79 
80  } /* namespace dtv */
81 } /* namespace gr */
82 
83 #endif /* INCLUDED_DTV_ATSC_SYNC_IMPL_H */
Definition: atsc_sync_impl.h:34
ATSC Receiver SYNC.
Definition: atsc_sync.h:37
virtual int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
compute output items from input items
void forecast(int noutput_items, gr_vector_int &ninput_items_required)
Estimate input requirements given output request.
std::vector< const void * > gr_vector_const_void_star
Definition: gnuradio-runtime/include/gnuradio/types.h:38
static const int ATSC_DATA_SEGMENT_LENGTH
Definition: atsc_consts.h:41
std::vector< void * > gr_vector_void_star
Definition: gnuradio-runtime/include/gnuradio/types.h:37
std::vector< int > gr_vector_int
Definition: gnuradio-runtime/include/gnuradio/types.h:33
atsc_sync_impl(float rate)
Compute intermediate samples between signal samples x(k*Ts)
Definition: mmse_fir_interpolator_ff.h:50