Imported Upstream version 3.2.2
[debian/gnuradio] / gnuradio-core / src / lib / general / gr_decode_ccsds_27_fb.h
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008 Free Software Foundation, Inc.
4  * 
5  * GNU Radio is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3, or (at your option)
8  * any later version.
9  * 
10  * GNU Radio is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * along with GNU Radio; see the file COPYING.  If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street,
18  * Boston, MA 02110-1301, USA.
19  */
20 #ifndef INCLUDED_GR_DECODE_CCSDS_27_FB_H
21 #define INCLUDED_GR_DECODE_CCSDS_27_FB_H
22
23 #include <gr_sync_decimator.h>
24
25 extern "C" {
26 #include "../viterbi/viterbi.h"
27 }
28
29 class gr_decode_ccsds_27_fb;
30
31 typedef boost::shared_ptr<gr_decode_ccsds_27_fb> gr_decode_ccsds_27_fb_sptr;
32
33 gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb();
34
35 /*! \brief A rate 1/2, k=7 convolutional decoder for the CCSDS standard
36  * \ingroup ecc
37  *  
38  * This block performs soft-decision convolutional decoding using the Viterbi
39  * algorithm.
40  *  
41  * The input is a stream of (possibly noise corrupted) floating point values 
42  * nominally spanning [-1.0, 1.0], representing the encoded channel symbols 
43  * 0 (-1.0) and 1 (1.0), with erased symbols at 0.0.
44  *
45  * The output is MSB first packed bytes of decoded values.
46  *
47  * As a rate 1/2 code, there will be one output byte for every 16 input symbols.
48  *
49  * This block is designed for continuous data streaming, not packetized data.
50  * The first 32 bits out will be zeroes, with the output delayed four bytes
51  * from the corresponding inputs.
52  */
53
54 class gr_decode_ccsds_27_fb : public gr_sync_decimator
55 {
56 private:
57   friend gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb();
58
59   gr_decode_ccsds_27_fb();
60
61   // Viterbi state
62   int d_mettab[2][256];
63   struct viterbi_state d_state0[64];
64   struct viterbi_state d_state1[64];
65   unsigned char d_viterbi_in[16];
66
67   int d_count;
68       
69 public:
70   ~gr_decode_ccsds_27_fb();
71
72   int work (int noutput_items,
73             gr_vector_const_void_star &input_items,
74             gr_vector_void_star &output_items);
75 };
76
77 #endif /* INCLUDED_GR_DECODE_CCSDS_27_FB_H */