📄 countber.cpp
字号:
/**********************************************/
/* 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -