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