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