GNU Radio Manual and C++ API Reference  3.7.9.2
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
equalizer_impl.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 _ATSC_EQUALIZER_H_
24 #define _ATSC_EQUALIZER_H_
25 
26 #include <gnuradio/atsc/api.h>
28 #include <vector>
29 
30 /*!
31  * \brief abstract base class for ATSC equalizer
32  */
34 
35 private:
36 
37  /*
38  * have we seen a field sync since the last reset or problem?
39  */
40  bool d_locked_p;
41 
42  /*
43  * sample offset from the beginning of the last field sync we saw
44  * to the beginning of our current input stream. When we're locked
45  * this will be in [0, 313*832] i.e., [0, 260416]
46  */
47  int d_offset_from_last_field_sync;
48 
49  int d_current_field; // [0,1]
50 
51 
52 public:
53 
54  // CREATORS
55  atsci_equalizer ();
56  virtual ~atsci_equalizer ();
57 
58  virtual std::vector<double> taps () {
59  return std::vector<double>();
60  }
61 
62  // MANIPULATORS
63 
64  /*!
65  * \brief reset state (e.g., on channel change)
66  *
67  * Note, subclasses must invoke the superclass's method too!
68  */
69  virtual void reset ();
70 
71  /*!
72  * \brief produce \p nsamples of output from given inputs and tags
73  *
74  * This is the main entry point. It examines the input_tags
75  * and local state and invokes the appropriate virtual function
76  * to handle each sub-segment of the input data.
77  *
78  * \p input_samples must have (nsamples + ntaps() - 1) valid entries.
79  * input_samples[0] .. input_samples[nsamples - 1 + ntaps() - 1] are
80  * referenced to compute the output values.
81  *
82  * \p input_tags must have nsamples valid entries.
83  * input_tags[0] .. input_tags[nsamples - 1] are referenced to
84  * compute the output values.
85  */
86  virtual void filter (const float *input_samples,
87  const atsc::syminfo *input_tags,
88  float *output_samples,
89  int nsamples);
90 
91  // ACCESSORS
92 
93  /*!
94  * \brief how much history the input data stream requires.
95  *
96  * This must return a value >= 1. Think of this as the number
97  * of samples you need to look at to compute a single output sample.
98  */
99  virtual int ntaps () const = 0;
100 
101  /*!
102  * \brief how many taps are "in the future".
103  *
104  * This allows us to handle what the ATSC folks call "pre-ghosts".
105  * What it really does is allow the caller to jack with the offset
106  * between the tags and the data so that everything magically works out.
107  *
108  * npretaps () must return a value between 0 and ntaps() - 1.
109  *
110  * If npretaps () returns 0, this means that the equalizer will only handle
111  * multipath "in the past." I suspect that a good value would be something
112  * like 15% - 20% of ntaps ().
113  */
114  virtual int npretaps () const = 0;
115 
116 
117 protected:
118 
119  /*!
120  * Input range is known NOT TO CONTAIN data segment syncs
121  * or field syncs. This should be the fast path. In the
122  * non decicion directed case, this just runs the input
123  * through the filter without adapting it.
124  *
125  * \p input_samples has (nsamples + ntaps() - 1) valid entries.
126  * input_samples[0] .. input_samples[nsamples - 1 + ntaps() - 1] may be
127  * referenced to compute the output values.
128  */
129  virtual void filter_normal (const float *input_samples,
130  float *output_samples,
131  int nsamples) = 0;
132 
133  /*!
134  * Input range is known to consist of only a data segment sync or a
135  * portion of a data segment sync. \p nsamples will be in [1,4].
136  * \p offset will be in [0,3]. \p offset is the offset of the input
137  * from the beginning of the data segment sync pattern.
138  *
139  * \p input_samples has (nsamples + ntaps() - 1) valid entries.
140  * input_samples[0] .. input_samples[nsamples - 1 + ntaps() - 1] may be
141  * referenced to compute the output values.
142  */
143  virtual void filter_data_seg_sync (const float *input_samples,
144  float *output_samples,
145  int nsamples,
146  int offset) = 0;
147 
148  /*!
149  * Input range is known to consist of only a field sync segment or a
150  * portion of a field sync segment. \p nsamples will be in [1,832].
151  * \p offset will be in [0,831]. \p offset is the offset of the input
152  * from the beginning of the data segment sync pattern. We consider the
153  * 4 symbols of the immediately preceding data segment sync to be the
154  * first symbols of the field sync segment. \p which_field is in [0,1]
155  * and specifies which field (duh).
156  *
157  * \p input_samples has (nsamples + ntaps() - 1) valid entries.
158  * input_samples[0] .. input_samples[nsamples - 1 + ntaps() - 1] may be
159  * referenced to compute the output values.
160  */
161  virtual void filter_field_sync (const float *input_samples,
162  float *output_samples,
163  int nsamples,
164  int offset,
165  int which_field) = 0;
166 };
167 
168 
169 #endif /* _ATSC_EQUALIZER_H_ */
#define ATSC_API
Definition: gr-atsc/include/gnuradio/atsc/api.h:30
Definition: syminfo_impl.h:30
virtual std::vector< double > taps()
Definition: equalizer_impl.h:58
abstract base class for ATSC equalizer
Definition: equalizer_impl.h:33