GNU Radio 3.3.0 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_sync_decimator.h>
00024 
00025 extern "C" {
00026 #include "../viterbi/viterbi.h"
00027 }
00028 
00029 class gr_decode_ccsds_27_fb;
00030 
00031 typedef boost::shared_ptr<gr_decode_ccsds_27_fb> gr_decode_ccsds_27_fb_sptr;
00032 
00033 gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb();
00034 
00035 /*! \brief A rate 1/2, k=7 convolutional decoder for the CCSDS standard
00036  * \ingroup ecc
00037  *  
00038  * This block performs soft-decision convolutional decoding using the Viterbi
00039  * algorithm.
00040  *  
00041  * The input is a stream of (possibly noise corrupted) floating point values 
00042  * nominally spanning [-1.0, 1.0], representing the encoded channel symbols 
00043  * 0 (-1.0) and 1 (1.0), with erased symbols at 0.0.
00044  *
00045  * The output is MSB first packed bytes of decoded values.
00046  *
00047  * As a rate 1/2 code, there will be one output byte for every 16 input symbols.
00048  *
00049  * This block is designed for continuous data streaming, not packetized data.
00050  * The first 32 bits out will be zeroes, with the output delayed four bytes
00051  * from the corresponding inputs.
00052  */
00053 
00054 class gr_decode_ccsds_27_fb : public gr_sync_decimator
00055 {
00056 private:
00057   friend gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb();
00058 
00059   gr_decode_ccsds_27_fb();
00060 
00061   // Viterbi state
00062   int d_mettab[2][256];
00063   struct viterbi_state d_state0[64];
00064   struct viterbi_state d_state1[64];
00065   unsigned char d_viterbi_in[16];
00066 
00067   int d_count;
00068       
00069 public:
00070   ~gr_decode_ccsds_27_fb();
00071 
00072   int work (int noutput_items,
00073             gr_vector_const_void_star &input_items,
00074             gr_vector_void_star &output_items);
00075 };
00076 
00077 #endif /* INCLUDED_GR_DECODE_CCSDS_27_FB_H */