ГОСТ Р 56047—2014
levpatadapt(double ’Etest. double ’Eref. ini rale,
struct levpatadaptin ‘tmp. int harm)
{
intk, i. m l. m2:
double T. levcorr. numlevcorr = 0. denomlevcorr = 0. R;
double pattcoeffref. pattcoefftest:
double BreflBARK], Eltest[BARK], Rtest[BARK], Rref[BARK], a[BARK);
struct levpatadaptout out;
for(k=0;k<bark;k++) {
T = (douWe)Tmin + (100.0/fC[k))*(T100 - Tmm):
a[k] = exp((double)-hann/(2.0‘rate * T));
tmp->Ptest[k] = tmp->Ptest[kJ*a[k) + (1.0-a[k])‘Etest[k):
tmp->Pref[k) = tmp->Preflkra[kl + (1.0-а1к])*ЕгеВД;
numlevcorr += sqrt(tmp->Ptest[k]*tmp->Pref[kl):
denomlevcorr += tmp->Ptest[k]:
levcorr = p(numlevcorr/denom!evcorr, 2.0);
for(k=0;k<bark;k++) {
if(levcorr > 1.0) {
Elreflk] = (double)Eref[k)/levcorr;
Eltest[k] = Etest[k]:
)
else {
Eltest[k) = (double)Etestlk]’levcorr;
Elref[k) = Ereflk);
)
ИAutocorrelation
tmp->Rnum[k] ’= a[k);
tmp->Rdenomlk) *= a[k);
tmp->Rnum[k) += Elref(k)*Eltest[k]:
tmp->Rdenom(k) += Elref[k)*Elref[k];
if(tmp->Rdenom[k] == 0 && tmp->Rnumlk] != 0) {
Rtestlk] = 0;
Rref[k) = 1.0;
}
else
if(tmp->Rdenom{k] == 0 && tmp->Rnumlk] == 0) {
//copy from frequency band below
if(k){
Rtest[k) = Rtestlk-1);
Rreflk) = Rreflk-1);
)
//if don’t exist
else {
Rtestlk) = 1.0;
Rreflk) = 1.0;
}
else {
R = tmp->Rnum[kJ / tmp->Rdenomlk]:
if(R >= 1.0) {
Rtestlk) = 1,0/R;
Rreflk) = 1.0;
}
else {
Rtestlk) = 1.0;
Rreflk) = R;
>
)
77