Merge commit 'v3.3.0' into upstream
[debian/gnuradio] / gr-atsc / src / lib / atsci_trellis_encoder.h
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_TRELLIS_ENCODER_H_
24 #define _ATSC_TRELLIS_ENCODER_H_
25
26 #include <atsci_basic_trellis_encoder.h>
27 #include <atsc_types.h>
28
29 /*!
30  * \brief fancy, schmancy 12-way interleaved trellis encoder for ATSC
31  */
32
33 class atsci_trellis_encoder {
34  public:
35   static const int      NCODERS = 12;
36
37   atsci_trellis_encoder ();
38   ~atsci_trellis_encoder ();
39
40   //! reset all encoder states
41   void reset ();
42
43   /*!
44    * Take 12 RS encoded, convolutionally interleaved segments and
45    * produce 12 trellis coded data segments.  We work in groups of 12
46    * because that's the smallest number of segments that composes a
47    * single full cycle of the encoder mux.
48    */
49   void encode (atsc_data_segment out[NCODERS],
50                const atsc_mpeg_packet_rs_encoded in[NCODERS]);
51
52   
53  protected:
54   static const int SEGMENT_SIZE = ATSC_MPEG_RS_ENCODED_LENGTH;  // 207
55   static const int INPUT_SIZE = (SEGMENT_SIZE * 12);
56   static const int OUTPUT_SIZE = (ATSC_DATA_SEGMENT_LENGTH * 12);
57   
58   void encode_helper (unsigned char out[OUTPUT_SIZE],
59                       const unsigned char in[INPUT_SIZE]);
60
61   atsci_basic_trellis_encoder   enc[NCODERS];
62   bool                          debug;
63 };
64
65
66 #endif /* _ATSC_TRELLIS_ENCODER_H_ */