Remove an unused variable. Protect against extreme values leading to FPEs.

This commit is contained in:
Joe Taylor 2021-04-20 15:35:56 -04:00
parent fbf288e271
commit 69619dd31e
2 changed files with 13 additions and 9 deletions

View File

@ -434,11 +434,14 @@ int q65_intrinsics_fastfading(q65_codec_ds *pCodec,
// exponentiate and accumulate the normalization constant
sumix = 0.0f;
for (k=0;k<nM;k++) {
fTemp = expf(pCurIx[k]-maxlogp);
pCurIx[k]=fTemp;
sumix +=fTemp;
}
for (k=0;k<nM;k++) {
float x=pCurIx[k]-maxlogp;
if(x < -85.0) x=-85.0;
if(x > 85.0) x= 85.0;
fTemp = expf(x);
pCurIx[k]=fTemp;
sumix +=fTemp;
}
// scale to a probability distribution
sumix = 1.0f/sumix;
@ -663,9 +666,11 @@ int q65_check_llh(float *llh, const int* ydec, const int nN, const int nM, const
float t = 0;
for (k=0;k<nN;k++) {
t+=logf(pIntrin[ydec[k]]);
pIntrin+=nM;
}
float x=pIntrin[ydec[k]];
if(x < 1.0e-36) x = 1.0e-36;
t+=logf(x);
pIntrin+=nM;
}
if (llh!=NULL)
*llh = t;

View File

@ -124,7 +124,6 @@ subroutine display(nkeep,ftol)
line3(k)(35:38)//line3(k)(46:74)
if(out(1:3).ne.' ') then
cfreq0=out(1:3)
if(iw.lt.MAXLINES-1) iw=iw+1
livecq=line3(k)(6:13)//line3(k)(28:31)//line3(k)(39:45)// &
line3(k)(23:27)//line3(k)(35:38)//line3(k)(46:70)// &
line3(k)(73:77)