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_SYMS_TO_METRICS_H
24 #define INCLUDED_SYMS_TO_METRICS_H
29 #include <libecc/code_metrics.h>
31 class ecc_syms_to_metrics;
32 typedef boost::shared_ptr<ecc_syms_to_metrics> ecc_syms_to_metrics_sptr;
34 ecc_syms_to_metrics_sptr ecc_make_syms_to_metrics
35 (gr_feval_ff* pdf_fcn_0_bit,
36 gr_feval_ff* pdf_fcn_1_bit,
40 int sample_precision);
43 * \brief Convert the input stream(s) of soft (float) symbols to
44 * log-probability metrics of user-specified precision; output is 2
45 * streams per input stream, each stream consisting of the metric for
46 * receiving a 0-bit and 1-bit, respectively, with the lower-numbered
47 * stream being the 0-bit.
49 * input: stream(s) of float; output: stream(s) of metrics
52 class ecc_syms_to_metrics : public gr_block
55 friend ecc_syms_to_metrics_sptr
56 ecc_make_syms_to_metrics (gr_feval_ff* pdf_fcn_0_bit,
57 gr_feval_ff* pdf_fcn_1_bit,
61 int sample_precision);
64 * ecc_syms_to_metrics: Convert the input soft (float) symbols into
65 * log-probabilities (metrics) for use in the convolutional
66 * decoder. Samples the provided PDF function in 'n_samples'
67 * places from 'min_sample' to 'max_sample', takes the log of that
68 * value, then converts the result into a given precision and
69 * stores all results in a "handy dandy" lookup table for much
72 * pdf_fcn_0_bit: point to a probability distribution function which
73 * takes a float and returns a float, for the 0-bit probabilities.
75 * pdf_fcn_1_bit: point to a probability distribution function which
76 * takes a float and returns a float, for the 1-bit probabilities.
78 * n_samples: the number of samples between min_sample and max_sample
79 * to store in the lookup table. Must be at least 2, but
80 * otherwise is limited only by the amount of available memory;
81 * generally, 65536 (1 << 16) is plenty of samples.
83 * min_sample: the minimum value below which any incoming value is
86 * max_sample: the maximum value above which any incoming value is
89 * sample_precision: the precision with which to sample the returned
90 * value of the PDF function.
91 * + Cannot be < 0 or > 32.
93 * + otherwise, convert to an integer of the given value
95 * in "work", finds the (linearly) closest sample value for the given
96 * input and outputs the metric for a 0-bit input on the first
97 * stream and a 1-bit input on the second stream.
101 ecc_syms_to_metrics (gr_feval_ff* pdf_fcn_0_bit,
102 gr_feval_ff* pdf_fcn_1_bit,
106 int sample_precision);
108 size_t d_out_item_size_bytes;
109 code_metrics_table<float>* d_code_metrics_table;
112 ~ecc_syms_to_metrics() {delete d_code_metrics_table;};
114 bool check_topology (int ninputs, int noutputs);
116 void forecast (int noutput_items, gr_vector_int &ninput_items_required);
118 int general_work (int noutput_items,
119 gr_vector_int &ninput_items,
120 gr_vector_const_void_star &input_items,
121 gr_vector_void_star &output_items);
124 #endif /* INCLUDED_SYMS_TO_METRICS_H */