GNU Radio 3.5.1 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 <atsc_api.h>
00027 #include <atsci_basic_trellis_encoder.h>
00028 #include <atsc_types.h>
00029 
00030 /*!
00031  * \brief fancy, schmancy 12-way interleaved trellis encoder for ATSC
00032  */
00033 
00034 class ATSC_API atsci_trellis_encoder {
00035  public:
00036   static const int      NCODERS = 12;
00037 
00038   atsci_trellis_encoder ();
00039   ~atsci_trellis_encoder ();
00040 
00041   //! reset all encoder states
00042   void reset ();
00043 
00044   /*!
00045    * Take 12 RS encoded, convolutionally interleaved segments and
00046    * produce 12 trellis coded data segments.  We work in groups of 12
00047    * because that's the smallest number of segments that composes a
00048    * single full cycle of the encoder mux.
00049    */
00050   void encode (atsc_data_segment out[NCODERS],
00051                const atsc_mpeg_packet_rs_encoded in[NCODERS]);
00052 
00053   
00054  protected:
00055   static const int SEGMENT_SIZE = ATSC_MPEG_RS_ENCODED_LENGTH;  // 207
00056   static const int INPUT_SIZE = (SEGMENT_SIZE * 12);
00057   static const int OUTPUT_SIZE = (ATSC_DATA_SEGMENT_LENGTH * 12);
00058   
00059   void encode_helper (unsigned char out[OUTPUT_SIZE],
00060                       const unsigned char in[INPUT_SIZE]);
00061 
00062   atsci_basic_trellis_encoder   enc[NCODERS];
00063   bool                          debug;
00064 };
00065 
00066 
00067 #endif /* _ATSC_TRELLIS_ENCODER_H_ */