📄 softdecshell.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 + -