Bläddra i källkod

cmProc5.h : Added cmVectArray's uVa and fVa.

master
kevin 9 år sedan
förälder
incheckning
b1a108abd3
2 ändrade filer med 24 tillägg och 6 borttagningar
  1. 19
    2
      cmProc5.c
  2. 5
    4
      cmProc5.h

+ 19
- 2
cmProc5.c Visa fil

@@ -918,8 +918,11 @@ cmNlmsEc_t* cmNlmsEcAlloc( cmCtx* ctx, cmNlmsEc_t* ap, float mu, unsigned hN, un
918 918
 {
919 919
   cmNlmsEc_t* p = cmObjAlloc(cmNlmsEc_t,ctx,ap);
920 920
 
921
-  // allocate the vect array
921
+  // allocate the vect array's
922
+  p->uVa = cmVectArrayAlloc(ctx, kFloatVaFl );
923
+  p->fVa = cmVectArrayAlloc(ctx, kFloatVaFl );
922 924
   p->eVa = cmVectArrayAlloc(ctx, kFloatVaFl );
925
+   
923 926
   
924 927
   if( mu != 0 )  
925 928
     if( cmNlmsEcInit(p,mu,hN,delayN) != cmOkRC )
@@ -1024,13 +1027,27 @@ cmRC_t      cmNlmsEcExec( cmNlmsEc_t* p, const cmSample_t* xV, const cmSample_t*
1024 1027
 
1025 1028
   }
1026 1029
 
1030
+  cmVectArrayAppendS(p->uVa,xV,xyN);
1031
+  cmVectArrayAppendS(p->fVa,fV,xyN);
1032
+  cmVectArrayAppendS(p->eVa,yV,xyN);
1033
+   
1034
+
1027 1035
   return cmOkRC;
1028 1036
 }
1029 1037
 
1030 1038
 
1031 1039
 cmRC_t      cmNlmsEcWrite( cmNlmsEc_t* p, const cmChar_t* dirStr )
1032 1040
 {
1041
+
1042
+  if( p->uVa != NULL )
1043
+    cmVectArrayWriteDirFn(p->uVa, dirStr, "nlms_unfiltered.va");
1044
+
1045
+  if( p->fVa != NULL )
1046
+    cmVectArrayWriteDirFn(p->fVa, dirStr, "nlms_filtered.va");
1047
+
1033 1048
   if( p->eVa != NULL )
1034
-    cmVectArrayWriteDirFn(p->eVa,dirStr, "nlms_err.va");
1049
+    cmVectArrayWriteDirFn(p->eVa, dirStr, "nlms_out.va");
1050
+
1051
+  
1035 1052
   return cmOkRC;
1036 1053
 }

+ 5
- 4
cmProc5.h Visa fil

@@ -235,10 +235,11 @@ extern "C" {
235 235
     unsigned       hN;          // filter length
236 236
     unsigned       delayN;      // fixed delay to apply to align xV with fV.
237 237
     double*        wV;          // wV[hN] filter weights
238
-    double*        hV;          // hV[hN] filter delay line
239
-    
240
-    unsigned       w0i;
241
-    
238
+    double*        hV;          // hV[hN] filter delay line    
239
+    unsigned       w0i;         // The index into hV[] of the start of the delay line.
240
+
241
+    cmVectArray_t* uVa;
242
+    cmVectArray_t* fVa;
242 243
     cmVectArray_t* eVa;
243 244
   } cmNlmsEc_t;
244 245
 

Laddar…
Avbryt
Spara