GNU Radio Manual and C++ API Reference 3.8.5.0
The Free & Open Software Radio Ecosystem
 
Loading...
Searching...
No Matches
decoder.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2013-2014 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 3, 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., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
21 */
22
23#ifndef INCLUDED_FEC_DECODER_H
24#define INCLUDED_FEC_DECODER_H
25
26#include <gnuradio/block.h>
27#include <gnuradio/fec/api.h>
29#include <boost/format.hpp>
30#include <boost/shared_array.hpp>
31#include <boost/shared_ptr.hpp>
32
33namespace gr {
34namespace fec {
35
36/*!
37 * \brief General FEC decoding block that takes in a decoder
38 * variable object (derived from gr::fec::general_decoder) for use
39 * in a flowgraph.
40 *
41 * \ingroup error_coding_blk
42 *
43 * \details
44 * This block uses a decoder variable object (derived from
45 * gr::fec::generic_decoder) to decode data within a
46 * flowgraph. This block interacts with the general FECAPI
47 * architecture to handle all passing all input and output data in
48 * a flowgraph. The decoder variable takes care of understanding
49 * the requirements, data types and sizes, and boundary conditions
50 * of the specific FEC decoding algorithm.
51 *
52 * Generally, this block is used within the fec.extended_decoder
53 * Python block to handle some input/output formatting issues. In
54 * the FECAPI, the decoder variable sets properties like the input
55 * and output types and sizes and whether the output is packed or
56 * unpacked bytes. The fec.extended_decoder uses this information
57 * to set up an gr::hier_block2 structure to make sure the I/O to
58 * the variable is handled consistently, such as to make sure all
59 * inputs are floats with one soft symbol per item and the outputs
60 * are unpacked bytes with the bit in the LSB.
61 *
62 * See gr::fec::generic_decoder for detail on what information an
63 * FECAPI variable object can set if using this block directly and
64 * not as part of the fec.extended_decoder.
65 */
66class FEC_API decoder : virtual public block
67{
68public:
69 typedef boost::shared_ptr<decoder> sptr;
70 typedef boost::shared_array<unsigned char> buf_sptr;
71
72 /*!
73 * Create the FEC decoder block by taking in the FECAPI decoder
74 * object as well as input and output sizes.
75 *
76 * \param my_decoder An FECAPI decoder object (See gr::fec::generic_decoder).
77 * \param input_item_size The size of the input items (often the my_decoder object can
78 * tell us this). \param output_item_size The size of the output items (often the
79 * my_decoder object can tell us this).
80 */
81 static sptr make(generic_decoder::sptr my_decoder,
82 size_t input_item_size,
83 size_t output_item_size);
84
85 virtual int general_work(int noutput_items,
86 gr_vector_int& ninput_items,
87 gr_vector_const_void_star& input_items,
88 gr_vector_void_star& output_items) = 0;
89 virtual int fixed_rate_ninput_to_noutput(int ninput) = 0;
90 virtual int fixed_rate_noutput_to_ninput(int noutput) = 0;
91 virtual void forecast(int noutput_items, gr_vector_int& ninput_items_required) = 0;
92};
93
94} /* namespace fec */
95} /* namespace gr */
96
97#endif /* INCLUDED_FEC_DECODER_H */
The abstract base class for all 'terminal' processing blocks.
Definition block.h:72
General FEC decoding block that takes in a decoder variable object (derived from gr::fec::general_dec...
Definition decoder.h:67
virtual void forecast(int noutput_items, gr_vector_int &ninput_items_required)=0
Estimate input requirements given output request.
virtual int fixed_rate_noutput_to_ninput(int noutput)=0
Given noutput samples, return number of input samples required to produce noutput....
static sptr make(generic_decoder::sptr my_decoder, size_t input_item_size, size_t output_item_size)
virtual int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)=0
compute output items from input items
virtual int fixed_rate_ninput_to_noutput(int ninput)=0
Given ninput samples, return number of output samples that will be produced. N.B. this is only define...
boost::shared_ptr< decoder > sptr
Definition decoder.h:69
boost::shared_ptr< generic_decoder > sptr
Definition generic_decoder.h:75
#define FEC_API
Definition gr-fec/include/gnuradio/fec/api.h:30
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition basic_block.h:46
std::vector< const void * > gr_vector_const_void_star
Definition types.h:40
std::vector< void * > gr_vector_void_star
Definition types.h:39
std::vector< int > gr_vector_int
Definition types.h:35