GNU Radio 3.6.2 C++ API
atsci_basic_trellis_encoder.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 #ifndef _ATSC_BASIC_TRELLIS_ENCODER_H_
23 #define _ATSC_BASIC_TRELLIS_ENCODER_H_
24 
25 #include <atsc_api.h>
26 #include <assert.h>
27 
28 /*!
29  * \brief ATSC trellis encoder building block.
30  *
31  * Note this is NOT the 12x interleaved interface.
32  *
33  * This implements a single instance of the ATSC trellis encoder.
34  * This is a rate 2/3 encoder (really a constraint length 3, rate 1/2
35  * encoder with the top bit passed through unencoded. This does not
36  * implement the "precoding" of the top bit, because the NTSC rejection
37  * filter is not supported.
38  */
39 
41 
42 private:
43  int state; // two bit state;
44 
45 public:
46  atsci_basic_trellis_encoder () : state (0) {}
47 
48  /*!
49  * Encode two bit INPUT into 3 bit return value. Domain is [0,3],
50  * Range is [0,7]. The mapping to bipolar levels is not done.
51  */
52  int encode (unsigned int input);
53 
54  //! reset encoder state
55  void reset () { state = 0; }
56 
57  static const unsigned char next_state[32];
58  static const unsigned char out_symbol[32];
59 };
60 
61 #endif /* _ATSC_BASIC_TRELLIS_ENCODER_H_ */