summaryrefslogtreecommitdiff
path: root/gr-fec/lib/reed-solomon/decode_rs_ccsds.c
blob: be6e2018e377cbb0cde83be58694b03c10834dc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* This function wraps around the fixed 8-bit decoder, performing the
 * basis transformations necessary to meet the CCSDS standard
 *
 * Copyright 2002, Phil Karn, KA9Q
 * May be used under the terms of the GNU General Public License (GPL)
 */
#define FIXED 1
#include "ccsds.h"
#include "fixed.h"

int decode_rs_ccsds(unsigned char* data, int* eras_pos, int no_eras)
{
    int i, r;
    unsigned char cdata[NN];

    /* Convert data from dual basis to conventional */
    for (i = 0; i < NN; i++)
        cdata[i] = Tal1tab[data[i]];

    r = decode_rs_8(cdata, eras_pos, no_eras);

    if (r > 0) {
        /* Convert from conventional to dual basis */
        for (i = 0; i < NN; i++)
            data[i] = Taltab[cdata[i]];
    }
    return r;
}