91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 4KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-08
  • 語言: C/C++
  • 標簽: rs編碼??

資源簡介

支持GF(2^n)域的rs編解碼,可直接修改參數實現不同方式的RS編碼和解碼

資源截圖

代碼片段和文件信息

#include?“rs.h“



void?encode_rs(int?recd[nn]?int?data[kk]?int??bb[nn-kk])
/*?take?the?string?of?symbols?in?data[i]?i=0..(k-1)?and?encode?systematically
to?produce?2*tt?parity?symbols?in?bb[0]..bb[2*tt-1]
data[]?is?input?and?bb[]?is?output?in?polynomial?form.
Encoding?is?done?by?using?a?feedback?shift?register?with?appropriate
connections?specified?by?the?elements?of?gg[]?which?was?generated?above.
Codeword?is?c(X)?=?data(X)*X**(nn-kk)+?b(X)?*/
{
int?ij?;
int?feedback?;
for?(i=0;?i bb[i]?=?0?;
for?(i=kk-1;?i>=0;?i--)
{
feedback?=?index_of[data[i]^bb[nn-kk-1]]?;
if?(feedback?!=?-1)
{?
for?(j=nn-kk-1;?j>0;?j--)
if?(gg[j]?!=?-1)
bb[j]?=?bb[j-1]^alpha_to[(gg[j]+feedback)%nn]?;
else
bb[j]?=?bb[j-1]?;
bb[0]?=?alpha_to[(gg[0]+feedback)%nn]?;
}
else
{
for?(j=nn-kk-1;?j>0;?j--)
bb[j]?=?bb[j-1]?;
bb[0]?=?0?;
}?;
}?;

for?(i=0;?i recd[i]?=?bb[i]?;
for?(i=0;?i recd[i+nn-kk]?=?data[i]?;
}?



void?decode_rs(int?recd[nn]?int?dataout[kk])
/*?assume?we?have?received?bits?grouped?into?mm-bit?symbols?in?recd[i]
i=0..(nn-1)?and?recd[i]?is?index?form?(ie?as?powers?of?alpha).
We?first?compute?the?2*tt?syndromes?by?substituting?alpha**i?into?rec(X)?and
evaluating?storing?the?syndromes?in?s[i]?i=1..2tt?(leave?s[0]?zero)?.
Then?we?use?the?Berlekamp?iteration?to?find?the?error?location?polynomial
elp[i].?If?the?degree?of?the?elp?is?>tt?we?cannot?correct?all?the?errors
and?hence?just?put?out?the?information?symbols?uncorrected.?If?the?degree?of
elp?is?<=tt?we?substitute?alpha**i??i=1..n?into?the?elp?to?get?the?roots
hence?the?inverse?roots?the?error?location?numbers.?If?the?number?of?errors
located?does?not?equal?the?degree?of?the?elp?we?have?more?than?tt?errors
and?cannot?correct?them.?Otherwise?we?then?solve?for?the?error?value?at
the?error?location?and?correct?the?error.?The?procedure?is?that?found?in
Lin?and?Costello.?For?the?cases?where?the?number?of?errors?is?known?to?be?too
large?to?correct?the?information?symbols?as?received?are?output?(the
advantage?of?systematic?encoding?is?that?hopefully?some?of?the?information
symbols?will?be?okay?and?that?if?we?are?in?luck?the?errors?are?in?the
parity?part?of?the?transmitted?codeword).?Of?course?these?insoluble?cases
can?be?returned?as?error?flags?to?the?calling?routine?if?desired.?*/
{
int?ijuq?;
int?elp[nn-kk+2][nn-kk]?d[nn-kk+2]?l[nn-kk+2]?u_lu[nn-kk+2]?s[nn-kk+1]?;
int?count=0?syn_error=0?root[tt]?loc[tt]?z[tt+1]?err[nn]?reg[tt+1]?;
/*?first?form?the?syndromes?*/
for?(i=1;?i<=nn-kk;?i++)
{?
s[i]?=?0?;
for?(j=0;?j if?(recd[j]!=-1)
s[i]?^=?alpha_to[(recd[j]+i*j)%nn]?;?/*?recd[j]?in?index?form?*/
/*?convert?syndrome?from?polynomial?form?to?index?form?*/
if?(s[i]!=0)?syn_error=1?;?/*?set?flag?if?non-zero?syndrome?=>?error?*/
s[i]?=?index_of[s[i]]?;
}?;
if?(syn_error)?/*?if?errors?try?and?co

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????9507??2014-06-18?08:55??rs(6.17)\rs.cpp
?????文件?????????876??2014-06-18?08:54??rs(6.17)\rs.h
?????文件?????????611??2014-06-18?08:54??rs(6.17)\test_rs.cpp
?????目錄???????????0??2014-06-18?09:00??rs(6.17)\

評論

共有 條評論