GNU Radio 3.4.2 C++ API
atsci_trellis_encoder.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2002 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
00021  */
00022 
00023 #ifndef _ATSC_TRELLIS_ENCODER_H_
00024 #define _ATSC_TRELLIS_ENCODER_H_
00025 
00026 #include <atsci_basic_trellis_encoder.h>
00027 #include <atsc_types.h>
00028 
00029 /*!
00030  * \brief fancy, schmancy 12-way interleaved trellis encoder for ATSC
00031  */
00032 
00033 class atsci_trellis_encoder {
00034  public:
00035   static const int      NCODERS = 12;
00036 
00037   atsci_trellis_encoder ();
00038   ~atsci_trellis_encoder ();
00039 
00040   //! reset all encoder states
00041   void reset ();
00042 
00043   /*!
00044    * Take 12 RS encoded, convolutionally interleaved segments and
00045    * produce 12 trellis coded data segments.  We work in groups of 12
00046    * because that's the smallest number of segments that composes a
00047    * single full cycle of the encoder mux.
00048    */
00049   void encode (atsc_data_segment out[NCODERS],
00050                const atsc_mpeg_packet_rs_encoded in[NCODERS]);
00051 
00052   
00053  protected:
00054   static const int SEGMENT_SIZE = ATSC_MPEG_RS_ENCODED_LENGTH;  // 207
00055   static const int INPUT_SIZE = (SEGMENT_SIZE * 12);
00056   static const int OUTPUT_SIZE = (ATSC_DATA_SEGMENT_LENGTH * 12);
00057   
00058   void encode_helper (unsigned char out[OUTPUT_SIZE],
00059                       const unsigned char in[INPUT_SIZE]);
00060 
00061   atsci_basic_trellis_encoder   enc[NCODERS];
00062   bool                          debug;
00063 };
00064 
00065 
00066 #endif /* _ATSC_TRELLIS_ENCODER_H_ */