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., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
23 #ifndef INCLUDED_ECC_METRICS_DECODE_VITERBI_FULL_BLOCK_H
24 #define INCLUDED_ECC_METRICS_DECODE_VITERBI_FULL_BLOCK_H
27 #include <libecc/decoder_viterbi_full_block.h>
28 #include <libecc/encoder_convolutional.h>
30 class ecc_metrics_decode_viterbi_full_block;
32 typedef boost::shared_ptr<ecc_metrics_decode_viterbi_full_block>
33 ecc_metrics_decode_viterbi_full_block_sptr,
34 ecc_metrics_decode_viterbi_full_block_feedback_sptr;
36 ecc_metrics_decode_viterbi_full_block_sptr
37 ecc_make_metrics_decode_viterbi_full_block
38 (int sample_precision,
42 const std::vector<int>& code_generator,
43 bool do_termination = true,
44 int start_memory_state = 0,
45 int end_memory_state = 0);
47 ecc_metrics_decode_viterbi_full_block_feedback_sptr
48 ecc_make_metrics_decode_viterbi_full_block_feedback
49 (int sample_precision,
53 const std::vector<int>& code_generator,
54 const std::vector<int>& code_feedback,
55 bool do_termination = true,
56 int start_memory_state = 0,
57 int end_memory_state = 0);
60 * \brief Decode the incoming streams using a Viterbi-style decoder,
61 * full trellis block decoding.
63 * input: symbol metrics data.
65 * output: stream(s) of char, single bit stored in the LSB.
68 class ecc_metrics_decode_viterbi_full_block : public gr_block
71 friend ecc_metrics_decode_viterbi_full_block_sptr
72 ecc_make_metrics_decode_viterbi_full_block
73 (int sample_precision,
77 const std::vector<int>& code_generator,
79 int start_memory_state,
80 int end_memory_state);
82 friend ecc_metrics_decode_viterbi_full_block_feedback_sptr
83 ecc_make_metrics_decode_viterbi_full_block_feedback
84 (int sample_precision,
88 const std::vector<int>& code_generator,
89 const std::vector<int>& code_feedback,
91 int start_memory_state,
92 int end_memory_state);
94 * frame_size_bits: if == 0, then do streaming decoding (infinite
95 * trellis); otherwise this is the block size to decode before
96 * terminating the trellis.
98 * code_generator: vector of integers (32 bit) representing the code
99 * to be implemented in octal form. E.g. "04" in binary is "100",
100 * which would be "D^2" for code generation. "06" == 110b == "D^2 + D"
101 * ==> The vector is listed in order for each input stream, so if there
102 * are 2 input streams (I1, I2) [specified in "n_code_inputs"]
103 * and 2 output streams (O1, O2) [specified in "n_code_outputs"],
104 * then the vector would be the code generator for:
105 * [I1->O1, I1->O2, I2->O1, I2->O2]
106 * with each element being the octal representation of the code.
108 * do_termination is valid only if frame_size_bits != 0, and defines
109 * whether or not to to trellis termination.
111 * do_mux_input: is true, then the one input stream will be
112 * interpreted as the multiplexing all of the input bits. For
113 * example for a 3 input decoder, the input stream would be
114 * [I1[k], I2[k], I3[k], I1[k+1], I2[k+1], ...], where "k" is the
115 * input sample time, and "I1" through "I3" are the 3 input
118 * n_code_inputs: the number of decoder-input (encoder-output)
119 * streams, no matter if separate or mux'ed
121 * n_code_outputs: the number of decoder-output (encoder-input) streams
124 ecc_metrics_decode_viterbi_full_block
125 (int sample_precision,
129 const std::vector<int>& code_generator,
131 int start_memory_state,
132 int end_memory_state);
134 ecc_metrics_decode_viterbi_full_block
135 (int sample_precision,
139 const std::vector<int>& code_generator,
140 const std::vector<int>& code_feedback,
142 int start_memory_state,
143 int end_memory_state);
145 void setup_io_signatures (int sample_precision,
149 int d_n_code_inputs, d_n_code_outputs;
150 decoder_viterbi_full_block* d_decoder;
151 encoder_convolutional* d_encoder;
152 code_input_ptr d_in_buf;
153 code_output_ptr d_out_buf;
156 ~ecc_metrics_decode_viterbi_full_block ();
158 virtual void forecast (int noutput_items,
159 gr_vector_int& ninput_items_required);
161 virtual int general_work (int noutput_items,
162 gr_vector_int& ninput_items,
163 gr_vector_const_void_star& input_items,
164 gr_vector_void_star& output_items);
167 #endif /* INCLUDED_ECC_METRICS_DECODE_VITERBI_FULL_BLOCK_H */