Browse Source

cmProc5.c : Completed and tested cmPhatChExec().

master
kevin 9 years ago
parent
commit
0c505ecc2c
1 changed files with 6 additions and 5 deletions
  1. 6
    5
      cmProc5.c

+ 6
- 5
cmProc5.c View File

@@ -405,7 +405,7 @@ cmRC_t   cmPhatInit(  cmPhat_t* p, unsigned chN, unsigned hN, float alpha, unsig
405 405
   if((cmFftInitSR(&p->fft, NULL, p->fhN, kToPolarFftFl)) != cmOkRC )
406 406
     return rc;
407 407
 
408
-  if((cmFftInitRS(&p->ifft, NULL, p->fft->binCnt )) != cmOkRC )
408
+  if((cmIFftInitRS(&p->ifft, p->fft.binCnt )) != cmOkRC )
409 409
     return rc;
410 410
 
411 411
   p->alpha = alpha;
@@ -603,13 +603,14 @@ void cmPhatChExec(
603 603
   // 
604 604
   // t0V[] /= xV[]
605 605
   cmVOCR_DivVFV( p->t0V, p->xV, p->binN );
606
-  
606
+
607 607
   // Take the IFFT of the weighted CPS to recover the cross correlation.
608 608
   // xV[] = IFFT(t0V[])
609
-  cmIFftExecRS( p->ifft,  );
609
+  cmIFftExecRS( &p->ifft, p->t0V );
610
+
611
+  // Normalize the result by the length of the transform.
612
+  cmVOS_DivVVS( p->xV, p->fhN, p->ifft.outV, p->fhN );
610 613
 
611
-  //// ***** atFftRealInverse( p->fftH, p->t0V, p->xV, p->fhN );
612
-  
613 614
   // Shift the correlation spike to mark the end of the id
614 615
   cmVOS_Rotate( p->xV, p->fhN, -((int)p->hN) );
615 616
 

Loading…
Cancel
Save