Browse Source

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

master
kevin 9 years ago
parent
commit
0cd86b759f
2 changed files with 22 additions and 3 deletions
  1. 20
    3
      cmProc2.c
  2. 2
    0
      cmProc2.h

+ 20
- 3
cmProc2.c View File

5950
 
5950
 
5951
   //p->iSpecVa   = cmVectArrayAlloc(ctx,kRealVaFl);
5951
   //p->iSpecVa   = cmVectArrayAlloc(ctx,kRealVaFl);
5952
   //p->oSpecVa   = cmVectArrayAlloc(ctx,kRealVaFl);
5952
   //p->oSpecVa   = cmVectArrayAlloc(ctx,kRealVaFl);
5953
-
5953
+  p->statVa     = cmVectArrayAlloc(ctx,kDoubleVaFl);
5954
+  
5954
   if( procSmpCnt != 0 )
5955
   if( procSmpCnt != 0 )
5955
   {
5956
   {
5956
     if( cmSpecDistInit( p, procSmpCnt, srate, wndSmpCnt, hopFcmt, olaWndTypeId ) != cmOkRC )
5957
     if( cmSpecDistInit( p, procSmpCnt, srate, wndSmpCnt, hopFcmt, olaWndTypeId ) != cmOkRC )
5971
   cmSpecDistFinal(p);
5972
   cmSpecDistFinal(p);
5972
   //cmVectArrayFree(&p->iSpecVa);
5973
   //cmVectArrayFree(&p->iSpecVa);
5973
   //cmVectArrayFree(&p->oSpecVa);
5974
   //cmVectArrayFree(&p->oSpecVa);
5975
+  cmVectArrayFree(&p->statVa);
5974
   cmMemPtrFree(&p->hzV);
5976
   cmMemPtrFree(&p->hzV);
5975
   cmMemPtrFree(&p->iSpecM);
5977
   cmMemPtrFree(&p->iSpecM);
5976
   cmMemPtrFree(&p->oSpecM);
5978
   cmMemPtrFree(&p->oSpecM);
6095
 
6097
 
6096
   //cmVectArrayWrite(p->iSpecVa, "/home/kevin/temp/frqtrk/iSpec.va");
6098
   //cmVectArrayWrite(p->iSpecVa, "/home/kevin/temp/frqtrk/iSpec.va");
6097
   //cmVectArrayWrite(p->oSpecVa, "/home/kevin/temp/expand/oSpec.va");
6099
   //cmVectArrayWrite(p->oSpecVa, "/home/kevin/temp/expand/oSpec.va");
6098
-
6100
+  //cmVectArrayWrite(p->statVa, "/Users/kevin/temp/kc/state.va");
6101
+  
6099
   cmPvAnlFree(&p->pva);
6102
   cmPvAnlFree(&p->pva);
6100
   cmPvSynFree(&p->pvs);
6103
   cmPvSynFree(&p->pvs);
6101
   //cmFrqTrkFree(&p->ft);
6104
   //cmFrqTrkFree(&p->ft);
6111
   // octave> -abs(abs(X1m+thresh)-(X1m+thresh)) - thresh
6114
   // octave> -abs(abs(X1m+thresh)-(X1m+thresh)) - thresh
6112
   // octave> ans = -64  -62  -60  -60
6115
   // octave> ans = -64  -62  -60  -60
6113
 
6116
 
6117
+  /*
6114
   unsigned i=0;
6118
   unsigned i=0;
6115
   for(i=0; i<binCnt; ++i)
6119
   for(i=0; i<binCnt; ++i)
6116
   {
6120
   {
6123
       X1m[i] -= 2*d;
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
       cmVOR_MeanM2(p->iSpecV, p->iSpecM, p->hN, p->pva->binCnt, 0, cmMin(p->fi+1,p->hN));
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
     cmVOR_AmplToDbVV(X1m, p->pva->binCnt, p->pva->magV, -1000.0 );
6337
     cmVOR_AmplToDbVV(X1m, p->pva->binCnt, p->pva->magV, -1000.0 );
6326
     //cmVOR_AmplToDbVV(X1m, p->pva->binCnt, X1m, -1000.0 );
6338
     //cmVOR_AmplToDbVV(X1m, p->pva->binCnt, X1m, -1000.0 );
6327
 
6339
 
6369
 
6381
 
6370
     cmVOR_DbToAmplVV(X1m, p->pva->binCnt, X1m );
6382
     cmVOR_DbToAmplVV(X1m, p->pva->binCnt, X1m );
6371
 
6383
 
6372
-
6373
     // run and apply the tracker/supressor
6384
     // run and apply the tracker/supressor
6374
     //cmFrqTrkExec(p->ft, X1m, p->pva->phsV, NULL ); 
6385
     //cmFrqTrkExec(p->ft, X1m, p->pva->phsV, NULL ); 
6375
     //cmVOR_MultVV(X1m, p->pva->binCnt,p->ft->aV );
6386
     //cmVOR_MultVV(X1m, p->pva->binCnt,p->ft->aV );
6393
       p->ogain *= a0;
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
     cmVOR_MultVS(X1m,p->pva->binCnt,cmMin(4.0,p->ogain));
6413
     cmVOR_MultVS(X1m,p->pva->binCnt,cmMin(4.0,p->ogain));
6397
 
6414
 
6398
 
6415
 

+ 2
- 0
cmProc2.h View File

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

Loading…
Cancel
Save