Houston, we have a trunk.
[debian/gnuradio] / gnuradio-core / src / lib / reed-solomon / decode_rs_ccsds.c
1 /* This function wraps around the fixed 8-bit decoder, performing the
2  * basis transformations necessary to meet the CCSDS standard
3  *
4  * Copyright 2002, Phil Karn, KA9Q
5  * May be used under the terms of the GNU General Public License (GPL)
6  */
7 #define FIXED 1
8 #include "fixed.h"
9 #include "ccsds.h"
10
11 int decode_rs_ccsds(unsigned char *data,int *eras_pos,int no_eras){
12   int i,r;
13   unsigned char cdata[NN];
14
15   /* Convert data from dual basis to conventional */
16   for(i=0;i<NN;i++)
17     cdata[i] = Tal1tab[data[i]];
18
19   r = decode_rs_8(cdata,eras_pos,no_eras);
20
21   if(r > 0){
22     /* Convert from conventional to dual basis */
23     for(i=0;i<NN;i++)
24       data[i] = Taltab[cdata[i]];
25   }
26   return r;
27 }