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

📄 softdecshell.cpp

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

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

static bool isHard[]={true, true, false};
static HDecFunc DecodeOneWord_Hard[]={DecodeOneWord_BMA, NULL, NULL};
static SDecFunc DecodeOneWord_Soft[]={NULL, NULL, NULL};
static InitAlgFunc InitDecAlg[]={InitBMA, NULL, NULL};
static CloseAlgFunc CloseDecAlg[]={CloseBMA, NULL, NULL};
static int AlgStructSize[]={sizeof(BMARegs), 0, 0};
*/


void InitSDec(void* p, const RSCodeParam& rsp) {
	SDecStruc* sdec=(SDecStruc*)p;
	sdec->N=rsp.N;
	sdec->M=rsp.M;
	sdec->K=rsp.K;
	sdec->gf=rsp.gf;
}

void CloseSDec(void* p) {}

bool DecodeOneWord_SDec(GFE* C, const double* relibMat, void* p) {
	SDecStruc* sdec=(SDecStruc*)p;
	Using_Pow2Vec_Vec2Pow_NG(sdec->gf);
	int rowhead, N=sdec->N;
	double maxPr, sumPr;
	for (int col=0; col<N; col++)
	{
		rowhead=0;
		sumPr=0; maxPr=-1.0;
		for (int row=0; row<=N; row++, rowhead+=N)
		{
			if (relibMat[rowhead+col]>maxPr)
			{
				maxPr=relibMat[rowhead+col];
				C[col]=(row==0)? 0 : Pow2Vec[row-1];
			}
			sumPr+=relibMat[rowhead+col];
			if (1-sumPr<=maxPr) break;
		}
	}

	return true;
}


		

⌨️ 快捷键说明

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