rsdecoder.h

来自「包括RS码的编码,硬(BM)/软(KV)译码,AWGN信道调制解调仿真. 具体采」· C头文件 代码 · 共 80 行

H
80
字号
#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 + =
减小字号Ctrl + -
显示快捷键?