资源简介
前向纠错的多个算法C语言,包括viterbi、RS32、RS-2.0 fano1.1等
代码片段和文件信息
/*
* Soft decision Fano sequential decoder for K=32 r=1/2 convolutional code
* Copyright 1994 Phil Karn KA9Q
*/
#define LL 1 /* Select Layland-Lushbaugh code */
#include
#include
#include
#include “fano.h“
struct node {
unsigned long encstate; /* Encoder state of next node */
long gamma; /* Cumulative metric to this node */
int metrics[4]; /* Metrics indexed by all possible tx syms */
int tm[2]; /* Sorted metrics for current hypotheses */
int i; /* Current branch being tested */
};
/* Convolutional coding polynomials. All are rate 1/2 K=32 */
#ifdef NASA_STANDARD
/* “NASA standard“ code by Massey & Costello
* Nonsystematic quick look-in dmin=11 dfree=23
* used on Pioneer 10-12 Helios AB
*/
#define POLY1 0xbbef6bb7
#define POLY2 0xbbef6bb5
#endif
#ifdef MJ
/* Massey-Johannesson code
* Nonsystematic quick look-in dmin=13 dfree>=23
* Purported to be more computationally efficient than Massey-Costello
*/
#define POLY1 0xb840a20f
#define POLY2 0xb840a20d
#endif
#ifdef LL
/* Layland-Lushbaugh code
* Nonsystematic non-quick look-in dmin=? dfree=?
*/
#define POLY1 0xf2d05351
#define POLY2 0xe4613c47
#endif
/* Convolutional encoder macro. Takes the encoder state generates
* a rate 1/2 symbol pair and stores it in ‘sym‘. The symbol generated from
* POLY1 goes into the 2-bit of sym and the symbol generated from POLY2
* goes into the 1-bit.
*/
#define ENCODE(symencstate){\
unsigned long _tmp;\
\
_tmp = (encstate) & POLY1;\
_tmp ^= _tmp >> 16;\
(sym) = Partab[(_tmp ^ (_tmp >> 8)) & 0xff] << 1;\
_tmp = (encstate) & POLY2;\
_tmp ^= _tmp >> 16;\
(sym) |= Partab[(_tmp ^ (_tmp >> 8)) & 0xff];\
}
/* Convolutionally encode a packet. The input data bytes are read
* high bit first and the encoded packet is written into ‘symbols‘
* one symbol per byte. The first symbol is generated from POLY1
* the second from POLY2.
*
* Storing only one symbol per byte uses more space but it is faster
* and easier than trying to pack them more compactly.
*/
int
encode(
unsigned char *symbols /* Output buffer 2*nbytes */
unsigned char *data /* Input buffer nbytes */
unsigned int nbytes) /* Number of bytes in data */
{
unsigned long encstate;
int sym;
int i;
encstate = 0;
while(nbytes-- != 0){
for(i=7;i>=0;i--){
encstate = (encstate << 1) | ((*data >> i) & 1);
ENCODE(symencstate);
*symbols++ = sym >> 1;
*symbols++ = sym & 1;
}
data++;
}
return 0;
}
/* Decode packet with the Fano algorithm.
* Return 0 on success -1 on timeout
*/
int
fano(
unsigned long *metric /* Final path metric (returned value) */
unsigned long *cycles /* Cycle count (returned value) */
unsigned char *data /* Decoded output data */
unsigned char *symbols /* Raw deinterleaved input symbols */
unsigned int nbits /* Number of output bits */
int mettab[2][256] /* Metric table [se
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 823 1999-05-10 12:52 viterbi-3.0.1\encode27.c
文件 914 1999-05-10 12:52 viterbi-3.0.1\encode37.c
文件 5742 1997-10-28 06:13 viterbi-3.0.1\genviterbi.pl
文件 1252 1999-05-11 16:34 viterbi-3.0.1\Makefile
文件 2945 1999-05-10 12:52 viterbi-3.0.1\metrics.c
文件 4858 1999-08-07 08:56 viterbi-3.0.1\README
文件 1504 1999-05-11 16:43 viterbi-3.0.1\sim.c
文件 922 1997-10-28 06:13 viterbi-3.0.1\tab.c
文件 5016 1999-08-07 08:53 viterbi-3.0.1\viterbi.c
文件 4821 1999-08-07 08:53 viterbi-3.0.1\viterbi27.c
文件 2735 1999-05-11 16:44 viterbi-3.0.1\viterbi27.h
文件 5828 1999-08-07 08:53 viterbi-3.0.1\viterbi37.c
文件 2674 1997-10-28 06:13 viterbi-3.0.1\viterbi37.h
文件 8990 1997-10-28 06:13 viterbi-3.0.1\vitfilt27.c
文件 10011 1997-10-28 06:13 viterbi-3.0.1\vitfilt37.c
文件 5560 1999-08-07 08:54 viterbi-3.0.1\vittest.c
目录 0 2006-04-17 11:49 viterbi-3.0.1
文件 7048 1995-07-27 14:24 fano1.1\fano.c
文件 378 1995-07-24 16:30 fano1.1\fano.h
文件 317 1995-07-27 13:20 fano1.1\Makefile
文件 2871 1995-07-24 16:32 fano1.1\metrics.c
文件 4934 1995-08-06 13:51 fano1.1\README
文件 6372 1995-07-27 14:25 fano1.1\seqtest.c
文件 1397 1995-03-17 03:53 fano1.1\sim.c
文件 922 1995-03-16 16:04 fano1.1\tab.c
目录 0 2006-04-17 11:49 fano1.1
文件 217 1997-08-09 15:01 rs32\Makefile
文件 562 1997-08-09 15:20 rs32\README
文件 12152 1997-08-09 14:55 rs32\rs32.c
文件 1890 1997-08-09 14:56 rs32\rs32.h
............此处省略33个文件信息
相关资源
- Effective C++中文版 超清pdf
- viterbi译码算法c++实现以及程序所对应
- Viterbi算法c/c++实现
- fec向前纠错编码rs编码仿真实现
- Effective C++简体中文 完整书签
- Effective C++ 中文版第三版 azw3版本 ki
- effective stl 中文版高清扫描版.pdf
- 卷积码的viterbi译码算法的c语言源代码
- 《Effective c++ 》
- Effective C++ More Effective C++英文版
- 2/3FEC编码c++源代码
- 中文第三版-Effective C++
- effective c++ cn version
- c++从零开始,c++ primerEffective C++都是
评论
共有 条评论