gbmate 发表于 2005-11-25 13:48:43

高手们献招:前向纠错码,用C如何实现编解码

前向纠错码为缩短循环(26,16)码,生成多项式为G(X)=X10+X8+X7+X5+X4+X3+1

计算方法是每16BIT数据(两个字节)后添加10BIT纠错信息。

请问高手们如何用C实现编码与解码?

gbmate 发表于 2005-11-25 14:20:48

编码方法://请指教

设:16BIT数据为A(X),编码寄存器为T(X)

A(X)= A(X)*210

T(X)= A(X)+A(X)%G(X)



unsigned longencode (unsigned int temp_word)

{

unsigned longtemp_two_word1, temp_two_word2;

unsigned longgx;



gx=1465;// G(X)=X10+X8+X7+X5+X4+X3+1



temp_two_word1= (unsigned long ) temp_word;



temp_two_word1<<= 10;



temp_two_word2= temp_two_word1%gx;



temp_two_word1= temp_two_word1+ temp_two_word2;

return (temp_two_word1);

}

///





解码方法:

根据上面的编码可得出解码,但如何纠错,这是一大难点?

gbmate 发表于 2005-11-25 14:50:51

顶一直

gbmate 发表于 2005-11-25 15:49:44

难倒没人灌点水!

解码难啊!

好男,好难啊

__________________

再顶一下

violit 发表于 2005-11-25 16:51:14

这个问题比较专业

建议搂住找找有关的书籍~~

lsdwz414 发表于 2005-11-26 17:11:27

我不会

snow_xsj 发表于 2007-7-3 11:44:00

等待高手的指点

63502925 发表于 2013-3-11 17:25:51

//编码
u32 encode(u16 temp_word)
{
u32 code;
code = (u32)temp_word;
for(u8 i=0;i<16;i++){
    if((code&(u32)(0x8000)))code^=0xB720;//0x5b9 << 5
    code<<=1;
}
return (u32)(code>>6|temp_word<<10);
}

u16 CorrectErfSample={119,743,943,779,857,880,440,220,110,55,711,959,771,861,882,441,512,256,128,64,32,16,8,4,2,1};
u32 CorrectTable={33554432,16777216,8388608,4194304,2097152,1048576,524288,262144,131072,65536,32768,16384,8192,4096,2048,1024,512,256,128,64,32,16,8,4,2,1};
//1bit纠错
//return 0:no error,1:Correct error,2:error
u8 CorrectDeal(unsigned long*CorrectCode)
{
u32 code;
unsigned int i,t;
code = *CorrectCode ;
for(i=0;i<16;i++){
    if((code&(u32)0x2000000)!=0)code^=0x2DC8000;//<<15
    code<<=1;
}
t=code>>(26-10);
if(t==0)return 0;
for(i=0;i<26;i++){
    if(t==CorrectErfSample){
      *CorrectCode ^= CorrectTable;
      return 1;
    }
}
return 2;
}

沉默胜过白金 发表于 2015-10-24 12:20:22

mark , 有空研究。
页: [1]
查看完整版本: 高手们献招:前向纠错码,用C如何实现编解码