Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
reedsolomon.h
Go to the documentation of this file.
1
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18/* Set one of these to enable encoder/decoder debugging and error checking,
19 * at the expense of speed */
20/* #undef DEBUG 1*/
21/* #undef DEBUG 2*/
22#undef DEBUG
23
24/* To select the CCSDS standard (255,223) code, define CCSDS. This
25 * implies standard values for MM, KK, B0 and PRIM.
26 */
27/* #undef CCSDS 1*/
28#undef CCSDS
29#ifndef CCSDS
30
31/* Otherwise, leave CCSDS undefined and set the parameters below:
32 *
33 * Set MM to be the size of each code symbol in bits. The Reed-Solomon
34 * block size will then be NN = 2**M - 1 symbols. Supported values are
35 * defined in rs.c.
36 */
37#define MM 8 /* Symbol size in bits */
38
39/*
40 * Set KK to be the number of data symbols in each block, which must be
41 * less than the block size. The code will then be able to correct up
42 * to NN-KK erasures or (NN-KK)/2 errors, or combinations thereof with
43 * each error counting as two erasures.
44 */
45#define KK 207 /* Number of data symbols per block */
46
47/* Set B0 to the first root of the generator polynomial, in alpha form, and
48 * set PRIM to the power of alpha used to generate the roots of the
49 * generator polynomial. The generator polynomial will then be
50 * @**PRIM*B0, @**PRIM*(B0+1), @**PRIM*(B0+2)...@**PRIM*(B0+NN-KK)
51 * where "@" represents a lower case alpha.
52 */
53#define B0 1 /* First root of generator polynomial, alpha form */
54#define PRIM 1 /* power of alpha used to generate roots of generator poly */
55#define STANDARD_ORDER
56
57/* If you want to select your own field generator polynomial, you'll have
58 * to edit that in rs.c.
59 */
60
61#else /* CCSDS */
62/* Don't change these, they're CCSDS standard */
63#define MM 8
64#define KK 223
65#define B0 112
66#define PRIM 11
67#endif
68
69#define NN ((1 << MM) - 1)
70
71#if MM <= 8
72typedef unsigned char dtype;
73#else
74typedef unsigned int dtype;
75#endif
76
89int encode_rs(dtype data[], dtype bb[]);
90
107int eras_dec_rs(dtype data[], int eras_pos[], int no_eras);
108
109#ifdef __cplusplus
110}
111#endif
int eras_dec_rs(dtype data[], int eras_pos[], int no_eras)
Performs ERRORS+ERASURES decoding of Reed-Solomon codes.
Definition reedsolomon.c:413
int encode_rs(dtype data[], dtype bb[])
Encodes data using Reed-Solomon error correction.
Definition reedsolomon.c:345