From 0c505ecc2c31865e720f09119b8bed9ae1efe04d Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 24 Jul 2015 18:18:22 -0400 Subject: [PATCH] cmProc5.c : Completed and tested cmPhatChExec(). --- cmProc5.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cmProc5.c b/cmProc5.c index aacee7b..679a278 100644 --- a/cmProc5.c +++ b/cmProc5.c @@ -405,7 +405,7 @@ cmRC_t cmPhatInit( cmPhat_t* p, unsigned chN, unsigned hN, float alpha, unsig if((cmFftInitSR(&p->fft, NULL, p->fhN, kToPolarFftFl)) != cmOkRC ) return rc; - if((cmFftInitRS(&p->ifft, NULL, p->fft->binCnt )) != cmOkRC ) + if((cmIFftInitRS(&p->ifft, p->fft.binCnt )) != cmOkRC ) return rc; p->alpha = alpha; @@ -603,13 +603,14 @@ void cmPhatChExec( // // t0V[] /= xV[] cmVOCR_DivVFV( p->t0V, p->xV, p->binN ); - + // Take the IFFT of the weighted CPS to recover the cross correlation. // xV[] = IFFT(t0V[]) - cmIFftExecRS( p->ifft, ); + cmIFftExecRS( &p->ifft, p->t0V ); + + // Normalize the result by the length of the transform. + cmVOS_DivVVS( p->xV, p->fhN, p->ifft.outV, p->fhN ); - //// ***** atFftRealInverse( p->fftH, p->t0V, p->xV, p->fhN ); - // Shift the correlation spike to mark the end of the id cmVOS_Rotate( p->xV, p->fhN, -((int)p->hN) );