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
GrAtscSymbolMapper.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 _GRATSCSYMBOLMAPPER_H_
24 #define _GRATSCSYMBOLMAPPER_H_
25 
26 
27 #include <VrInterpolatingSigProcNoWork.h>
28 #include <gnuradio/atsc/types.h>
29 #include <gnuradio/blocks/nco.h>
30 
31 /*!
32  * \brief take atsc_data_segments and map them to symbols.
33  *
34  * Input is a stream of atsc_data_segments.
35  * Output is a stream of symbols at 1x the symbol rate
36  *
37  * This module performs the signal mapping & pilot addition.
38  */
39 
40 template<class oType>
42  : public VrInterpolatingSigProcNoWork<atsc_data_segment, oType> {
43 
44 public:
46  : VrInterpolatingSigProcNoWork<atsc_data_segment, oType>(1, INTERP_FACTOR) {};
47 
49 
50  const char *name () { return "GrAtscSymbolMapper"; }
51 
52  int work (VrSampleRange output, void *ao[],
53  VrSampleRange inputs[], void *ai[]);
54 
55 protected:
57 };
58 
59 
60 template<class oType>
61 int
62 GrAtscSymbolMapper<oType>::work (VrSampleRange output, void *ao[],
63  VrSampleRange inputs[], void *ai[])
64 {
65  atsc_data_segment *in = ((atsc_data_segment **) ai)[0];
66  oType *out = ((oType **) ao)[0];
67 
68  assert ((output.size % INTERP_FACTOR) == 0);
69 
70  static const float pilot_add = 1.25;
71  static const float map[8] = {
72  -7 + pilot_add,
73  -5 + pilot_add,
74  -3 + pilot_add,
75  -1 + pilot_add,
76  1 + pilot_add,
77  3 + pilot_add,
78  5 + pilot_add,
79  7 + pilot_add
80  };
81 
82  unsigned int oo = 0;
83  unsigned int nsegs = output.size / INTERP_FACTOR;
84 
85  for (unsigned int n = 0; n < nsegs; n++){
86  unsigned char *symbol = in[n].data;
87 
88  for (int i = 0; i < ATSC_DATA_SEGMENT_LENGTH; i++){
89  out[oo++] = (oType) map[symbol[i] & 0x7];
90  }
91  }
92 
93  assert (oo == output.size);
94  return output.size;
95 }
96 
97 #endif /* _GRATSCSYMBOLMAPPER_H_ */
take atsc_data_segments and map them to symbols.
Definition: GrAtscSymbolMapper.h:41
static const int ATSC_DATA_SEGMENT_LENGTH
Definition: consts.h:33
unsigned char data[ATSC_DATA_SEGMENT_LENGTH]
Definition: gr-atsc/include/gnuradio/atsc/types.h:201
const char * name()
Definition: GrAtscSymbolMapper.h:50
GrAtscSymbolMapper()
Definition: GrAtscSymbolMapper.h:45
static const int INTERP_FACTOR
Definition: GrAtscSymbolMapper.h:56
PMT_API pmt_t map(pmt_t proc(const pmt_t &), pmt_t list)
Apply proc element-wise to the elements of list and returns a list of the results, in order.
int work(VrSampleRange output, void *ao[], VrSampleRange inputs[], void *ai[])
Definition: GrAtscSymbolMapper.h:62
contains 832 3 bit symbols. The low 3 bits in the byte hold the symbol.
Definition: gr-atsc/include/gnuradio/atsc/types.h:197
~GrAtscSymbolMapper()
Definition: GrAtscSymbolMapper.h:48