Back to C-ASPT Contents Page
asptGpbfdaf32f
API Summary
API to create and delete asptGpbfdaf32f filters
- DT32S gpbfdaf32fInit(asptGpbfdaf32f *gpbfdaf,DT32S M,DT32S L,DT32S N,DT32F mu,DT32S cs,DT32S *ip,DT32F *w)
- DT32S gpbfdaf32fInitStatic(asptGpbfdaf32f *gpbfdaf,DT32S M,DT32S L,DT32S N,DT32F mu,DT32S cs,DT32F *pCof,DT32F *pDat,DT32S *ip,DT32F *w)
- void gpbfdaf32fFree(asptGpbfdaf32f *gpbfdaf)
API to filter and update asptGpbfdaf32f filters
API to retrieve the properties of asptGpbfdaf32f filters
- DT32S gpbfdaf32fGetCoef(asptGpbfdaf32f *gpbfdaf, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
- gpbfdaf32fGetCoefPtr( asptGpbfdaf32f
*gpbfdaf )
- gpbfdaf32fGetFilterLength( asptGpbfdaf32f
*gpbfdaf )
- gpbfdaf32fGetBlockLength( asptGpbfdaf32f
*gpbfdaf )
- gpbfdaf32fGetFftLength( asptGpbfdaf32f
*gpbfdaf )
- gpbfdaf32fGetStepSize( asptGpbfdaf32f
*gpbfdaf )
- gpbfdaf32fGetConstrain( asptGpbfdaf32f
*gpbfdaf )
- gpbfdaf32fGetPartitions( asptGpbfdaf32f
*gpbfdaf )
- gpbfdaf32fGetRatio( asptGpbfdaf32f
*gpbfdaf )
API to set the properties of asptGpbfdaf32f filters
Description
Implements the Generalized Partitioned Block Frequency Domain Adaptive Filter (GPBFDAF). This version is more general than PBFDAF in that the filter length is not restricted to be equal to the block length. The filter length must be a multiple integer of the block length.
Copyright
Copyright (c) DSP ALGORITHMS 2003; all rights reserved.
<< Back to top
gpbfdaf32fInit
DT32S gpbfdaf32fInit(asptGpbfdaf32f *gpbfdaf,DT32S M,DT32S L,DT32S N,DT32F mu,DT32S cs,DT32S *ip,DT32F *w)
Initializes an asptGpbfdaf32f filter and allocates its necessary storage buffers - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- gpbfdaf : pointer to the asptGpbfdaf32f filter to be initialized
- M : number of filter coefficients per partition
- L : block length (number of new samples each block)
- N : number of partitions
- mu : step size.
- cs : constrained (1) or unconstrained (0) filter.
- ip : fft bit reversal table
- w : fft twiddle factor table.
- Output Parameters :
- gpbfdaf is initialized using the given input arguments.
- Error Conditions
- ASPT_NO_ERR : Initialization is successful
- ASPT_NULL_PTR_ERR : ip/w is a NULL pointer
- ASPT_RANGE_ERR : L/M/N is not a valid input value
- ASPT_NO_MEM_ERR : could not allocate memory
<< Back to top
gpbfdaf32fInitStatic
DT32S gpbfdaf32fInitStatic(asptGpbfdaf32f *gpbfdaf,DT32S M,DT32S L,DT32S N,DT32F mu,DT32S cs,DT32F *pCof,DT32F *pDat,DT32S *ip,DT32F *w)
Initializes an asptGpbfdaf32f filter to use pre-allocated memory blocks - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- gpbfdaf : pointer to the asptGpbfdaf32f to be initialized
- M : number of filter coefficients per partition
- L : block length (number of new samples each block)
- N : number of partitions
- mu : step size.
- cs : constrained (1) or unconstrained (0) filter.
- pCof : pointer to a pre-allocated memory in program memory
of at least [N*fftLength] DT32F locations to be used for the filter coefficients.
- pDat : pointer to a pre-allocated memory in data memory of at least
[C1 + (G+2)*fftLength + (fftLength/2+1)] DT32F locations to be used for data storage.
- ip : fft bit reversal table
- w : fft twiddle factor table.
- Output Parameters :
- gpbfdaf is initialized using the given input arguments.
- Error Conditions
- ASPT_NO_ERR : Initialization is successful
- ASPT_NULL_PTR_ERR : ip/w is a NULL pointer
- ASPT_RANGE_ERR : L/M is not a valid input value
- ASPT_NO_MEM_ERR : could not allocate memory
- Remarks :
-
fftLength = 2^(nextpow2(L+M-1)). C1 = fftLength - blockLength. G = (N-1)*(M/L)+1
<< Back to top
gpbfdaf32fFilterUpdate
DT32S gpbfdaf32fFilterUpdate(asptGpbfdaf32f *gpbfdaf, DT32F *inp, DT32F *des, DT32F *out, DT32F *err)
Calculates the filter output and updates the filter coefficients for the asptGpbfdaf32f filter.- Returns :
- Input Parameters :
- gpbfdaf : asptGpbfdaf32f filter to be processed
- inp : pointer to the new block of input samples
- des : pointer to the new block of desired signal samples
- Output Parameters :
- out : pointer to an array to store the filter output samples
- err : pointer to store the error (des - out) samples.
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
gpbfdaf32fFilterOnly
DT32S gpbfdaf32fFilterOnly(asptGpbfdaf32f *gpbfdaf, DT32F *inp, DT32F *out)
Calculates the filter output but does not update the filter coefficients for the asptGpbfdaf32f filter. It also updates the internal buffers and power estimate.- Returns :
- Input Parameters :
- gpbfdaf : asptGpbfdaf32f filter to be processed
- inp : pointer to the new block of input samples
- Output Parameters :
- out : pointer to an array to store the filter output samples
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
gpbfdaf32fFree
void gpbfdaf32fFree(asptGpbfdaf32f *gpbfdaf)
Frees the allocated memory for this asptGpbfdaf32f filter. - Returns :
- Input Parameters :
- gpbfdaf : pointer to this asptGpbfdaf32f filter
- Remarks :
-
Use this function only with filters created with gpbfdaf32fInit(). Do not use with asptGpbfdaf32f filters created using gpbfdaf32fInitStatic().
<< Back to top
gpbfdaf32fReset
DT32S gpbfdaf32fReset(asptGpbfdaf32f *gpbfdaf)
Resets all filter coefficients to zero.- Returns :
- Input Parameters :
- gpbfdaf : pointer to an asptGpbfdaf32f filter to be reset.
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
gpbfdaf32fResetDelayLine
DT32S gpbfdaf32fResetDelayLine(asptGpbfdaf32f *gpbfdaf)
Resets the internal delay line to zeros.- Returns :
- Input Parameters :
- gpbfdaf : pointer to an asptGpbfdaf32f filter to be reset.
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
gpbfdaf32fGetCoef
DT32S gpbfdaf32fGetCoef(asptGpbfdaf32f *gpbfdaf, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
Copies N internal filter coefficients starting from coef[ind] to dstBuf. - Returns :
-
On success returns the number of coefficients copied, otherwise the error code (negative int).
- Input Parameters :
- gpbfdaf : pointer to an asptGpbfdaf32f filter.
- dstBuf : destination buffer.
- ind : index to the first coefficient to be copied.
- N : number of coefficients to be copied.
- flip : if not 0, will flip the coefficients order.
- Error Conditions
- ASPT_NULL_PTR_ERR : dstBuf/gpbfdaf->wFreq is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
gpbfdaf32fSetCoef
DT32S gpbfdaf32fSetCoef(asptGpbfdaf32f *gpbfdaf, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
Initializes N internal (time domain) filter coefficients starting from coef[ind] to the contents of newCoef. - Returns :
-
On success returns the number of coefficients copied, otherwise the error code (negative int).
- Input Parameters :
- gpbfdaf : pointer to an asptGpbfdaf32f filter to be set.
- newCoef : new coefficients vector.
- ind : index to the first coefficient to be set.
- N : number of coefficients to be set.
- flip : if not 0, will copy the coefficients in reverse order.
- Error Conditions
- ASPT_NULL_PTR_ERR : newCoef/gpbfdaf->wFreq is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
gpbfdaf32fResize
DT32S gpbfdaf32fResize(asptGpbfdaf32f *gpbfdaf, DT32S newLen, DT32S newBlock, DT32S newPart)
Resizes an asptGpbfdaf32f filter keeping as much of the filter state as possible. - Returns :
- Input Parameters :
- gpbfdaf : pointer to the asptGpbfdaf32f filter to be resized.
- newLen : required new filter length
- newBlock : new block length
- newPart : new number of partitions.
- Error Conditions
- ASPT_NO_ERR : Resizing is successful
- ASPT_NULL_PTR_ERR : NULL pointer error
- ASPT_RANGE_ERR : newLength/newBlock/newPart is not a valid input value
- ASPT_NO_MEM_ERR : Could not allocate the necessary filter storage
- Remarks :
-
Use this function only with dynamically allocated asptGpbfdaf32f filters.