HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / reedsolomon.h
blob433f6e1e4989e8f39e3594487a1fe7a0a6937e68
1 #ifdef __cplusplus
2 extern "C" {
3 #endif
5 /* Global definitions for Reed-Solomon encoder/decoder
6 * Phil Karn KA9Q, September 1996
7 */
8 /* Set one of these to enable encoder/decoder debugging and error checking,
9 * at the expense of speed */
10 /* #undef DEBUG 1*/
11 /* #undef DEBUG 2*/
12 #undef DEBUG
14 /* To select the CCSDS standard (255,223) code, define CCSDS. This
15 * implies standard values for MM, KK, B0 and PRIM.
17 /* #undef CCSDS 1*/
18 #undef CCSDS
19 #ifndef CCSDS
21 /* Otherwise, leave CCSDS undefined and set the parameters below:
23 * Set MM to be the size of each code symbol in bits. The Reed-Solomon
24 * block size will then be NN = 2**M - 1 symbols. Supported values are
25 * defined in rs.c.
27 #define MM 8 /* Symbol size in bits */
30 * Set KK to be the number of data symbols in each block, which must be
31 * less than the block size. The code will then be able to correct up
32 * to NN-KK erasures or (NN-KK)/2 errors, or combinations thereof with
33 * each error counting as two erasures.
35 #define KK 207 /* Number of data symbols per block */
37 /* Set B0 to the first root of the generator polynomial, in alpha form, and
38 * set PRIM to the power of alpha used to generate the roots of the
39 * generator polynomial. The generator polynomial will then be
40 * @**PRIM*B0, @**PRIM*(B0+1), @**PRIM*(B0+2)...@**PRIM*(B0+NN-KK)
41 * where "@" represents a lower case alpha.
43 #define B0 1 /* First root of generator polynomial, alpha form */
44 #define PRIM 1 /* power of alpha used to generate roots of generator poly */
45 #define STANDARD_ORDER
47 /* If you want to select your own field generator polynomial, you'll have
48 * to edit that in rs.c.
51 #else /* CCSDS */
52 /* Don't change these, they're CCSDS standard */
53 #define MM 8
54 #define KK 223
55 #define B0 112
56 #define PRIM 11
57 #endif
59 #define NN ((1 << MM) - 1)
61 #if MM <= 8
62 typedef unsigned char dtype;
63 #else
64 typedef unsigned int dtype;
65 #endif
67 /* Reed-Solomon encoding
68 * data[] is the input block, parity symbols are placed in bb[]
69 * bb[] may lie past the end of the data, e.g., for (255,223):
70 * encode_rs(&data[0],&data[223]);
72 int encode_rs(dtype data[], dtype bb[]);
74 /* Reed-Solomon erasures-and-errors decoding
75 * The received block goes into data[], and a list of zero-origin
76 * erasure positions, if any, goes in eras_pos[] with a count in no_eras.
78 * The decoder corrects the symbols in place, if possible and returns
79 * the number of corrected symbols. If the codeword is illegal or
80 * uncorrectible, the data array is unchanged and -1 is returned
82 int eras_dec_rs(dtype data[], int eras_pos[], int no_eras);
84 #ifdef __cplusplus
86 #endif