GNU Radio 3.4.2 C++ API
atsci_viterbi_decoder.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_VITERBI_DECODER_H_
00024 #define _ATSC_VITERBI_DECODER_H_
00025 
00026 #define USE_SIMPLE_SLICER  0
00027 
00028 #include <atsc_types.h>
00029 #include <interleaver_fifo.h>
00030 
00031 #if (USE_SIMPLE_SLICER)
00032 #include <atsci_fake_single_viterbi.h>
00033 typedef atsci_fake_single_viterbi       single_viterbi_t;
00034 #else
00035 #include <atsci_single_viterbi.h>
00036 typedef atsci_single_viterbi            single_viterbi_t;
00037 #endif
00038 
00039 /*!
00040  * \brief fancy, schmancy 12-way interleaved viterbi decoder for ATSC
00041  */
00042 
00043 class atsci_viterbi_decoder {
00044 public:
00045   static const int      NCODERS = 12;
00046 
00047   atsci_viterbi_decoder ();
00048   ~atsci_viterbi_decoder ();
00049 
00050   //! reset all decoder states
00051   void reset ();
00052 
00053   /*!
00054    * Take 12 data segments of soft decisions (floats) and
00055    * produce 12 RS encoded data segments.  We work in groups of 12
00056    * because that's the smallest number of segments that composes a
00057    * single full cycle of the decoder mux.
00058    */
00059   void decode (atsc_mpeg_packet_rs_encoded out[NCODERS],
00060                const atsc_soft_data_segment in[NCODERS]);
00061 
00062 
00063   
00064  protected:
00065   typedef interleaver_fifo<unsigned char>       fifo_t;
00066 
00067   static const int SEGMENT_SIZE = ATSC_MPEG_RS_ENCODED_LENGTH;  // 207
00068   static const int OUTPUT_SIZE = (SEGMENT_SIZE * 12);
00069   static const int INPUT_SIZE = (ATSC_DATA_SEGMENT_LENGTH * 12);
00070   
00071   void decode_helper (unsigned char out[OUTPUT_SIZE],
00072                       const float in[INPUT_SIZE]);
00073 
00074   
00075   single_viterbi_t      viterbi[NCODERS];
00076   fifo_t                *fifo[NCODERS]; 
00077   bool                  debug;
00078 
00079 };
00080 
00081 
00082 
00083 #endif /* _ATSC_VITERBI_DECODER_H_ */