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 3, 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., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
23 #ifndef _GRATSCSYMBOLMAPPER_H_
24 #define _GRATSCSYMBOLMAPPER_H_
27 #include <VrInterpolatingSigProcNoWork.h>
28 #include <atsc_types.h>
32 * \brief take atsc_data_segments and map them to symbols.
34 * Input is a stream of atsc_data_segments.
35 * Output is a stream of symbols at 1x the symbol rate
37 * This module performs the signal mapping & pilot addition.
41 class GrAtscSymbolMapper
42 : public VrInterpolatingSigProcNoWork<atsc_data_segment, oType> {
46 : VrInterpolatingSigProcNoWork<atsc_data_segment, oType>(1, INTERP_FACTOR) {};
48 ~GrAtscSymbolMapper () {};
50 const char *name () { return "GrAtscSymbolMapper"; }
52 int work (VrSampleRange output, void *ao[],
53 VrSampleRange inputs[], void *ai[]);
56 static const int INTERP_FACTOR = ATSC_DATA_SEGMENT_LENGTH;
62 GrAtscSymbolMapper<oType>::work (VrSampleRange output, void *ao[],
63 VrSampleRange inputs[], void *ai[])
65 atsc_data_segment *in = ((atsc_data_segment **) ai)[0];
66 oType *out = ((oType **) ao)[0];
68 assert ((output.size % INTERP_FACTOR) == 0);
70 static const float pilot_add = 1.25;
71 static const float map[8] = {
83 unsigned int nsegs = output.size / INTERP_FACTOR;
85 for (unsigned int n = 0; n < nsegs; n++){
86 unsigned char *symbol = in[n].data;
88 for (int i = 0; i < ATSC_DATA_SEGMENT_LENGTH; i++){
89 out[oo++] = (oType) map[symbol[i] & 0x7];
93 assert (oo == output.size);
97 #endif /* _GRATSCSYMBOLMAPPER_H_ */