GNU Radio Manual and C++ API Reference 3.10.5.1
The Free & Open Software Radio Ecosystem
async_decoder.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 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_ASYNC_DECODER_H
12#define INCLUDED_FEC_ASYNC_DECODER_H
13
14#include <gnuradio/block.h>
15#include <gnuradio/fec/api.h>
17#include <memory>
18
19namespace gr {
20namespace fec {
21
22/*!
23 * \brief Creates the decoder block for use in GNU Radio
24 * flowgraphs from a given FEC API object derived from the
25 * generic_decoder class.
26 * \ingroup error_coding_blk
27 *
28 * \details
29 *
30 * Decodes frames received as async messages over a message
31 * port. This decoder deployment expects messages of soft decision
32 * symbols in and can produce either packed, PDU messages (\p
33 * packed = True) or messages full of unpacked bits (\p packed =
34 * False).
35 *
36 * This decoder works off a full message as one frame or block to
37 * decode. The message length is used to calculate the frame
38 * length. To support this, the decoder variable used will have
39 * had its frame_size set. This block treats that initial
40 * frame_size value as the maximum transmission unit (MTU) and
41 * will not process frames larger than that after being decoded.
42 *
43 * The packed PDU form of this deployment is designed to work well
44 * with other PDU-based blocks to operate within the processing
45 * flow of data packets or frames.
46 *
47 * Due to differences in how data is packed and processed, this
48 * block also offers the ability to change the direction of how
49 * bits are packed. All inputs messages are one soft decision per
50 * item. By default, the \p rev_pack mode is set to True. Using
51 * this setup allows the async block to behave with PDUs in the
52 * same operation and format as the tagged stream decoders. That
53 * is, putting the same data into both the tagged stream decoder
54 * deployment and this with the default setting should produce the
55 * same data.
56 *
57 * Because the block handles data as a full frame per message,
58 * this decoder deployment cannot work with any decoders that
59 * require history. For example, the gr::fec::code::cc_decoder
60 * decoder in streaming mode requires an extra rate*(K-1) bits to
61 * complete the decoding, so it would have to wait for the next
62 * message to come in and finish processing. Therefore, the
63 * streaming mode of the CC decoder is not allowed. The other
64 * three modes will work with this deployment since the frame is
65 * self-contained for decoding.
66 */
67class FEC_API async_decoder : virtual public block
68{
69public:
70 typedef std::shared_ptr<async_decoder> sptr;
71
72 /*!
73 * Build the PDU-based FEC decoder block from an FECAPI decoder object.
74 *
75 * \param my_decoder An FECAPI decoder object child of the generic_decoder class.
76 * \param packed Sets output to packed bytes if true; otherwise, 1 bit per byte.
77 * \param rev_pack If packing bits, should they be reversed?
78 * \param mtu The Maximum Transmission Unit (MTU) of the output
79 * frame that the block will be able to
80 * process. Specified in bytes and defaults to 1500.
81 */
82 static sptr make(generic_decoder::sptr my_decoder,
83 bool packed = false,
84 bool rev_pack = true,
85 int mtu = 1500);
86
87 int general_work(int noutput_items,
88 gr_vector_int& ninput_items,
89 gr_vector_const_void_star& input_items,
90 gr_vector_void_star& output_items) override = 0;
91};
92
93} /* namespace fec */
94} /* namespace gr */
95
96#endif /* INCLUDED_FEC_ASYNC_DECODER_H */
The abstract base class for all 'terminal' processing blocks.
Definition: gnuradio-runtime/include/gnuradio/block.h:63
Creates the decoder block for use in GNU Radio flowgraphs from a given FEC API object derived from th...
Definition: async_decoder.h:68
std::shared_ptr< async_decoder > sptr
Definition: async_decoder.h:70
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
static sptr make(generic_decoder::sptr my_decoder, bool packed=false, bool rev_pack=true, int mtu=1500)
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