countber.cpp
来自「这个是数据打孔重传程序的源代码」· C++ 代码 · 共 43 行
CPP
43 行
/**********************************************/
/* Counter of error bits
/* double CountBerF(struct BasicParaS * ctrl, int * input, int * output)
/* Written by: Ouyang Ziyue,
/* Date: Jun 19th, 2007,
/* Function: It compares the orginial info bits and the decoded info bits to calc the error ratio
/* Input parameter:
/* The length of info bits is included in the ctrl,
/* The input is the original input bits,
/* The output is the output of decoder
/* Output parameter:
/* The return value is the BER
/* Note:
/* ctrl should be built before this function is called,
/**********************************************/
#include "parameter_sets.h"
double CountBerF(struct BasicParaS * ctrl, int * input, int * output)
{
//////////////////////////////////////////////////////////////////////////
//Declaration
double ber;
int i;
double counter=0;
//////////////////////////////////////////////////////////////////////////
//Counting BER
for (i=0; i<ctrl->codeK; i++)
{
if ((*(input+i)) != (*(output+i)))
{
counter += 1;
#ifdef DEBUG
printf("%d\n",i);
#endif
}
}
ber = counter/ctrl->codeK;
return ber;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?