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_SYMS_TO_METRICS_H
24 #define INCLUDED_SYMS_TO_METRICS_H
29 #include <libecc/code_metrics.h>
31 class gr_syms_to_metrics;
32 typedef boost::shared_ptr<gr_syms_to_metrics> gr_syms_to_metrics_sptr;
34 gr_syms_to_metrics_sptr gr_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 gr_syms_to_metrics : public gr_block
54 friend gr_syms_to_metrics_sptr
55 gr_make_syms_to_metrics (gr_feval_ff* pdf_fcn_0_bit,
56 gr_feval_ff* pdf_fcn_1_bit,
60 int sample_precision);
63 * gr_syms_to_metrics: Convert the input soft (float) symbols into
64 * log-probabilities (metrics) for use in the convolutional
65 * decoder. Samples the provided PDF function in 'n_samples'
66 * places from 'min_sample' to 'max_sample', takes the log of that
67 * value, then converts the result into a given precision and
68 * stores all results in a "handy dandy" lookup table for much
71 * pdf_fcn_0_bit: point to a probability distribution function which
72 * takes a float and returns a float, for the 0-bit probabilities.
74 * pdf_fcn_1_bit: point to a probability distribution function which
75 * takes a float and returns a float, for the 1-bit probabilities.
77 * n_samples: the number of samples between min_sample and max_sample
78 * to store in the lookup table. Must be at least 2, but
79 * otherwise is limited only by the amount of available memory;
80 * generally, 65536 (1 << 16) is plenty of samples.
82 * min_sample: the minimum value below which any incoming value is
85 * max_sample: the maximum value above which any incoming value is
88 * sample_precision: the precision with which to sample the returned
89 * value of the PDF function.
90 * + Cannot be < 0 or > 32.
92 * + otherwise, convert to an integer of the given value
94 * in "work", finds the (linearly) closest sample value for the given
95 * input and outputs the metric for a 0-bit input on the first
96 * stream and a 1-bit input on the second stream.
100 gr_syms_to_metrics (gr_feval_ff* pdf_fcn_0_bit,
101 gr_feval_ff* pdf_fcn_1_bit,
105 int sample_precision);
107 size_t d_out_item_size_bytes;
108 code_metrics* d_code_metrics;
111 bool check_topology (int ninputs, int noutputs);
113 void forecast (int noutput_items, gr_vector_int &ninput_items_required);
115 int general_work (int noutput_items,
116 gr_vector_int &ninput_items,
117 gr_vector_const_void_star &input_items,
118 gr_vector_void_star &output_items);
121 #endif /* INCLUDED_SYMS_TO_METRICS_H */