|
@@ -343,25 +343,26 @@ cmRC_t cmGoldSigGen( cmGoldSig_t* p, unsigned chIdx, unsigned prefixN, unsigned
|
343
|
343
|
|
344
|
344
|
|
345
|
345
|
//=======================================================================================================================
|
346
|
|
-cmPhat_t* cmPhatAlloc( cmCtx* ctx, cmPhat_t* p, unsigned chN, unsigned hN, float alpha, unsigned mult, unsigned flags )
|
|
346
|
+cmPhat_t* cmPhatAlloc( cmCtx* ctx, cmPhat_t* ap, unsigned chN, unsigned hN, float alpha, unsigned mult, unsigned flags )
|
347
|
347
|
{
|
348
|
|
- cmPhat_t* op = cmObjAlloc(cmPhat_t,ctx,p);
|
|
348
|
+ cmPhat_t* p = cmObjAlloc(cmPhat_t,ctx,ap);
|
349
|
349
|
|
350
|
350
|
// The FFT buffer and the delay line is at least twice the size of the
|
351
|
351
|
// id signal. This will guarantee that at least one complete id signal
|
352
|
352
|
// is inside the buffer. In practice it means that it is possible
|
353
|
353
|
// that there will be two id's in the buffer therefore if there are
|
354
|
354
|
// two correlation spikes it is important that we take the second.
|
355
|
|
- p->fhN = cmNextPowerOfTwo(mult*hN);
|
|
355
|
+ unsigned fhN = cmNextPowerOfTwo(mult*hN);
|
356
|
356
|
|
357
|
357
|
// allocate the FFT object
|
358
|
|
- cmFftAllocSR(ctx,&p->fft,NULL,p->fhN,kToPolarFftFl);
|
|
358
|
+ cmFftAllocSR(ctx,&p->fft,NULL,fhN,kToPolarFftFl);
|
|
359
|
+ cmIFftAllocRS(ctx,&p->ifft,fhN/2 + 1 );
|
359
|
360
|
|
360
|
361
|
if( chN != 0 )
|
361
|
|
- if( cmPhatInit(op,chN,hN,alpha,mult,flags) != cmOkRC )
|
362
|
|
- cmPhatFree(&op);
|
|
362
|
+ if( cmPhatInit(p,chN,hN,alpha,mult,flags) != cmOkRC )
|
|
363
|
+ cmPhatFree(&p);
|
363
|
364
|
|
364
|
|
- return op;
|
|
365
|
+ return p;
|
365
|
366
|
|
366
|
367
|
}
|
367
|
368
|
|
|
@@ -384,6 +385,7 @@ cmRC_t cmPhatFree( cmPhat_t** pp )
|
384
|
385
|
cmMemFree(p->mhM);
|
385
|
386
|
cmMemFree(p->wndV);
|
386
|
387
|
cmObjFreeStatic(cmFftFreeSR, cmFftSR, p->fft);
|
|
388
|
+ cmObjFreeStatic(cmIFftFreeRS, cmIFftRS, p->ifft);
|
387
|
389
|
cmVectArrayFree(&p->ftVa);
|
388
|
390
|
cmObjFree(pp);
|
389
|
391
|
|
|
@@ -403,6 +405,9 @@ cmRC_t cmPhatInit( cmPhat_t* p, unsigned chN, unsigned hN, float alpha, unsig
|
403
|
405
|
if((cmFftInitSR(&p->fft, NULL, p->fhN, kToPolarFftFl)) != cmOkRC )
|
404
|
406
|
return rc;
|
405
|
407
|
|
|
408
|
+ if((cmFftInitRS(&p->ifft, NULL, p->fft->binCnt )) != cmOkRC )
|
|
409
|
+ return rc;
|
|
410
|
+
|
406
|
411
|
p->alpha = alpha;
|
407
|
412
|
p->flags = flags;
|
408
|
413
|
|
|
@@ -463,18 +468,18 @@ cmRC_t cmPhatSetId( cmPhat_t* p, unsigned chIdx, const cmSample_t* hV, unsigned
|
463
|
468
|
// Zero pad hV[hN] to p->fhN;
|
464
|
469
|
assert( hN <= p->fhN );
|
465
|
470
|
cmVOS_Zero(p->xV,p->fhN);
|
466
|
|
- cmVOS_Copy(p->xV,hV,hN);
|
|
471
|
+ cmVOS_Copy(p->xV,hN,hV);
|
467
|
472
|
|
468
|
473
|
// Apply the window function to the id signal
|
469
|
|
- if(atIsFlag(p->flags,kHannAtPhatFl) )
|
470
|
|
- cmVOS_MultVVV(p->xV,hV,wndV,hN);
|
|
474
|
+ if(cmIsFlag(p->flags,kHannAtPhatFl) )
|
|
475
|
+ cmVOS_MultVVV(p->xV,hN,hV,wndV);
|
471
|
476
|
|
472
|
477
|
// take FFT of id signal. The result is in fft->complexV and fft->magV,phsV
|
473
|
|
- cmFftExecSR(p->fft, p->xV, p->fhN );
|
|
478
|
+ cmFftExecSR(&p->fft, p->xV, p->fhN );
|
474
|
479
|
|
475
|
480
|
// Store the magnitude of the id signal
|
476
|
481
|
//atFftComplexAbs(p->mhM + (chIdx*p->binN), yV, p->binN);
|
477
|
|
- cmVOR_Copy(p->mhM + (chIdx*p->binN), p->fft->magV, p->binN );
|
|
482
|
+ cmVOF_CopyR(p->mhM + (chIdx*p->binN), p->binN, p->fft.magV );
|
478
|
483
|
|
479
|
484
|
// Scale the magnitude
|
480
|
485
|
cmVOS_MultVS( p->mhM + (chIdx*p->binN), p->binN, p->alpha);
|
|
@@ -482,22 +487,23 @@ cmRC_t cmPhatSetId( cmPhat_t* p, unsigned chIdx, const cmSample_t* hV, unsigned
|
482
|
487
|
// store the complex conjugate of the FFT result in yV[]
|
483
|
488
|
//atFftComplexConj(yV,p->binN);
|
484
|
489
|
for(i=0; i<p->binN; ++i)
|
485
|
|
- yV[i].i = -(p->fft->complexV[i].i);
|
|
490
|
+ yV[i] = cmCconjR(p->fft.complexV[i]);
|
486
|
491
|
|
487
|
492
|
cmMemFree(wndV);
|
488
|
493
|
|
489
|
|
- return kOkAtRC;
|
|
494
|
+ return cmOkRC;
|
490
|
495
|
}
|
491
|
496
|
|
492
|
497
|
cmSample_t* _cmPhatReadVector( cmCtx* ctx, cmPhat_t* p, const char* fn, unsigned* vnRef )
|
493
|
498
|
{
|
494
|
499
|
cmVectArray_t* vap = NULL;
|
495
|
500
|
cmSample_t* v = NULL;
|
|
501
|
+ cmRC_t rc = cmOkRC;
|
496
|
502
|
|
497
|
503
|
// instantiate a VectArray from a file
|
498
|
|
- if( cmVectArrayAllocFromFile(ctx, &vap, fn ) != kOkAtRC )
|
|
504
|
+ if( (vap = cmVectArrayAllocFromFile(ctx, fn )) == NULL )
|
499
|
505
|
{
|
500
|
|
- atErrMsg(&p->obj.err,kFileReadFailAtRC,"Id component vector file read failed '%s'.",fn);
|
|
506
|
+ rc = cmCtxRtCondition(&p->obj,cmSubSysFailRC,"Id component vector file read failed '%s'.",fn);
|
501
|
507
|
goto errLabel;
|
502
|
508
|
}
|
503
|
509
|
|
|
@@ -505,14 +511,14 @@ cmSample_t* _cmPhatReadVector( cmCtx* ctx, cmPhat_t* p, const char* fn, unsigned
|
505
|
511
|
*vnRef = cmVectArrayEleCount(vap);
|
506
|
512
|
|
507
|
513
|
// allocate memory to hold the vector
|
508
|
|
- v = cmMemAlloc(&p->obj.err,cmSample_t,*vnRef);
|
|
514
|
+ v = cmMemAlloc(cmSample_t,*vnRef);
|
509
|
515
|
|
510
|
516
|
// copy the vector from the vector array object into v[]
|
511
|
|
- if( cmVectArrayGetF(vap,v,vnRef) != kOkAtRC )
|
|
517
|
+ if((rc = cmVectArrayGetF(vap,v,vnRef)) != cmOkRC )
|
512
|
518
|
{
|
513
|
519
|
cmMemFree(v);
|
514
|
520
|
v = NULL;
|
515
|
|
- atErrMsg(&p->obj.err,kFileReadFailAtRC,"Id component vector copy out failed '%s'.",fn);
|
|
521
|
+ rc = cmCtxRtCondition(&p->obj,cmSubSysFailRC,"Id component vector copy out failed '%s'.",fn);
|
516
|
522
|
goto errLabel;
|
517
|
523
|
}
|
518
|
524
|
|
|
@@ -528,20 +534,20 @@ cmSample_t* _cmPhatReadVector( cmCtx* ctx, cmPhat_t* p, const char* fn, unsigned
|
528
|
534
|
|
529
|
535
|
cmRC_t cmPhatExec( cmPhat_t* p, const cmSample_t* xV, unsigned xN )
|
530
|
536
|
{
|
531
|
|
- unsigned n = atMin(xN,p->fhN-p->di);
|
|
537
|
+ unsigned n = cmMin(xN,p->fhN-p->di);
|
532
|
538
|
|
533
|
539
|
// update the delay line
|
534
|
|
- cmVOS_Copy(p->dV+p->di,xV,n);
|
|
540
|
+ cmVOS_Copy(p->dV+p->di,n,xV);
|
535
|
541
|
|
536
|
542
|
if( n < xN )
|
537
|
|
- cmVOS_Copy(p->dV,xV+n,xN-n);
|
|
543
|
+ cmVOS_Copy(p->dV,xN-n,xV+n);
|
538
|
544
|
|
539
|
|
- p->di = atModIncr(p->di,xN,p->fhN);
|
|
545
|
+ p->di = cmModIncr(p->di,xN,p->fhN);
|
540
|
546
|
|
541
|
547
|
// p->absIdx is the absolute sample index associated with di
|
542
|
548
|
p->absIdx += xN;
|
543
|
549
|
|
544
|
|
- return kOkAtRC;
|
|
550
|
+ return cmOkRC;
|
545
|
551
|
}
|
546
|
552
|
|
547
|
553
|
|
|
@@ -556,20 +562,20 @@ void cmPhatChExec(
|
556
|
562
|
unsigned n1 = p->fhN - n0;
|
557
|
563
|
|
558
|
564
|
// Linearize the delay line into xV[]
|
559
|
|
- cmVOS_Copy(p->xV, p->dV + p->di, n0 );
|
560
|
|
- cmVOS_Copy(p->xV+n0, p->dV, n1 );
|
|
565
|
+ cmVOS_Copy(p->xV, n0, p->dV + p->di );
|
|
566
|
+ cmVOS_Copy(p->xV+n0, n1, p->dV );
|
561
|
567
|
|
562
|
|
- if( atIsFlag(p->flags,kDebugAtPhatFl))
|
|
568
|
+ if( cmIsFlag(p->flags,kDebugAtPhatFl))
|
563
|
569
|
cmVectArrayAppendS(p->ftVa, p->xV, p->fhN );
|
564
|
570
|
|
565
|
571
|
// apply a window function to the incoming signal
|
566
|
|
- if( atIsFlag(p->flags,kHannAtPhatFl) )
|
|
572
|
+ if( cmIsFlag(p->flags,kHannAtPhatFl) )
|
567
|
573
|
cmVOS_MultVV(p->xV,p->fhN,p->wndV);
|
568
|
574
|
|
569
|
575
|
// Take the FFT of the delay line.
|
570
|
576
|
// p->t0V[p->binN] = fft(p->xV)
|
571
|
577
|
//atFftRealForward(p->fftH, p->xV, p->fhN, p->t0V, p->binN );
|
572
|
|
- cmFftExecSR(p->fft, p->xV, p->fhN );
|
|
578
|
+ cmFftExecSR(&p->fft, p->xV, p->fhN );
|
573
|
579
|
|
574
|
580
|
// Calc. the Cross Power Spectrum (aka cross spectral density) of the
|
575
|
581
|
// input signal with the id signal.
|
|
@@ -577,7 +583,7 @@ void cmPhatChExec(
|
577
|
583
|
// cross-correlation of the two signals.
|
578
|
584
|
// t0V[] *= p->fhM[:,chIdx]
|
579
|
585
|
//atFftComplexMult( p->t0V, p->fhM + (chIdx * p->fhN), p->binN );
|
580
|
|
- cmVOCR_MultVVV( p->t0V, p->fft->complexV, p->fhM + (chIdx * p->fhN), p->binN)
|
|
586
|
+ cmVOCR_MultVVV( p->t0V, p->fft.complexV, p->fhM + (chIdx * p->fhN), p->binN);
|
581
|
587
|
|
582
|
588
|
// Calculate the magnitude of the CPS.
|
583
|
589
|
// xV[] = | t0V[] |
|
|
@@ -588,7 +594,7 @@ void cmPhatChExec(
|
588
|
594
|
// id signal contains energy)
|
589
|
595
|
// t0V[] *= p->mhM[:,chIdx]
|
590
|
596
|
if( p->alpha > 0 )
|
591
|
|
- cmVOCR_MultR_VV( p->t0V, p->mhM + (chIdx*p->binN), p->binN);
|
|
597
|
+ cmVOCR_MultVFV( p->t0V, p->mhM + (chIdx*p->binN), p->binN);
|
592
|
598
|
|
593
|
599
|
// Divide through by the magnitude of the CPS
|
594
|
600
|
// This has the effect of whitening the spectram and thereby
|
|
@@ -596,11 +602,11 @@ void cmPhatChExec(
|
596
|
602
|
// while maximimizing the effect of the phase correlation.
|
597
|
603
|
//
|
598
|
604
|
// t0V[] /= xV[]
|
599
|
|
- cmVOCR_DivR_VV( p->t0V, p->xV, p->binN );
|
|
605
|
+ cmVOCR_DivVFV( p->t0V, p->xV, p->binN );
|
600
|
606
|
|
601
|
607
|
// Take the IFFT of the weighted CPS to recover the cross correlation.
|
602
|
608
|
// xV[] = IFFT(t0V[])
|
603
|
|
-
|
|
609
|
+ cmIFftExecRS( p->ifft, );
|
604
|
610
|
|
605
|
611
|
//// ***** atFftRealInverse( p->fftH, p->t0V, p->xV, p->fhN );
|
606
|
612
|
|
|
@@ -610,7 +616,7 @@ void cmPhatChExec(
|
610
|
616
|
// normalize by the length of the correlation
|
611
|
617
|
cmVOS_DivVS(p->xV,p->fhN,p->fhN);
|
612
|
618
|
|
613
|
|
- if( atIsFlag(p->flags,kDebugAtPhatFl))
|
|
619
|
+ if( cmIsFlag(p->flags,kDebugAtPhatFl))
|
614
|
620
|
{
|
615
|
621
|
cmVectArrayAppendS(p->ftVa, p->xV, p->fhN );
|
616
|
622
|
|
|
@@ -622,28 +628,28 @@ void cmPhatChExec(
|
622
|
628
|
|
623
|
629
|
cmRC_t cmPhatWrite( cmPhat_t* p, const char* dirStr )
|
624
|
630
|
{
|
625
|
|
- cmRC_t rc = kOkAtRC;
|
|
631
|
+ cmRC_t rc = cmOkRC;
|
626
|
632
|
|
627
|
|
- if( atIsFlag(p->flags, kDebugAtPhatFl))
|
|
633
|
+ if( cmIsFlag(p->flags, kDebugAtPhatFl))
|
628
|
634
|
{
|
629
|
|
- char* path = NULL;
|
|
635
|
+ const char* path = NULL;
|
630
|
636
|
|
631
|
637
|
if( p->ftVa != NULL )
|
632
|
|
- if((rc = cmVectArrayWrite(p->ftVa, path = atMakePath(&p->obj.err,path,"cmPhatFT","va",dirStr,NULL) )) != kOkAtRC )
|
633
|
|
- rc = atErrMsg(&p->obj.err,rc,"PHAT debug file write failed.");
|
|
638
|
+ if((rc = cmVectArrayWrite(p->ftVa, path = cmFsMakeFn(path,"cmPhatFT","va",dirStr,NULL) )) != cmOkRC )
|
|
639
|
+ rc = cmCtxRtCondition(&p->obj,cmSubSysFailRC,"PHAT debug file write failed.");
|
634
|
640
|
|
635
|
|
- cmMemFree(path);
|
|
641
|
+ cmFsFreeFn(path);
|
636
|
642
|
}
|
637
|
643
|
|
638
|
644
|
return rc;
|
639
|
645
|
}
|
640
|
646
|
|
641
|
|
-
|
|
647
|
+#ifdef NOTDEF
|
642
|
648
|
cmRC_t cmPhatTest1( cmCtx* ctx, const char* dirStr )
|
643
|
649
|
{
|
644
|
|
- cmRC_t rc = kOkAtRC;
|
645
|
|
- atSignalArg_t sa;
|
646
|
|
- atSignal_t* s = NULL;
|
|
650
|
+ cmRC_t rc = cmOkRC;
|
|
651
|
+ cmGoldSigArg_t sa;
|
|
652
|
+ cmGoldSig_t* s = NULL;
|
647
|
653
|
cmPhat_t* p = NULL;
|
648
|
654
|
char* path = NULL;
|
649
|
655
|
unsigned dspFrmCnt = 256;
|
|
@@ -677,30 +683,30 @@ cmRC_t cmPhatTest1( cmCtx* ctx, const char* dirStr )
|
677
|
683
|
sa.envMs = 50.0;
|
678
|
684
|
|
679
|
685
|
// allocate the the id signals
|
680
|
|
- if( atSignalAlloc( ctx, &s, &sa ) != kOkAtRC )
|
681
|
|
- return atErrMsg(&ctx->err, kTestFailAtRC, "Signal allocate failed.");
|
|
686
|
+ if( (s = cmGoldSigAlloc( ctx, NULL, &sa ) == NULL )
|
|
687
|
+ return cmErrMsg(&ctx->err, cmSubSysFailRC, "Signal allocate failed.");
|
682
|
688
|
|
683
|
689
|
// set the post signal listen delay to half the signal length
|
684
|
690
|
listenDelaySmp = s->sigN/2;
|
685
|
691
|
|
686
|
692
|
// allocate a PHAT detector
|
687
|
|
- if( cmPhatAlloc(ctx,&p,sa.chN,s->sigN, phatAlpha, phatMult, kDebugAtPhatFl ) != kOkAtRC )
|
|
693
|
+ if( (p = cmPhatAlloc(ctx,NULL,sa.chN,s->sigN, phatAlpha, phatMult, kDebugAtPhatFl ) == NULL )
|
688
|
694
|
{
|
689
|
|
- rc = atErrMsg(&ctx->err, kTestFailAtRC, "PHAT allocate failed.");
|
|
695
|
+ rc = cmErrMsg(&ctx->err, cmSubSysFailRC, "PHAT allocate failed.");
|
690
|
696
|
goto errLabel;
|
691
|
697
|
}
|
692
|
698
|
|
693
|
699
|
// register an id signal with the PHAT detector
|
694
|
|
- if( cmPhatSetId(p, chIdx, s->ch[chIdx].mdV, s->sigN ) != kOkAtRC )
|
|
700
|
+ if( cmPhatSetId(p, chIdx, s->ch[chIdx].mdV, s->sigN ) != cmOkRC )
|
695
|
701
|
{
|
696
|
|
- rc = atErrMsg(&ctx->err, kTestFailAtRC, "PHAT setId failed.");
|
|
702
|
+ rc = cmErrMsg(&ctx->err, cmSubSysFailRC, "PHAT setId failed.");
|
697
|
703
|
goto errLabel;
|
698
|
704
|
}
|
699
|
705
|
|
700
|
706
|
// generate an input test signal containing bsiN id signals
|
701
|
|
- if( atSignalGen(s,chIdx,p->fhN,s->sigN,bsiV,bsiN,noiseGain,&yV,&yN) != kOkAtRC )
|
|
707
|
+ if( atSignalGen(s,chIdx,p->fhN,s->sigN,bsiV,bsiN,noiseGain,&yV,&yN) != cmOkRC )
|
702
|
708
|
{
|
703
|
|
- rc = atErrMsg(&ctx->err,kTestFailAtRC,"Signal generation failed.");
|
|
709
|
+ rc = cmErrMsg(&ctx->err,cmSubSysFailRC,"Signal generation failed.");
|
704
|
710
|
goto errLabel;
|
705
|
711
|
}
|
706
|
712
|
|
|
@@ -714,23 +720,23 @@ cmRC_t cmPhatTest1( cmCtx* ctx, const char* dirStr )
|
714
|
720
|
atVOU_Zero(dsiV,bsiN);
|
715
|
721
|
|
716
|
722
|
// allocate a vector array to record the PHAT input signals
|
717
|
|
- if( cmVectArrayAlloc(ctx,&inVA,kSampleVaFl) != kOkAtRC )
|
|
723
|
+ if( cmVectArrayAlloc(ctx,&inVA,kSampleVaFl) != cmOkRC )
|
718
|
724
|
{
|
719
|
|
- rc = atErrMsg(&ctx->err, kTestFailAtRC, "vectArray inVA alloc failed.");
|
|
725
|
+ rc = cmErrMsg(&ctx->err, cmSubSysFailRC, "vectArray inVA alloc failed.");
|
720
|
726
|
goto errLabel;
|
721
|
727
|
}
|
722
|
728
|
|
723
|
729
|
// allocate a vector array to record the PHAT correlation output signals
|
724
|
|
- if( cmVectArrayAlloc(ctx,&outVA,kSampleVaFl) != kOkAtRC )
|
|
730
|
+ if( cmVectArrayAlloc(ctx,&outVA,kSampleVaFl) != cmOkRC )
|
725
|
731
|
{
|
726
|
|
- rc = atErrMsg(&ctx->err, kTestFailAtRC, "vectArray outVA alloc failed.");
|
|
732
|
+ rc = cmErrMsg(&ctx->err, cmSubSysFailRC, "vectArray outVA alloc failed.");
|
727
|
733
|
goto errLabel;
|
728
|
734
|
}
|
729
|
735
|
|
730
|
736
|
// allocate a vector array to record the PHAT status
|
731
|
|
- if( cmVectArrayAlloc(ctx,&statusVA,kSampleVaFl) != kOkAtRC )
|
|
737
|
+ if( cmVectArrayAlloc(ctx,&statusVA,kSampleVaFl) != cmOkRC )
|
732
|
738
|
{
|
733
|
|
- rc = atErrMsg(&ctx->err, kTestFailAtRC, "vectArray statusVA alloc failed.");
|
|
739
|
+ rc = cmErrMsg(&ctx->err, cmSubSysFailRC, "vectArray statusVA alloc failed.");
|
734
|
740
|
goto errLabel;
|
735
|
741
|
}
|
736
|
742
|
|
|
@@ -775,23 +781,23 @@ cmRC_t cmPhatTest1( cmCtx* ctx, const char* dirStr )
|
775
|
781
|
}
|
776
|
782
|
|
777
|
783
|
// write inVA
|
778
|
|
- if( cmVectArrayWrite(inVA,path = atMakePath(&ctx->err,path,"phatIn","va",dirStr,NULL)) != kOkAtRC )
|
|
784
|
+ if( cmVectArrayWrite(inVA,path = atMakePath(&ctx->err,path,"phatIn","va",dirStr,NULL)) != cmOkRC )
|
779
|
785
|
{
|
780
|
|
- rc = atErrMsg(&ctx->err, kTestFailAtRC, "vectArray outVA write failed.");
|
|
786
|
+ rc = cmErrMsg(&ctx->err, cmSubSysFailRC, "vectArray outVA write failed.");
|
781
|
787
|
goto errLabel;
|
782
|
788
|
}
|
783
|
789
|
|
784
|
790
|
// write outVA
|
785
|
|
- if( cmVectArrayWrite(outVA,path = atMakePath(&ctx->err,path,"phatOut","va",dirStr,NULL)) != kOkAtRC )
|
|
791
|
+ if( cmVectArrayWrite(outVA,path = atMakePath(&ctx->err,path,"phatOut","va",dirStr,NULL)) != cmOkRC )
|
786
|
792
|
{
|
787
|
|
- rc = atErrMsg(&ctx->err, kTestFailAtRC, "vectArray outVA write failed.");
|
|
793
|
+ rc = cmErrMsg(&ctx->err, cmSubSysFailRC, "vectArray outVA write failed.");
|
788
|
794
|
goto errLabel;
|
789
|
795
|
}
|
790
|
796
|
|
791
|
797
|
// write statusVA
|
792
|
|
- if( cmVectArrayWrite(statusVA,path = atMakePath(&ctx->err,path,"phatStatus","va",dirStr,NULL)) != kOkAtRC )
|
|
798
|
+ if( cmVectArrayWrite(statusVA,path = atMakePath(&ctx->err,path,"phatStatus","va",dirStr,NULL)) != cmOkRC )
|
793
|
799
|
{
|
794
|
|
- rc = atErrMsg(&ctx->err, kTestFailAtRC, "vectArray statusVA write failed.");
|
|
800
|
+ rc = cmErrMsg(&ctx->err, cmSubSysFailRC, "vectArray statusVA write failed.");
|
795
|
801
|
goto errLabel;
|
796
|
802
|
}
|
797
|
803
|
|
|
@@ -799,18 +805,18 @@ cmRC_t cmPhatTest1( cmCtx* ctx, const char* dirStr )
|
799
|
805
|
cmVectArrayFree(&outVA);
|
800
|
806
|
cmVectArrayFree(&inVA);
|
801
|
807
|
|
802
|
|
- if( cmPhatFree(&p) != kOkAtRC )
|
803
|
|
- atErrMsg(&ctx->err,kTestFailAtRC,"PHAT free failed.");
|
|
808
|
+ if( cmPhatFree(&p) != cmOkRC )
|
|
809
|
+ cmErrMsg(&ctx->err,cmSubSysFailRC,"PHAT free failed.");
|
804
|
810
|
|
805
|
|
- if( atSignalFree(&s) != kOkAtRC )
|
806
|
|
- atErrMsg(&ctx->err,kTestFailAtRC,"Signal free failed.");
|
|
811
|
+ if( atSignalFree(&s) != cmOkRC )
|
|
812
|
+ cmErrMsg(&ctx->err,cmSubSysFailRC,"Signal free failed.");
|
807
|
813
|
|
808
|
814
|
return rc;
|
809
|
815
|
}
|
810
|
816
|
|
811
|
817
|
cmRC_t cmPhatTest2( cmCtx* ctx )
|
812
|
818
|
{
|
813
|
|
- cmRC_t rc = kOkAtRC;
|
|
819
|
+ cmRC_t rc = cmOkRC;
|
814
|
820
|
cmPhat_t* p = NULL;
|
815
|
821
|
unsigned hN = 16;
|
816
|
822
|
float alpha = 1.0;
|
|
@@ -826,24 +832,24 @@ cmRC_t cmPhatTest2( cmCtx* ctx )
|
826
|
832
|
unsigned chN = sizeof(xV)/sizeof(xV[0]);
|
827
|
833
|
unsigned i;
|
828
|
834
|
|
829
|
|
- if(cmPhatAlloc(ctx,&p,chN,hN,alpha,mult,kNoFlagsAtPhatFl) != kOkAtRC )
|
|
835
|
+ if(cmPhatAlloc(ctx,&p,chN,hN,alpha,mult,kNoFlagsAtPhatFl) != cmOkRC )
|
830
|
836
|
{
|
831
|
|
- rc = atErrMsg(&ctx->err,kTestFailAtRC,"cmPhatAlloc() failed.");
|
|
837
|
+ rc = cmErrMsg(&ctx->err,cmSubSysFailRC,"cmPhatAlloc() failed.");
|
832
|
838
|
goto errLabel;
|
833
|
839
|
}
|
834
|
840
|
|
835
|
841
|
for(i=0; i<chN; ++i)
|
836
|
|
- if( cmPhatSetId(p,i,hV,hN) != kOkAtRC )
|
837
|
|
- rc = atErrMsg(&ctx->err,kTestFailAtRC,"cmPhatSetId() failed.");
|
|
842
|
+ if( cmPhatSetId(p,i,hV,hN) != cmOkRC )
|
|
843
|
+ rc = cmErrMsg(&ctx->err,cmSubSysFailRC,"cmPhatSetId() failed.");
|
838
|
844
|
|
839
|
845
|
|
840
|
846
|
for(i=0; i<chN; ++i)
|
841
|
847
|
{
|
842
|
848
|
cmPhatReset(p);
|
843
|
849
|
|
844
|
|
- if( cmPhatExec(p,xV[i],hN) != kOkAtRC )
|
|
850
|
+ if( cmPhatExec(p,xV[i],hN) != cmOkRC )
|
845
|
851
|
{
|
846
|
|
- rc = atErrMsg(&ctx->err,kTestFailAtRC,"cmPhatExec() failed.");
|
|
852
|
+ rc = cmErrMsg(&ctx->err,cmSubSysFailRC,"cmPhatExec() failed.");
|
847
|
853
|
goto errLabel;
|
848
|
854
|
}
|
849
|
855
|
|
|
@@ -859,3 +865,4 @@ cmRC_t cmPhatTest2( cmCtx* ctx )
|
859
|
865
|
|
860
|
866
|
return rc;
|
861
|
867
|
}
|
|
868
|
+#endif
|