3 * Copyright 2006 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
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)
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.
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.
23 #ifndef INCLUDED_GR_METRICS_DECODE_VITERBI_FULL_BLOCK_H
24 #define INCLUDED_GR_METRICS_DECODE_VITERBI_FULL_BLOCK_H
27 #include <libecc/decoder_viterbi_full_block_i1_ic1.h>
28 #include <libecc/encoder_convolutional_ic1_ic1.h>
30 class gr_metrics_decode_viterbi_full_block;
32 typedef boost::shared_ptr<gr_metrics_decode_viterbi_full_block>
33 gr_metrics_decode_viterbi_full_block_sptr,
34 gr_metrics_decode_viterbi_full_block_feedback_sptr;
36 gr_metrics_decode_viterbi_full_block_sptr
37 gr_make_metrics_decode_viterbi_full_block
41 std::vector<int> code_generator,
42 bool do_termination = true,
43 int start_memory_state = 0,
44 int end_memory_state = 0);
46 gr_metrics_decode_viterbi_full_block_feedback_sptr
47 gr_make_metrics_decode_viterbi_full_block_feedback
51 std::vector<int> code_generator,
52 std::vector<int> code_feedback,
53 bool do_termination = true,
54 int start_memory_state = 0,
55 int end_memory_state = 0);
58 * \brief Decode the incoming streams using a Viterbi-style decoder,
59 * full trellis block decoding.
61 * input: symbol metrics data.
63 * output: stream(s) of char, single bit stored in the LSB.
66 class gr_metrics_decode_viterbi_full_block : public gr_block
68 friend gr_metrics_decode_viterbi_full_block_sptr
69 gr_make_metrics_decode_viterbi_full_block
70 (int sample_precision,
74 const std::vector<int> &code_generator,
76 int start_memory_state,
77 int end_memory_state);
79 friend gr_metrics_decode_viterbi_full_block_feedback_sptr
80 gr_make_metrics_decode_viterbi_full_block_feedback
81 (int sample_precision,
85 const std::vector<int> &code_generator,
86 const std::vector<int> &code_feedback,
88 int start_memory_state,
89 int end_memory_state);
91 * frame_size_bits: if == 0, then do streaming decoding (infinite
92 * trellis); otherwise this is the block size to decode before
93 * terminating the trellis.
95 * code_generator: vector of integers (32 bit) representing the code
96 * to be implemented in octal form. E.g. "04" in binary is "100",
97 * which would be "D^2" for code generation. "06" == 110b == "D^2 + D"
98 * ==> The vector is listed in order for each input stream, so if there
99 * are 2 input streams (I1, I2) [specified in "n_code_inputs"]
100 * and 2 output streams (O1, O2) [specified in "n_code_outputs"],
101 * then the vector would be the code generator for:
102 * [I1->O1, I1->O2, I2->O1, I2->O2]
103 * with each element being the octal representation of the code.
105 * do_termination is valid only if frame_size_bits != 0, and defines
106 * whether or not to to trellis termination.
108 * do_mux_input: is true, then the one input stream will be
109 * interpreted as the multiplexing all of the input bits. For
110 * example for a 3 input decoder, the input stream would be
111 * [I1[k], I2[k], I3[k], I1[k+1], I2[k+1], ...], where "k" is the
112 * input sample time, and "I1" through "I3" are the 3 input
115 * n_code_inputs: the number of decoder-input (encoder-output)
116 * streams, no matter if separate or mux'ed
118 * n_code_outputs: the number of decoder-output (encoder-input) streams
121 gr_metrics_decode_viterbi_full_block
122 (int sample_precision,
126 const std::vector<int> &code_generator,
128 int start_memory_state,
129 int end_memory_state);
131 gr_metrics_decode_viterbi_full_block
132 (int sample_precision,
136 const std::vector<int> &code_generator,
137 const std::vector<int> &code_feedback,
139 int start_memory_state,
140 int end_memory_state);
143 ~gr_metrics_decode_viterbi_full_block ();
145 virtual void forecast (int noutput_items,
146 gr_vector_int &ninput_items_required);
148 virtual int general_work (int noutput_items,
149 gr_vector_int &ninput_items,
150 gr_vector_const_void_star &input_items,
151 gr_vector_void_star &output_items);
154 void setup_io_signatures (int sample_precision,
158 int d_n_code_inputs, d_n_code_outputs;
159 decoder_viterbi_full_block_i1_ic1* d_decoder;
160 encoder_convolutional_ic1_ic1* d_encoder;
163 #endif /* INCLUDED_GR_METRICS_DECODE_VITERBI_FULL_BLOCK_H */