ГОСТ Р 56047—2014
double
detprob(double "EtestcM. double *Etestch2. double *Erefch1.
double *Erefch2. double “Ptildetmp, double "PMtmp.
double *Qsum. int ‘ndistorcedtmp. int hann)
{
int k;
double EtikJerefch 1. Etilderefch2. Etildetestchl, Etildetestch2;
double L. s. e. b, a, pchl. pch2. pbin,
qch1. qch2. qbin. P. cO. c1. ADBb:
double prod = 1.0. Q = 0.0;
for(k=0;k<bark;k++) {
Etildetestchl = 10.0*log10((double)Etestch1[k]):
EtikJerefch 1 = 10.0‘log10((double)Erefch1{kJ):
if(Etilderefch1 > Etildetestchl)
L = 0.3*Etilderefch1:
else
L = 0.3*Etildetestch1;
L += 0.7’Etildetestch1;
if(L > 0)
s = 5.95072‘p(6.39468i’L. 1.71332)+9.01033’p(10.0. -11.0)
*p<L- 4.0)+5.05622‘p{10.0. -6.0)*p(L. 3.0>-0.00102438
*p(L. 2.0)+0.0550197’L-0.198719;
else
s = p( 10.0. 30.0):
e = Etiiderefchl - Etildetestchl;
if(Etilderefch1 > Etildetestchl)
b = 4.0;
else
b = 6.0;
a = (double)p(10.0. Iog10((double)log10({double)2.0»’bys;
pchl = 1.0-p(10.0. -p{a*e. b));
qch1 = abs((int)e)/s; U don’t touch this
pbin = pchl;
qbin = qch1;
if(Etestch2 != NULL && Erefch2 != NULL) {
EWdetestch2 = 10.04og10<(double)Etestch2lk));
Etilderefch2 = 10.0’log10((double)Erefch2(k));
if(Etilderefch2 > Etildetestch2)
L = 0.3‘EtikJerefch2;
else
L = 0.3’EtikJetestch2;
L += 0.7*Etildetestch2:
if(L > 0)
s = 5.95072‘p(6.39468/L. 1.71332)+9.01033‘p(10.0. -11.0)
*p(L. 4.0)+5.05622*p(10.0. -6.0)’p(L. 3.0)
-0.00102438*p(L. 2.0)+0.0550197*L-0.198719:
else
s= 1.0*p(10.0. 30.0);
e = EtikJerefch2 - Etildetestch2:
if(e > 0)
b = 4.0;
else
b = 6.0;
a = (double)p(10.0. Iog10«double)log10<(double)2.0))/bys;
69