source: Sophya/trunk/Poubelle/archediab.old/archediab.sources/h/ecclib.h@ 649

Last change on this file since 649 was 649, checked in by ansari, 26 years ago

archediab 28 vol

File size: 1.5 KB
Line 
1#if !defined(_ECC_LIB_H_)
2
3#define _ECC_LIB_H_
4
5#define REED_SOLOMON
6
7typedef unsigned char dtype;
8
9void EccInit( int nn, int kk, int mm ) ;
10
11/* Reed-Solomon encoding
12 * data[] is the input block, parity symbols are placed in bb[]
13 * bb[] may lie past the end of the data, e.g., for (255,223):
14 * encode_rs(&data[0],&data[223]);
15 */
16int EccEncode(dtype *data, dtype *bb );
17
18/* Reed-Solomon erasures-and-errors decoding
19 * The received block goes into data[], and a list of zero-origin
20 * erasure positions, if any, goes in eras_pos[] with a count in no_eras.
21 *
22 * The decoder corrects the symbols in place, if possible and returns
23 * the number of corrected symbols. If the codeword is illegal or
24 * uncorrectible, the data array is unchanged and -1 is returned
25 */
26int EccDecode( dtype *data, dtype *ecc, int *eras_pos, int no_eras) ;
27
28void SetEcc( void *bloc, unsigned char * ) ;
29int UnsetEcc( void *bloc, unsigned char * ) ;
30
31#if defined(REED_SOLOMON)
32/* defini ici que si l'on n'a pas inclu archeops.h qui contient les memes definitions */
33#ifndef version_num
34#define ECC_TOTAL 255
35#define ECC_DATA 239 /* Nb de bytes de data encodes */
36#define ECC_SIZE (ECC_TOTAL-ECC_DATA) /* Nb de bytes encodeurs */
37#define SIZE_HEAD sizeof(long)*3 /* 3 mots d'entete de blocs */
38#endif
39#if defined(_ECCLIB_MAIN_)
40
41int Kgood = ECC_DATA, /* Detection/correction de 8 bytes en erreur
42 On peut aller jusqu'a 16 (Kgood = 223 ) */
43 Ntotal = 255 ;
44
45#else
46
47extern int Kgood, Ntotal ;
48
49#endif
50#endif
51#endif
Note: See TracBrowser for help on using the repository browser.