Przeglądaj źródła

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

master
kevin 9 lat temu
rodzic
commit
0cd86b759f
2 zmienionych plików z 22 dodań i 3 usunięć
  1. 20
    3
      cmProc2.c
  2. 2
    0
      cmProc2.h

+ 20
- 3
cmProc2.c Wyświetl plik

@@ -5950,7 +5950,8 @@ cmSpecDist_t* cmSpecDistAlloc( cmCtx* ctx,cmSpecDist_t* ap, unsigned procSmpCnt,
5950 5950
 
5951 5951
   //p->iSpecVa   = cmVectArrayAlloc(ctx,kRealVaFl);
5952 5952
   //p->oSpecVa   = cmVectArrayAlloc(ctx,kRealVaFl);
5953
-
5953
+  p->statVa     = cmVectArrayAlloc(ctx,kDoubleVaFl);
5954
+  
5954 5955
   if( procSmpCnt != 0 )
5955 5956
   {
5956 5957
     if( cmSpecDistInit( p, procSmpCnt, srate, wndSmpCnt, hopFcmt, olaWndTypeId ) != cmOkRC )
@@ -5971,6 +5972,7 @@ cmRC_t cmSpecDistFree( cmSpecDist_t** pp )
5971 5972
   cmSpecDistFinal(p);
5972 5973
   //cmVectArrayFree(&p->iSpecVa);
5973 5974
   //cmVectArrayFree(&p->oSpecVa);
5975
+  cmVectArrayFree(&p->statVa);
5974 5976
   cmMemPtrFree(&p->hzV);
5975 5977
   cmMemPtrFree(&p->iSpecM);
5976 5978
   cmMemPtrFree(&p->oSpecM);
@@ -6095,7 +6097,8 @@ cmRC_t cmSpecDistFinal(cmSpecDist_t* p )
6095 6097
 
6096 6098
   //cmVectArrayWrite(p->iSpecVa, "/home/kevin/temp/frqtrk/iSpec.va");
6097 6099
   //cmVectArrayWrite(p->oSpecVa, "/home/kevin/temp/expand/oSpec.va");
6098
-
6100
+  //cmVectArrayWrite(p->statVa, "/Users/kevin/temp/kc/state.va");
6101
+  
6099 6102
   cmPvAnlFree(&p->pva);
6100 6103
   cmPvSynFree(&p->pvs);
6101 6104
   //cmFrqTrkFree(&p->ft);
@@ -6111,6 +6114,7 @@ void _cmSpecDistBasicMode0(cmSpecDist_t* p, cmReal_t* X1m, unsigned binCnt, cmRe
6111 6114
   // octave> -abs(abs(X1m+thresh)-(X1m+thresh)) - thresh
6112 6115
   // octave> ans = -64  -62  -60  -60
6113 6116
 
6117
+  /*
6114 6118
   unsigned i=0;
6115 6119
   for(i=0; i<binCnt; ++i)
6116 6120
   {
@@ -6123,7 +6127,13 @@ void _cmSpecDistBasicMode0(cmSpecDist_t* p, cmReal_t* X1m, unsigned binCnt, cmRe
6123 6127
       X1m[i] -= 2*d;
6124 6128
 
6125 6129
   }
6130
+  */
6126 6131
 
6132
+  unsigned i=0;
6133
+  for(i=0; i>binCnt; ++i)
6134
+  {
6135
+    X1m[i] = -fabs(fabs(X1m[i]-thresh) - (X1m[i]-thresh)) - thresh;
6136
+  }
6127 6137
 
6128 6138
 }
6129 6139
 
@@ -6322,6 +6332,8 @@ cmRC_t  cmSpecDistExec( cmSpecDist_t* p, const cmSample_t* sp, unsigned sn )
6322 6332
       cmVOR_MeanM2(p->iSpecV, p->iSpecM, p->hN, p->pva->binCnt, 0, cmMin(p->fi+1,p->hN));
6323 6333
     }
6324 6334
 
6335
+    cmVOR_PowVS(X1m,p->pva->binCnt,2.0);
6336
+
6325 6337
     cmVOR_AmplToDbVV(X1m, p->pva->binCnt, p->pva->magV, -1000.0 );
6326 6338
     //cmVOR_AmplToDbVV(X1m, p->pva->binCnt, X1m, -1000.0 );
6327 6339
 
@@ -6369,7 +6381,6 @@ cmRC_t  cmSpecDistExec( cmSpecDist_t* p, const cmSample_t* sp, unsigned sn )
6369 6381
 
6370 6382
     cmVOR_DbToAmplVV(X1m, p->pva->binCnt, X1m );
6371 6383
 
6372
-
6373 6384
     // run and apply the tracker/supressor
6374 6385
     //cmFrqTrkExec(p->ft, X1m, p->pva->phsV, NULL ); 
6375 6386
     //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 )
6393 6404
       p->ogain *= a0;
6394 6405
     }
6395 6406
 
6407
+    double g = u0/u1;
6408
+    p->ogain0 = g + (p->ogain0 * .98);
6409
+
6410
+    //double v[] = { u0, u1, p->ogain, p->ogain0 };
6411
+    //cmVectArrayAppendD(p->statVa,v,sizeof(v)/sizeof(v[0]));
6412
+
6396 6413
     cmVOR_MultVS(X1m,p->pva->binCnt,cmMin(4.0,p->ogain));
6397 6414
 
6398 6415
 

+ 2
- 0
cmProc2.h Wyświetl plik

@@ -1224,6 +1224,7 @@ extern "C" {
1224 1224
     cmReal_t  aeUnit;
1225 1225
 
1226 1226
     cmReal_t ogain;
1227
+    cmReal_t ogain0;
1227 1228
 
1228 1229
     unsigned phaseModIndex;
1229 1230
 
@@ -1236,6 +1237,7 @@ extern "C" {
1236 1237
     cmReal_t*      oSpecM;      // oSpecMtx[hN binN]
1237 1238
     cmReal_t*      oSpecV;      // mean of rows of oSpecM
1238 1239
     cmVectArray_t* oSpecVa;
1240
+    cmVectArray_t* statVa;
1239 1241
 
1240 1242
   } cmSpecDist_t;
1241 1243
 

Ładowanie…
Anuluj
Zapisz