資源簡(jiǎn)介
通信中為了防止信道質(zhì)量不好的時(shí)候出現(xiàn)傳輸錯(cuò)誤,在發(fā)送和接收端加上RS編譯碼,可以自動(dòng)檢錯(cuò)和糾錯(cuò)
代碼片段和文件信息
/****************ecc.h*************************/
/*?Reed?Solomon?Coding?for?glyphs
?*?
?*?(c)?Henry?Minsky?(hqm@ua.com)?Universal?Access?Inc.??(1991-1996)
?*?????
?*
?*/
/****************************************************************
??
??Below?is?NPAR?the?only?compile-time?parameter?you?should?have?to
??modify.
??
??It?is?the?number?of?parity?bytes?which?will?be?appended?to
??your?data?to?create?a?codeword.
??Note?that?the?maximum?codeword?size?is?255?so?the
??sum?of?your?message?length?plus?parity?should?be?less?than
??or?equal?to?this?maximum?limit.
??In?practice?you?will?get?slooow?error?correction?and?decoding
??if?you?use?more?than?a?reasonably?small?number?of?parity?bytes.
??(say?10?or?20)
??****************************************************************/
??
?#include?
?#include??
?#include?
??
#define?AL?255??????????/////????????
#define?NPAR?6
#define?NL?AL-NPAR?
#define?ITLDPTH?1??????///不加交織
/****************************************************************/
#define?TRUE?1
#define?FALSE?0
typedef?unsigned?long?BIT32;
typedef?unsigned?short?BIT16;
/*?****************************************************************?*/
/*?Maximum?degree?of?various?polynomials.?*/
#define?MAXDEG?(NPAR*2)
/*************************************/
/*?Encoder?parity?bytes?*/
extern?int?pBytes[MAXDEG];
/*?Decoder?syndrome?bytes?*/
extern?int?synBytes[MAXDEG];
/*?print?debugging?info?*/
extern?int?DEBUG;
/*?Reed?Solomon?encode/decode?routines?*/
void?initialize_ecc?(void);
int?check_syndrome?(void);
void?decode_data?(unsigned?char?data[]?int?nbytes);
void?encode_data?(unsigned?char?msg[]?int?nbytes?unsigned?char?dst[]);
/*?CRC-CCITT?checksum?generator?*/
BIT16?crc_ccitt(unsigned?char?*msg?int?len);
/*?galois?arithmetic?tables?*/
extern?int?gexp[];
extern?int?glog[];
void?init_galois_tables?(void);
int?ginv(int?elt);?
int?gmult(int?a?int?b);
/*?Error?location?routines?*/
int?correct_errors_erasures?(unsigned?char?codeword[]?int?csizeint?nerasures?int?erasures[]);
/*?polynomial?arithmetic?*/
void?add_polys(int?dst[]?int?src[])?;
void?scale_poly(int?k?int?poly[]);
void?mult_polys(int?dst[]?int?p1[]?int?p2[]);
void?copy_poly(int?dst[]?int?src[]);
void?zero_poly(int?poly[]);
/**********************************************************************************************/
/****************************berlerkamp.c**************************************/
/***********************************************************************
?*?Berlekamp-Peterson?and?Berlekamp-Massey?Algorithms?for?error-location
?*
?*?From?Cain?Clark?“Error-Correction?Coding?For?Digital?Communications“?pp.?205.
?*
?*?This?finds?the?coefficients?of?the?error?locator?polynomial.
?*
?*?The?roots?are?then?found?by?looking?for?the?values?of?a^n
?*?where?evaluating?the?polynomial?yields?zero.
?*
?*?Error?correction?is?done?using?
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件??????19917??2010-02-08?10:16??新建文件夾\rscode.c
?????文件??????16458??2010-02-04?10:45??新建文件夾\rsdecode.c
?????目錄??????????0??2010-03-07?21:33??新建文件夾
-----------?---------??----------?-----??----
????????????????36375????????????????????3
評(píng)論
共有 條評(píng)論