GNU Radio C++ API Reference: cc_decoder.h Source File

| GNU Radio C++ API Reference 3.10.12.0 The Free & Open Software Radio Ecosystem |

Loading...
Searching...
No Matches
cc_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_CC_DECODER_H
12#define INCLUDED_FEC_CC_DECODER_H
13
14#include <gnuradio/fec/api.h>
15#include <gnuradio/fec/cc_common.h>
16#include <gnuradio/fec/generic_decoder.h>
17#include <map>
18#include <string>
19
20namespace gr {
21namespace fec {
22 namespace code {
23
24 typedef void (*conv_kernel)(unsigned char* Y,
25 unsigned char* X,
26 unsigned char* syms,
27 unsigned char* dec,
28 unsigned int framebits,
29 unsigned int excess,
30 unsigned char* Branchtab);
31
32/*!
33 * \brief Convolutional Code Decoding class.
34 * \ingroup error_coding_blk
35 *
36 * \details
37 * This class performs convolutional decoding via the Viterbi
38 * algorithm. While it is set up to take variable values for K,
39 * rate, and the polynomials, currently, the block is only
40 * capable of handling the following settings:
41 *
42 * \li K = 7
43 * \li rate = 1/2 (given as 2 to the constructor)
44 * \li polynomials = [109, 79]
45 *
46 * This is the well-known convolutional part of the Voyager code
47 * implemented in the CCSDS encoder.
48 *
49 * The intent of having this FECAPI code classes fully
50 * parameterizable is to eventually allow it to take on generic
51 * settings, much like the cc_encoder class where the CCSDS
52 * settings would be a highly-optimized version of this.
53 *
54 * The decoder is set up with a number of bits per frame in the
55 * constructor. When not being used in a tagged stream mode,
56 * this encoder will only process frames of the length provided
57 * here. If used in a tagged stream block, this setting becomes
58 * the maximum allowable frame size that the block may process.
59 *
60 * The \p mode is a cc_mode_t that specifies how the convolutional
61 * encoder will behave and under what conditions.
62 *
63 * \li 'CC_STREAMING': mode expects an uninterrupted flow of
64 * samples into the encoder, and the output stream is
65 * continually encoded. This mode is the only mode for this
66 * decoder that has a history requirement because it requires
67 * rate*(K-1) bits more to finish the decoding properly. This
68 * mode does not work with any deployments that do not allow
69 * history.
70 *
71 * \li 'CC_TERMINATED': is a mode designed for packet-based
72 * systems. This mode adds rate*(k-1) bits to the output as a
73 * way to help flush the decoder.
74 *
75 * \li 'CC_TAILBITING': is another packet-based method. Instead of
76 * adding bits onto the end of the packet, this mode will
77 * continue the code between the payloads of packets by
78 * pre-initializing the state of the new packet based on the
79 * state of the last packet for (k-1) bits.
80 *
81 * \li 'CC_TRUNCATED': a truncated code always resets the registers
82 * to the \p start_state between frames.
83 *
84 * A common convolutional encoder uses K=7, Rate=1/2,
85 * Polynomials=[109, 79]. This is the Voyager code from NASA:
86 * \li 109: b(1101101) --> 1 + x + x^3 + x^4 + x^6
87 * \li 79: b(1001111) --> 1 + x^3 + x^4 + x^5 + x^6
88 */
89 class FEC_API cc_decoder : virtual public generic_decoder
90{
91public:
92 /*!
93 * Build a convolutional code decoding FEC API object.
94 *
95 * \param frame_size Number of bits per frame. If using in the
96 * tagged stream style, this is the maximum allowable
97 * number of bits per frame.
98 * \param k Constraint length (K) of the encoder.
99 * \param rate Inverse of the coder's rate
100 * (rate=2 means 2 output bits per 1 input).
101 * \param polys Vector of polynomials as integers.
102 * \param start_state Initialization state of the shift register.
103 * \param end_state Ending state of the shift register.
104 * \param mode cc_mode_t mode of the encoding.
105 * \param padded true if the encoded frame is padded
106 * to the nearest byte.
107 */
108 static generic_decoder::sptr make(int frame_size,
109 int k,
110 int rate,
111 std::vector<int> polys,
112 int start_state = 0,
113 int end_state = -1,
114 cc_mode_t mode = CC_STREAMING,
115 bool padded = false);
116
117 /*!
118 * Sets the uncoded frame size to \p frame_size. If \p
119 * frame_size is greater than the value given to the
120 * constructor, the frame size will be capped by that initial
121 * value and this function will return false. Otherwise, it
122 * returns true.
123 */
124 bool set_frame_size(unsigned int frame_size) override = 0;
125
126 /*!
127 * Returns the coding rate of this encoder.
128 */
129 double rate() override = 0;
130};
131
132} /* namespace code */
133} /* namespace fec */
134} /* namespace gr */
135
136#endif /* INCLUDED_FEC_CC_DECODER_H */
cc_common.h
cc_mode_t
enum _cc_mode_t cc_mode_t
CC_STREAMING
@ CC_STREAMING
Definition cc_common.h:17
gr::fec::code::cc_decoder
Convolutional Code Decoding class.
Definition cc_decoder.h:90
gr::fec::code::cc_decoder::make
static generic_decoder::sptr make(int frame_size, int k, int rate, std::vector< int > polys, int start_state=0, int end_state=-1, cc_mode_t mode=CC_STREAMING, bool padded=false)
gr::fec::code::cc_decoder::set_frame_size
bool set_frame_size(unsigned int frame_size) override=0
gr::fec::code::cc_decoder::rate
double rate() override=0
gr::fec::generic_decoder::generic_decoder
generic_decoder(void)
Definition generic_decoder.h:64
gr::fec::generic_decoder::sptr
std::shared_ptr< generic_decoder > sptr
Definition generic_decoder.h:62
generic_decoder.h
api.h
FEC_API
#define FEC_API
Definition gr-fec/include/gnuradio/fec/api.h:18
gr::fec::code
Definition cc_decoder.h:22
gr::fec::code::conv_kernel
void(*) conv_kernel(unsigned char *Y, unsigned char *X, unsigned char *syms, unsigned char *dec, unsigned int framebits, unsigned int excess, unsigned char *Branchtab)
Definition cc_decoder.h:24
gr::fec
Definition async_decoder.h:20
gr
GNU Radio logging wrapper.
Definition basic_block.h:29