GNSS-SDR  0.0.13
An Open Source GNSS Software Defined Receiver
fec.h
Go to the documentation of this file.
1 /*!
2  * \file fec.h
3  * \brief Utilities for the convolutional encoder of the libswiftnav library
4  * \author Phil Karn, KA9Q
5  *
6  * -----------------------------------------------------------------------------
7  * This file was originally borrowed from libswiftnav
8  * <https://github.com/swift-nav/libswiftnav>,
9  * a portable C library implementing GNSS related functions and algorithms,
10  * and then modified by J. Arribas and C. Fernandez
11  *
12  * Copyright (C) 2004, Phil Karn, KA9Q
13  *
14  * GNSS-SDR is a software defined Global Navigation
15  * Satellite Systems receiver
16  *
17  * This file is part of GNSS-SDR.
18  *
19  * SPDX-License-Identifier: LGPL-3.0-only
20  *.
21  */
22 
23 
24 #ifndef GNSS_SDR_FEC_H
25 #define GNSS_SDR_FEC_H
26 
27 /* r=1/2 k=7 convolutional encoder polynomials
28  * The NASA-DSN convention is to use V27POLYA inverted, then V27POLYB
29  * The CCSDS/NASA-GSFC convention is to use V27POLYB, then V27POLYA inverted
30  */
31 #define V27POLYA 0x4f
32 #define V27POLYB 0x6d
33 
34 typedef struct
35 {
36  unsigned char c0[32];
37  unsigned char c1[32];
38 } v27_poly_t;
39 
40 typedef struct
41 {
42  unsigned int w[2];
44 
45 /* State info for instance of r=1/2 k=7 Viterbi decoder
46  */
47 typedef struct
48 {
49  unsigned int metrics1[64]; /* Path metric buffer 1 */
50  unsigned int metrics2[64]; /* Path metric buffer 2 */
51  /* Pointers to path metrics, swapped on every bit */
52  unsigned int *old_metrics, *new_metrics;
53  const v27_poly_t *poly; /* Polynomial to use */
54  v27_decision_t *decisions; /* Beginning of decisions for block */
55  unsigned int decisions_index; /* Index of current decision */
56  unsigned int decisions_count; /* Number of decisions in history */
57 } v27_t;
58 
59 void v27_poly_init(v27_poly_t *poly, const signed char polynomial[2]);
60 
61 void v27_init(v27_t *v, v27_decision_t *decisions, unsigned int decisions_count,
62  const v27_poly_t *poly, unsigned char initial_state);
63 void v27_update(v27_t *v, const unsigned char *syms, int nbits);
64 void v27_chainback_fixed(v27_t *v, unsigned char *data, unsigned int nbits,
65  unsigned char final_state);
66 void v27_chainback_likely(v27_t *v, unsigned char *data, unsigned int nbits);
67 
68 #endif
Definition: fec.h:47
Definition: fec.h:34