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

This commit is contained in:
kevin 2015-08-07 18:32:04 -04:00
parent 28d2de022a
commit a7f82c0ffe
2 changed files with 28 additions and 3 deletions

View File

@ -210,6 +210,8 @@ cmGoldSig_t* cmGoldSigAlloc( cmCtx* ctx, cmGoldSig_t* p, const cmGoldSigArg_t* a
{ {
cmGoldSig_t* op = cmObjAlloc(cmGoldSig_t,ctx,p); cmGoldSig_t* op = cmObjAlloc(cmGoldSig_t,ctx,p);
p->fir = cmFIRAllocKaiser(ctx, NULL, 0, 0, 0, 0, 0, 0, 0 );
if( a != NULL ) if( a != NULL )
if( cmGoldSigInit(op,a) != cmOkRC ) if( cmGoldSigInit(op,a) != cmOkRC )
cmGoldSigFree(&op); cmGoldSigFree(&op);
@ -237,6 +239,7 @@ cmRC_t cmGoldSigFree( cmGoldSig_t** pp )
cmMemFree(p->ch[i].mdV); cmMemFree(p->ch[i].mdV);
} }
cmFIRFree(&p->fir);
cmMemFree(p->ch); cmMemFree(p->ch);
cmMemFree(p->rcosV); cmMemFree(p->rcosV);
cmMemFree(p->pnM); cmMemFree(p->pnM);
@ -270,6 +273,27 @@ cmRC_t cmGoldSigInit( cmGoldSig_t* p, const cmGoldSigArg_t* a )
// generate the rcos impulse response // generate the rcos impulse response
_cmGoldSigRaisedCos(p->rcosV,p->rcosN,a->samplesPerChip,a->rcosBeta); _cmGoldSigRaisedCos(p->rcosV,p->rcosN,a->samplesPerChip,a->rcosBeta);
if(1)
{
double passHz = 20000.0;
double stopHz = 17000.0;
double passDb = 1.0;
double stopDb = 90.0;
unsigned flags = 0;
if( cmFIRInitKaiser(p->fir, 64, a->srate, passHz, stopHz, passDb, stopDb, flags ) != cmOkRC )
{
rc = cmCtxRtCondition(&p->obj,cmSubSysFailRC,"Unable to allocate internal FIR.");
goto errLabel;
}
p->rcosN = p->fir->coeffCnt;
p->rcosV = cmMemResizeZ(cmSample_t,p->rcosV,p->rcosN);
cmVOS_CopyD(p->rcosV,p->rcosN,p->fir->coeffV);
}
// for each channel // for each channel
for(i=0; i<a->chN; ++i) for(i=0; i<a->chN; ++i)
{ {
@ -294,7 +318,7 @@ cmRC_t cmGoldSigInit( cmGoldSig_t* p, const cmGoldSigArg_t* a )
} }
cmRC_t cmGoldSigFinal( cmGoldSig_t* p ) cmRC_t cmGoldSigFinal( cmGoldSig_t* p )
{ return cmOkRC; } { return cmFIRFinal(p->fir); }
cmRC_t cmGoldSigWrite( cmCtx* ctx, cmGoldSig_t* p, const char* fn ) cmRC_t cmGoldSigWrite( cmCtx* ctx, cmGoldSig_t* p, const char* fn )
{ {

View File

@ -74,6 +74,7 @@ extern "C" {
unsigned rcosN; // length of raised cosine impulse response unsigned rcosN; // length of raised cosine impulse response
unsigned mlsN; // length of Gold codes (Maximum length sequence length) unsigned mlsN; // length of Gold codes (Maximum length sequence length)
unsigned sigN; // length of channel signals bbV[] and mdV[] unsigned sigN; // length of channel signals bbV[] and mdV[]
cmFIR* fir;
} cmGoldSig_t; } cmGoldSig_t;