1 /* Conversion lookup tables from conventional alpha to Berlekamp's
2 * dual-basis representation. Used in the CCSDS version only.
3 * taltab[] -- convert conventional to dual basis
4 * tal1tab[] -- convert dual basis to conventional
6 * Note: the actual RS encoder/decoder works with the conventional basis.
7 * So data is converted from dual to conventional basis before either
8 * encoding or decoding and then converted back.
10 * Copyright 2002 Phil Karn, KA9Q
11 * May be used under the terms of the GNU General Public License (GPL)
14 unsigned char Taltab[256],Tal1tab[256];
16 static unsigned char tal[] = { 0x8d, 0xef, 0xec, 0x86, 0xfa, 0x99, 0xaf, 0x7b };
18 /* Generate conversion lookup tables between conventional alpha representation
19 * (@**7, @**6, ...@**0)
20 * and Berlekamp's dual basis representation
26 for(i=0;i<256;i++){/* For each value of input */
28 for(j=0;j<8;j++) /* for each column of matrix */
29 for(k=0;k<8;k++){ /* for each row of matrix */
31 Taltab[i] ^= tal[7-k] & (1<<j);
33 Tal1tab[Taltab[i]] = i;
35 printf("unsigned char Taltab[] = {\n");
39 printf("0x%02x,",Taltab[i]);
41 printf("\n};\n\nunsigned char Tal1tab[] = {");
45 printf("0x%02x,",Tal1tab[i]);