cmProc2.h/c : Added statVa to cmSpecDist().

This commit is contained in:
kevin 2015-09-25 18:50:00 -04:00
parent 8bf64f9a14
commit 0cd86b759f
2 changed files with 22 additions and 3 deletions

View File

@ -5950,6 +5950,7 @@ cmSpecDist_t* cmSpecDistAlloc( cmCtx* ctx,cmSpecDist_t* ap, unsigned procSmpCnt,
//p->iSpecVa = cmVectArrayAlloc(ctx,kRealVaFl);
//p->oSpecVa = cmVectArrayAlloc(ctx,kRealVaFl);
p->statVa = cmVectArrayAlloc(ctx,kDoubleVaFl);
if( procSmpCnt != 0 )
{
@ -5971,6 +5972,7 @@ cmRC_t cmSpecDistFree( cmSpecDist_t** pp )
cmSpecDistFinal(p);
//cmVectArrayFree(&p->iSpecVa);
//cmVectArrayFree(&p->oSpecVa);
cmVectArrayFree(&p->statVa);
cmMemPtrFree(&p->hzV);
cmMemPtrFree(&p->iSpecM);
cmMemPtrFree(&p->oSpecM);
@ -6095,6 +6097,7 @@ cmRC_t cmSpecDistFinal(cmSpecDist_t* p )
//cmVectArrayWrite(p->iSpecVa, "/home/kevin/temp/frqtrk/iSpec.va");
//cmVectArrayWrite(p->oSpecVa, "/home/kevin/temp/expand/oSpec.va");
//cmVectArrayWrite(p->statVa, "/Users/kevin/temp/kc/state.va");
cmPvAnlFree(&p->pva);
cmPvSynFree(&p->pvs);
@ -6111,6 +6114,7 @@ void _cmSpecDistBasicMode0(cmSpecDist_t* p, cmReal_t* X1m, unsigned binCnt, cmRe
// octave> -abs(abs(X1m+thresh)-(X1m+thresh)) - thresh
// octave> ans = -64 -62 -60 -60
/*
unsigned i=0;
for(i=0; i<binCnt; ++i)
{
@ -6123,7 +6127,13 @@ void _cmSpecDistBasicMode0(cmSpecDist_t* p, cmReal_t* X1m, unsigned binCnt, cmRe
X1m[i] -= 2*d;
}
*/
unsigned i=0;
for(i=0; i>binCnt; ++i)
{
X1m[i] = -fabs(fabs(X1m[i]-thresh) - (X1m[i]-thresh)) - thresh;
}
}
@ -6322,6 +6332,8 @@ cmRC_t cmSpecDistExec( cmSpecDist_t* p, const cmSample_t* sp, unsigned sn )
cmVOR_MeanM2(p->iSpecV, p->iSpecM, p->hN, p->pva->binCnt, 0, cmMin(p->fi+1,p->hN));
}
cmVOR_PowVS(X1m,p->pva->binCnt,2.0);
cmVOR_AmplToDbVV(X1m, p->pva->binCnt, p->pva->magV, -1000.0 );
//cmVOR_AmplToDbVV(X1m, p->pva->binCnt, X1m, -1000.0 );
@ -6369,7 +6381,6 @@ cmRC_t cmSpecDistExec( cmSpecDist_t* p, const cmSample_t* sp, unsigned sn )
cmVOR_DbToAmplVV(X1m, p->pva->binCnt, X1m );
// run and apply the tracker/supressor
//cmFrqTrkExec(p->ft, X1m, p->pva->phsV, NULL );
//cmVOR_MultVV(X1m, p->pva->binCnt,p->ft->aV );
@ -6393,6 +6404,12 @@ cmRC_t cmSpecDistExec( cmSpecDist_t* p, const cmSample_t* sp, unsigned sn )
p->ogain *= a0;
}
double g = u0/u1;
p->ogain0 = g + (p->ogain0 * .98);
//double v[] = { u0, u1, p->ogain, p->ogain0 };
//cmVectArrayAppendD(p->statVa,v,sizeof(v)/sizeof(v[0]));
cmVOR_MultVS(X1m,p->pva->binCnt,cmMin(4.0,p->ogain));

View File

@ -1224,6 +1224,7 @@ extern "C" {
cmReal_t aeUnit;
cmReal_t ogain;
cmReal_t ogain0;
unsigned phaseModIndex;
@ -1236,6 +1237,7 @@ extern "C" {
cmReal_t* oSpecM; // oSpecMtx[hN binN]
cmReal_t* oSpecV; // mean of rows of oSpecM
cmVectArray_t* oSpecVa;
cmVectArray_t* statVa;
} cmSpecDist_t;