Bläddra i källkod

cmProc5.h/c : Updated cmGoldSig to use LPF instead of BPF.

master
kevin 8 år sedan
förälder
incheckning
a7f82c0ffe
2 ändrade filer med 28 tillägg och 3 borttagningar
  1. 26
    2
      cmProc5.c
  2. 2
    1
      cmProc5.h

+ 26
- 2
cmProc5.c Visa fil

@@ -209,6 +209,8 @@ void _cmGoldSigModulate( cmGoldSig_t* p, unsigned chIdx )
209 209
 cmGoldSig_t* cmGoldSigAlloc( cmCtx* ctx, cmGoldSig_t* p, const cmGoldSigArg_t* a )
210 210
 {
211 211
   cmGoldSig_t* op = cmObjAlloc(cmGoldSig_t,ctx,p);
212
+
213
+  p->fir = cmFIRAllocKaiser(ctx, NULL, 0, 0, 0, 0, 0, 0, 0 );
212 214
   
213 215
   if( a != NULL )  
214 216
     if( cmGoldSigInit(op,a) != cmOkRC )
@@ -236,7 +238,8 @@ cmRC_t cmGoldSigFree( cmGoldSig_t** pp )
236 238
     cmMemFree(p->ch[i].bbV);
237 239
     cmMemFree(p->ch[i].mdV);
238 240
   }
239
-  
241
+
242
+  cmFIRFree(&p->fir);
240 243
   cmMemFree(p->ch);
241 244
   cmMemFree(p->rcosV);
242 245
   cmMemFree(p->pnM);
@@ -270,6 +273,27 @@ cmRC_t cmGoldSigInit( cmGoldSig_t* p, const cmGoldSigArg_t* a )
270 273
   // generate the rcos impulse response
271 274
   _cmGoldSigRaisedCos(p->rcosV,p->rcosN,a->samplesPerChip,a->rcosBeta);
272 275
 
276
+  if(1)
277
+  {
278
+    double   passHz = 20000.0;
279
+    double   stopHz = 17000.0;
280
+    double   passDb = 1.0;
281
+    double   stopDb = 90.0;
282
+    unsigned flags  = 0;
283
+    
284
+    if( cmFIRInitKaiser(p->fir, 64, a->srate, passHz, stopHz, passDb, stopDb, flags ) != cmOkRC )
285
+    {
286
+      rc = cmCtxRtCondition(&p->obj,cmSubSysFailRC,"Unable to allocate internal FIR.");
287
+      goto errLabel;
288
+    }
289
+
290
+    p->rcosN = p->fir->coeffCnt;
291
+    p->rcosV = cmMemResizeZ(cmSample_t,p->rcosV,p->rcosN);
292
+    cmVOS_CopyD(p->rcosV,p->rcosN,p->fir->coeffV);
293
+    
294
+  }
295
+  
296
+
273 297
   // for each channel
274 298
   for(i=0; i<a->chN; ++i)
275 299
   {
@@ -294,7 +318,7 @@ cmRC_t cmGoldSigInit( cmGoldSig_t* p, const cmGoldSigArg_t* a )
294 318
 }
295 319
 
296 320
 cmRC_t cmGoldSigFinal( cmGoldSig_t* p )
297
-{ return cmOkRC; }
321
+{ return cmFIRFinal(p->fir); }
298 322
 
299 323
 cmRC_t cmGoldSigWrite( cmCtx* ctx, cmGoldSig_t* p, const char* fn )
300 324
 {

+ 2
- 1
cmProc5.h Visa fil

@@ -73,7 +73,8 @@ extern "C" {
73 73
     cmSample_t*    rcosV;       // rcosV[rcosN] raised cosine impulse response
74 74
     unsigned       rcosN;       // length of raised cosine impulse response
75 75
     unsigned       mlsN;        // length of Gold codes (Maximum length sequence length)
76
-    unsigned       sigN;        // length of channel signals bbV[] and mdV[]  
76
+    unsigned       sigN;        // length of channel signals bbV[] and mdV[]
77
+    cmFIR*         fir;
77 78
   } cmGoldSig_t;
78 79
 
79 80
 

Laddar…
Avbryt
Spara