GNU Radio 3.5.3.2 C++ API
gr_decode_ccsds_27_fb.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2008 Free Software Foundation, Inc.
00004  * 
00005  * GNU Radio is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 3, or (at your option)
00008  * any later version.
00009  * 
00010  * GNU Radio is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU General Public License
00016  * along with GNU Radio; see the file COPYING.  If not, write to
00017  * the Free Software Foundation, Inc., 51 Franklin Street,
00018  * Boston, MA 02110-1301, USA.
00019  */
00020 #ifndef INCLUDED_GR_DECODE_CCSDS_27_FB_H
00021 #define INCLUDED_GR_DECODE_CCSDS_27_FB_H
00022 
00023 #include <gr_core_api.h>
00024 #include <gr_sync_decimator.h>
00025 
00026 extern "C" {
00027 #include <viterbi.h>
00028 }
00029 
00030 class gr_decode_ccsds_27_fb;
00031 
00032 typedef boost::shared_ptr<gr_decode_ccsds_27_fb> gr_decode_ccsds_27_fb_sptr;
00033 
00034 GR_CORE_API gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb();
00035 
00036 /*! \brief A rate 1/2, k=7 convolutional decoder for the CCSDS standard
00037  * \ingroup ecc
00038  *  
00039  * This block performs soft-decision convolutional decoding using the Viterbi
00040  * algorithm.
00041  *  
00042  * The input is a stream of (possibly noise corrupted) floating point values 
00043  * nominally spanning [-1.0, 1.0], representing the encoded channel symbols 
00044  * 0 (-1.0) and 1 (1.0), with erased symbols at 0.0.
00045  *
00046  * The output is MSB first packed bytes of decoded values.
00047  *
00048  * As a rate 1/2 code, there will be one output byte for every 16 input symbols.
00049  *
00050  * This block is designed for continuous data streaming, not packetized data.
00051  * The first 32 bits out will be zeroes, with the output delayed four bytes
00052  * from the corresponding inputs.
00053  */
00054 
00055 class GR_CORE_API gr_decode_ccsds_27_fb : public gr_sync_decimator
00056 {
00057 private:
00058   friend GR_CORE_API gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb();
00059 
00060   gr_decode_ccsds_27_fb();
00061 
00062   // Viterbi state
00063   int d_mettab[2][256];
00064   struct viterbi_state d_state0[64];
00065   struct viterbi_state d_state1[64];
00066   unsigned char d_viterbi_in[16];
00067 
00068   int d_count;
00069       
00070 public:
00071   ~gr_decode_ccsds_27_fb();
00072 
00073   int work (int noutput_items,
00074             gr_vector_const_void_star &input_items,
00075             gr_vector_void_star &output_items);
00076 };
00077 
00078 #endif /* INCLUDED_GR_DECODE_CCSDS_27_FB_H */