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