资源简介
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编解码\rs.cpp
文件 876 2014-06-18 08:54 RS编解码\rs.h
文件 17839 2017-07-18 10:03 RS编解码\RScode1.txt
文件 611 2014-06-18 08:54 RS编解码\test_rs.cpp
目录 0 2017-08-02 16:20 RS编解码
----------- --------- ---------- ----- ----
28833 5
相关资源
- 数据结构课程设计《活期储蓄帐目管
- c语言端口扫描
- 门禁系统代码(C语言版).
- 实现最近点对问题源的代码(C语言)
- [纯C语言 + Win32 API]一步一步写个围棋
- 共轭梯度法C语言程序
- C语言编写公交查询系统
- AES多种加密解密方式C语言方式实现
- C语言实现的小球碰撞程序
- MSP430实现温度检测源代码//基于c语言
- Quicksum(C语言)
- C语言程序设计(第三版)谭浩强.zi
- zw_duanzhiying-1870490-C语言库函数.zip
- 车票管理系统C语言版
- c语言实现的单链表和循环链表
- 大数计算器的c语言实现
- c语言科学与艺术实训答案
- c语言程序设计题总结资源
- c语言员工管理系统
- 简易温度测量C语言编程
- 数据结构C语言版源代码
- 简单的线性反馈移位寄存器LFSRC语言实
- zw_RSA算法C语言实现.zip
- 学生成绩管理系统V6.0 c语言大作业
- C语言Renju规则五子棋AI
- funcode 打飞虫c语言源码
- 班费收支管理系统
- c语言tcp服务器端程序代码
- C语言判断一个大数是否为素数
- 基于stm32f407八字循迹小车代码C语言写
评论
共有 条评论