Houston, we have a trunk.
[debian/gnuradio] / gr-error-correcting-codes / src / lib / libecc / decoder_viterbi_full_block.h
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2006 Free Software Foundation, Inc.
4  * 
5  * This file is part of GNU Radio
6  * 
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  * 
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING.  If not, write to
19  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23 #ifndef INCLUDED_DECODER_VITERBI_FULL_BLOCK_H
24 #define INCLUDED_DECODER_VITERBI_FULL_BLOCK_H
25
26 #include "decoder_viterbi.h"
27
28 class decoder_viterbi_full_block : public decoder_viterbi
29 {
30 /*!
31  * \brief Decode the incoming streams using a Viterbi-style decoder,
32  *     doing full trellis block decoding before putting out
33  *     any bits
34  *
35  * input: streams of metrics, two per code output: one for the 0-bit
36  *     metrics and the other for the 1-bit metric.
37  *
38  * output: stream(s) of output bits
39  */
40
41 public:
42   decoder_viterbi_full_block (int sample_precision,
43                               encoder_convolutional* l_encoder);
44
45   virtual ~decoder_viterbi_full_block ();
46
47 protected:
48   virtual void decode_private (const char** in_buf, char** out_buf);
49   virtual void update_traceback__up (size_t from_state_ndx,
50                                      size_t to_state_ndx,
51                                      size_t l_input);
52   virtual void update_traceback__middle ();
53   virtual void update_traceback__term ();
54
55 /*
56  * traceback_t: used to store all encode-input bits for
57  *     all possible paths, when computing all trellis bits before
58  *     determining the ML decode-output sequence.
59  *
60  * d_prev: the connection to the previous bit's traceback structure
61  *
62  * d_inputs: the inputs (one per bit) for this connection
63  */
64
65   typedef struct traceback_t {
66     struct traceback_t *d_prev;
67     int d_inputs;
68   } traceback_t, *traceback_t_ptr, **traceback_t_hdl;
69
70 /*
71  * d_n_total_inputs_per_stream: how many bits to store for each
72  *     state to determine the best decoder-output (encoder-input) bits 
73  */
74   size_t d_n_inputs_per_stream;
75   traceback_t_hdl d_out_buf;
76 };
77
78 #endif /* INCLUDED_DECODER_VITERBI_FULL_BLOCK_H */