⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rsdecoder.h

📁 包括RS码的编码,硬(BM)/软(KV)译码,AWGN信道调制解调仿真. 具体采用何种编译码方案和调制解调方式可在Profile.txt文件中指定(内有详细说明). 且扩展性极好,容易向其中加入新的调
💻 H
字号:
#ifndef _RSDEC
#define _RSDEC

#include "GF.h"
#include "Polynom.h"
#include "RSParam.h"
//#include "BMA.h"
//#include "KVA.h"
//#include "SoftDecShell.h"
#include "EncodeCores.h"

typedef bool (*HDecFunc)(GFE*, const GFE*,  const RSCodeParam&, void*);
typedef bool (*SDecFunc)(GFE*, const double*, const RSCodeParam&, void*);
//typedef void (*InitAlgFunc)(void*, const RSCodeParam&, const DecAlgInterface&);
typedef void (*CloseAlgFunc)(void*);

struct DecAlgInterface {
	void* DecAlgRegs;
//	InitAlgFunc InitDecAlg;
	CloseAlgFunc CloseDecAlg;
	HDecFunc DecodeOneWord_Hard;
	SDecFunc DecodeOneWord_Soft;
	bool isHardDecoder;
	int AlgStructSize;
};

enum DecAlg {
	BMA,
	//SDShell,
	KVA,
	VoidDec
};
/*
static DecAlgInterface DecodeAlgs[]= {
	//{InitFunc, CloseFunc, HDecFunc, SDecFunc, IsHard, AlgStructSize}
	{InitBMA, CloseBMA, DecodeOneWord_BMA, NULL, true, sizeof(BMARegs)},
	//{InitSDec, CloseSDec, NULL, DecodeOneWord_SDec, false, sizeof(SDecStruc)},
	{InitKVA, CloseKVA, NULL, DecodeOneWord_KVA, false, sizeof(KVAMember)},
	{NULL, NULL, DecodeOneWord_Void, NULL, true, 0}
};
*/

struct DecodeResult {
	int succeedNum;
	int failureNum;
	bool lastframeFail;
	bool curframeFail;
	bool failureIgnore;
};

struct RSDecoder {
	GFE* R;
	GFE* C;
	RSCodeParam rsp;
	byte *decodeblock;
	byte masko;
	int ib;//输出译码码字的字节块,及指示当前填充码字位置的指针
	GFE maskw;//maskw:用于码元的掩码
	GFE masktop;
	int ir;
	double* reliabMat;//可信度矩阵(用一维数组表示)
	int col;//指向当前应被填充的可信度矩阵的列
	double* symReliab;
	int iSymRel;
	void* AlgRegs;
	bool isHardDecoder;
	HDecFunc DecodeOneWord_Hard;
	SDecFunc DecodeOneWord_Soft;
//	InitAlgFunc InitDecAlg;
	CloseAlgFunc CloseDecAlg;
	DecodeResult decResult;
};

extern void ResetRSDecoder(RSDecoder& decoder);
extern void InitRSDecoder(RSDecoder&, const RSCodeParam&, const DecAlgInterface&);
extern void CloseRSDecoder(RSDecoder& decoder);
extern int DecodeOneByte(byte b, byte*& outblockp, RSDecoder& dec);
extern int DecodeOneReliabBit(double rel, byte*& output, RSDecoder& dec);

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -