GNU Radio Manual and C++ API Reference  3.10.9.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 <memory>
18 
19 namespace gr {
20 namespace fec {
21 
22 /*!
23  * \brief General FEC decoding block that takes in a decoder
24  * variable object (derived from gr::fec::general_decoder) for use
25  * in a flowgraph.
26  *
27  * \ingroup error_coding_blk
28  *
29  * \details
30  * This block uses a decoder variable object (derived from
31  * gr::fec::generic_decoder) to decode data within a
32  * flowgraph. This block interacts with the general FECAPI
33  * architecture to handle all passing all input and output data in
34  * a flowgraph. The decoder variable takes care of understanding
35  * the requirements, data types and sizes, and boundary conditions
36  * of the specific FEC decoding algorithm.
37  *
38  * Generally, this block is used within the fec.extended_decoder
39  * Python block to handle some input/output formatting issues. In
40  * the FECAPI, the decoder variable sets properties like the input
41  * and output types and sizes and whether the output is packed or
42  * unpacked bytes. The fec.extended_decoder uses this information
43  * to set up an gr::hier_block2 structure to make sure the I/O to
44  * the variable is handled consistently, such as to make sure all
45  * inputs are floats with one soft symbol per item and the outputs
46  * are unpacked bytes with the bit in the LSB.
47  *
48  * See gr::fec::generic_decoder for detail on what information an
49  * FECAPI variable object can set if using this block directly and
50  * not as part of the fec.extended_decoder.
51  */
52 class FEC_API decoder : virtual public block
53 {
54 public:
55  typedef std::shared_ptr<decoder> sptr;
56 
57  /*!
58  * Create the FEC decoder block by taking in the FECAPI decoder
59  * object as well as input and output sizes.
60  *
61  * \param my_decoder An FECAPI decoder object (See gr::fec::generic_decoder).
62  * \param input_item_size The size of the input items (often the my_decoder object can
63  * tell us this). \param output_item_size The size of the output items (often the
64  * my_decoder object can tell us this).
65  */
66  static sptr make(generic_decoder::sptr my_decoder,
67  size_t input_item_size,
68  size_t output_item_size);
69 
70  int general_work(int noutput_items,
71  gr_vector_int& ninput_items,
72  gr_vector_const_void_star& input_items,
73  gr_vector_void_star& output_items) override = 0;
74  int fixed_rate_ninput_to_noutput(int ninput) override = 0;
75  int fixed_rate_noutput_to_ninput(int noutput) override = 0;
76  void forecast(int noutput_items, gr_vector_int& ninput_items_required) override = 0;
77 };
78 
79 } /* namespace fec */
80 } /* namespace gr */
81 
82 #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:53
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:55
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:62
#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