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