资源简介
本资源给出了bch码的编译码的c语言代码,可以通用
代码片段和文件信息
// ------------------------------------------------------------------------
// File: bch_bm.c
// Date: April 3 2002
// Description: An encoder/decoder for binary BCH codes
// Error correction using the BERLEKAMP-MASSEY ALGORITHM
// ------------------------------------------------------------------------
// This program is complementary material for the book:
//
// R.H. Morelos-Zaragoza The Art of Error Correcting Coding Wiley 2002.
//
// ISBN 0471 49581 6
//
// This and other programs are available at http://the-art-of-ecc.com
//
// You may use this program for academic and personal purposes only.
// If this program is used to perform simulations whose results are
// published in a journal or book please refer to the book above.
//
// The use of this program in a commercial product requires explicit
// written permission from the author. The author is not responsible or
// liable for damage or loss that may be caused by the use of this program.
//
// Copyright (c) 2002. Robert H. Morelos-Zaragoza. All rights reserved.
// ------------------------------------------------------------------------
#include
#include
int m n length k t d;
int p[21];
int alpha_to[1048576] index_of[1048576] g[548576];
int recd[1048576] data[1048576] bb[548576];
int seed;
int numerr errpos[1024] decerror = 0;
void
read_p()
/*
* Read m the degree of a primitive polynomial p(x) used to compute the
* Galois field GF(2**m). Get precomputed coefficients p[] of p(x). Read
* the code length.
*/
{
int i ninf;
printf(“\nEnter a value of m such that the code length is\n“);
printf(“2**(m-1) - 1 < length <= 2**m - 1\n\n“);
do {
printf(“Enter m (between 2 and 20): “);
scanf(“%d“ &m);
} while ( !(m>1) || !(m<21) );
for (i=1; i p[i] = 0;
p[0] = p[m] = 1;
if (m == 2) p[1] = 1;
else if (m == 3) p[1] = 1;
else if (m == 4) p[1] = 1;
else if (m == 5) p[2] = 1;
else if (m == 6) p[1] = 1;
else if (m == 7) p[1] = 1;
else if (m == 8) p[4] = p[5] = p[6] = 1;
else if (m == 9) p[4] = 1;
else if (m == 10) p[3] = 1;
else if (m == 11) p[2] = 1;
else if (m == 12) p[3] = p[4] = p[7] = 1;
else if (m == 13) p[1] = p[3] = p[4] = 1;
else if (m == 14) p[1] = p[11] = p[12] = 1;
else if (m == 15) p[1] = 1;
else if (m == 16) p[2] = p[3] = p[5] = 1;
else if (m == 17) p[3] = 1;
else if (m == 18) p[7] = 1;
else if (m == 19) p[1] = p[5] = p[6] = 1;
else if (m == 20) p[3] = 1;
printf(“p(x) = “);
n = 1;
for (i = 0; i <= m; i++) {
n *= 2;
printf(“%1d“ p[i]);
}
printf(“\n“);
n = n / 2 - 1;
ninf = (n + 1) / 2 - 1;
do {
printf(“Enter code length (%d < length <= %d): “ ninf n);
scanf(“%d“ &length);
} while ( !((length <= n)&&(length>ninf)) );
}
void
generate_gf()
/*
* Generate field GF(2*
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 15015 2009-05-25 10:39 bch\bch_bm.c
- 上一篇:SM2算法C语言实现
- 下一篇:基于51单片机的c语言程序 电机转速测量与PWM控制
相关资源
- 基于51单片机的c语言程序 电机转速测
- SM2算法C语言实现
- 用C语言实现成绩表的快速排序程序设
- GPS网间接平差C语言程序
- RSA算法纯C语言代码实现,带测试dem
- c语言标准库源码大全
- [算法:C语言实现(第1-4部分)基础知
- MPI与OpenMP并行程序设计:C语言版
- C语言程序设计课件全套
- 几本英文原版的c语言经典图书
- 单片机交通灯课程设计.zip
- 课程设计--C语言学生成绩管理系统内
- 利用C语言实现的ATM机
- C语言程序设计第四版谭浩强课后习题
- 现代优化设计黄金分割法和二次插值
- 数据结构c语言版第2版课后习题答案
- 谭浩强C语言教程
- 求曼德勃罗集合C语言串行并行代码
- 流程图生成器C语言
- C语言大一期末考小助手
- 谭浩强 程序代码及习题答案(第三版
- 超声波测距及蓝牙模块源码程序c语言
- 重庆邮电大学C语言期末考试题
- 学校教材订购系统,C语言版,内容详
- 利用FFT计算频谱图
- 数据结构——C语言描述》习题及答案
- 郝斌C语言详细笔记().doc
- C语言编写的中文分词程序
- 全国计算机等级考试-二级教程-C语言
- 使用C++实现HDLC协议
评论
共有 条评论