diff options
author | John Glover <john.c.glover@nuim.ie> | 2010-12-30 18:47:47 +0000 |
---|---|---|
committer | John Glover <john.c.glover@nuim.ie> | 2010-12-30 18:47:47 +0000 |
commit | af918cfd3763df16f83c419ef45b5ae85f2952c3 (patch) | |
tree | bb102df31fb7afcdb28f3173559e4410c14f197b | |
parent | 9214a933be3caff80eec7a19d04fd309c3a35388 (diff) | |
download | simpl-af918cfd3763df16f83c419ef45b5ae85f2952c3.tar.gz simpl-af918cfd3763df16f83c419ef45b5ae85f2952c3.tar.bz2 simpl-af918cfd3763df16f83c419ef45b5ae85f2952c3.zip |
Update to sms_approxResidual
-rw-r--r-- | sms/synthesis.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/sms/synthesis.c b/sms/synthesis.c index e9b0967..9523ee6 100644 --- a/sms/synthesis.c +++ b/sms/synthesis.c @@ -175,20 +175,19 @@ void sms_approxResidual(SMS_ResidualParams *residualParams) /* get energy of spectrum */ int i; sfloat fMag = 0.0; - /*for(i = 0; i < pAnalParams->sizeStocMagSpectrum; i++)*/ - /* fMag += (pAnalParams->stocMagSpectrum[i] * pAnalParams->stocMagSpectrum[i]);*/ + for(i = 0; i < residualParams->sizeStocMagSpectrum; i++) + fMag += (residualParams->stocMagSpectrum[i] * pAnalParams->stocMagSpectrum[i]); - /**pSmsData->pFStocGain = fMag / pAnalParams->sizeStocMagSpectrum;*/ + /* if no gain or no coefficients return */ + sfloat stocGain = fMag / residualParams->sizeStocMagSpectrum; + if(stocGain <= 0) + return; - /*int i, sizeSpec1Used;*/ - /*int sizeSpec1 = pSmsData->nCoeff;*/ + int i, sizeSpec1Used; + int sizeSpec1 = residualParams->nCoeffs; /*int sizeSpec2 = pSynthParams->sizeHop;*/ - /*int sizeFft = pSynthParams->sizeHop << 1; [> 50% overlap, so sizeFft is 2x sizeHop <]*/ - /*sfloat fStocGain;*/ - - /*[> if no gain or no coefficients return <]*/ - /*if (*(pSmsData->pFStocGain) <= 0)*/ - /* return 0;*/ + int sizeSpec2 = residualParams->residualSize; + int sizeFft = sizeSpec2 << 1; /* 50% overlap, so sizeFft is 2x sizeHop */ /*sizeSpec1Used = sizeSpec1 * pSynthParams->iSamplingRate / pSynthParams->iOriginalSRate;*/ |