summaryrefslogtreecommitdiff
path: root/src/sms/sms.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sms/sms.c')
-rw-r--r--src/sms/sms.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/sms/sms.c b/src/sms/sms.c
index ac14694..5799489 100644
--- a/src/sms/sms.c
+++ b/src/sms/sms.c
@@ -893,16 +893,22 @@ sfloat sms_fundDeviation(SMS_AnalParams *pAnalParams, int iCurrentFrame)
int i;
if(pAnalParams->minGoodFrames < 1)
+ {
return -1;
+ }
/* get the sum of the past few fundamentals */
for(i = 0; (i < pAnalParams->minGoodFrames) && (iCurrentFrame-i >= 0); i++)
{
fFund = pAnalParams->ppFrames[iCurrentFrame-i]->fFundamental;
if(fFund <= 0)
+ {
return -1;
+ }
else
+ {
fSum += fFund;
+ }
}
/* find the average */
@@ -910,7 +916,9 @@ sfloat sms_fundDeviation(SMS_AnalParams *pAnalParams, int iCurrentFrame)
/* get the deviation from the average */
for(i = 0; (i < pAnalParams->minGoodFrames) && (iCurrentFrame-i >= 0); i++)
+ {
fDeviation += fabs(pAnalParams->ppFrames[iCurrentFrame-i]->fFundamental - fAverage);
+ }
/* return the deviation from the average */
return fDeviation / (pAnalParams->minGoodFrames * fAverage);