Back to C-ASPT Contents Page
asptBlms32f
API Summary
API to create and delete an asptBlms32f filters
API to filter through and update an asptBlms32f filters
- DT32S blms32fFilterUpdate (asptBlms32f *blms, DT32F *inp, DT32F *des, DT32F *out, DT32F *err)
- DT32S blms32fFilterUpdateSignErr (asptBlms32f *blms, DT32F *inp, DT32F *des, DT32F *out, DT32F *err)
- DT32S blms32fFilterUpdateSignReg (asptBlms32f *blms, DT32F *inp, DT32F *des, DT32F *out, DT32F *err)
- DT32S blms32fFilterUpdateSignSign(asptBlms32f *blms, DT32F *inp, DT32F *des, DT32F *out, DT32F *err)
- DT32S blms32fFilterOnly (asptBlms32f *blms, DT32F *inp, DT32F *out)
API to retrieve the properties of an asptBlms32f filter
API to set the properties of an asptBlms32f filter
- DT32S blms32fReset(asptBlms32f *blms)
- DT32S blms32fResetDelayLine(asptBlms32f *blms)
- DT32S blms32fResize(asptBlms32f *blms, DT32S newL, DT32S newB)
- DT32S blms32fSetCoef(asptBlms32f *blms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S blms32fSetDelayLine(asptBlms32f *blms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- blms32fSetStepSize( asptBlms32f
*blms, newStep )
- blms32fSetBlockLength( asptBlms32f
*blms, newBlock )
Description
Implements the Block Least Mean Squares (BLMS) adaptive filter algorithm.
Copyright
Copyright (c) DSP ALGORITHMS 2003; all rights reserved.
<< Back to top
blms32fInit
DT32S blms32fInit (asptBlms32f *blms,DT32S L, DT32S B, DT32F mu)
Initializes an asptBlms32f filter and allocates its necessary storage buffers. - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- blms : asptBlms32f filter to be initialized
- L : number of filter coefficients
- B : block length; new input samples per block
- mu : step size.
- Error Conditions
- ASPT_NO_ERR : Initialization is successful
- ASPT_RANGE_ERR : L/B is not a valid input value
- ASPT_NO_MEM_ERR : could not allocate memory
<< Back to top
blms32fInitStatic
DT32S blms32fInitStatic(asptBlms32f *blms,DT32S L, DT32S B, DT32F mu, DT32F *pCof, DT32F *pDat)
Initializes an asptBlms32f filter to use pre-allocated memory. - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- blms : asptBlms32f filter to be initialized
- L : number of filter coefficients
- B : block length, number of new samples per block
- mu : step size.
- pCof : pointer to a pre-allocated memory block to be used
for the adaptive filter coefficients. At least L memory locations must be available starting at this memory address.
- pDat : pointer to a pre-allocated memory block to be used
for data storage. At least L memory locations must be available starting at this memory address
- Error Conditions
- ASPT_NO_ERR : Initialization is successful
- ASPT_NULL_PTR_ERR : pCof/pDat is a NULL pointer
- ASPT_RANGE_ERR : L/B is not a valid input value
- ASPT_NO_MEM_ERR : could not allocate memory
<< Back to top
blms32fFilterUpdate
DT32S blms32fFilterUpdate (asptBlms32f *blms, DT32F *inp, DT32F *des, DT32F *out, DT32F *err)
Calculates the filter output and updates the coefficients vector according to the BLMS algorithm. - Returns :
- Input Parameters :
- blms : pointer to asptBlms32f filter
- inp : array of B new input samples.
- des : array of B new desired samples
- Output Parameters :
- out : array of B filter output samples.
- err : array of B error samples
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
blms32fFilterUpdateSignErr
DT32S blms32fFilterUpdateSignErr (asptBlms32f *blms, DT32F *inp, DT32F *des, DT32F *out, DT32F *err)
Calculates the filter output and updates the coefficients vector according to the Sign Error BLMS algorithm. The sign of the error sample is used in the coefficients update instead of the error value itself. - Returns :
- Input Parameters :
- blms : pointer to asptBlms32f filter
- inp : array of B new input samples.
- des : array of B new desired samples
- Output Parameters :
- out : array of B filter output samples.
- err : array of B error samples
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
blms32fFilterUpdateSignReg
DT32S blms32fFilterUpdateSignReg (asptBlms32f *blms, DT32F *inp, DT32F *des, DT32F *out, DT32F *err)
Calculates the filter output and updates the coefficients vector according to the Sign Regressors BLMS algorithm. The sign of the input sample is used in the coefficients update instead of the input sample value. - Returns :
- Input Parameters :
- blms : pointer to asptBlms32f filter
- inp : array of B new input samples.
- des : array of B new desired samples
- Output Parameters :
- out : array of B filter output samples.
- err : array of B error samples
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
blms32fFilterUpdateSignSign
DT32S blms32fFilterUpdateSignSign(asptBlms32f *blms, DT32F *inp, DT32F *des, DT32F *out, DT32F *err)
Calculates the filter output and updates the coefficients vector according to the Sign-Sign BLMS algorithm. The sign of the error sample as well as the sign of the input sample are used in the coefficients update instead of the error and input values. - Returns :
- Input Parameters :
- blms : pointer to asptBlms32f filter
- inp : array of B new input samples.
- des : array of B new desired samples
- Output Parameters :
- out : array of B filter output samples.
- err : array of B error samples
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
blms32fFilterOnly
DT32S blms32fFilterOnly (asptBlms32f *blms, DT32F *inp, DT32F *out)
Calculates the filter output but does not updates the coefficients. - Returns :
- Input Parameters :
- blms : pointer to asptBlms32f filter
- inp : array of B new input samples.
- Output Parameters :
- out : array of B filter output samples.
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
blms32fFree
void blms32fFree(asptBlms32f *blms)
Frees the allocated memory for this asptBlms32f filter. - Returns :
- Input Parameters :
- blms : pointer to asptBlms32f filter
- Remarks :
-
Use this function only with filters created with blms32fInit(). Do not use with asptBlms32f filters created using blms32fInitStatic().
<< Back to top
blms32fReset
DT32S blms32fReset(asptBlms32f *blms)
Resets all filter coefficients to zero.- Returns :
- Input Parameters :
- blms : pointer to the asptBlms32f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
blms32fResetDelayLine
DT32S blms32fResetDelayLine(asptBlms32f *blms)
Resets all internal delay lines to zero.- Returns :
- Input Parameters :
- blms : pointer to the asptBlms32f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
blms32fGetCoef
DT32S blms32fGetCoef(asptBlms32f *blms, DT32F *buf, 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 :
- blms : pointer to asptBlms32f 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
- Output Parameters :
- Error Conditions
- ASPT_NULL_PTR_ERR : dstBuf/blms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
blms32fSetCoef
DT32S blms32fSetCoef(asptBlms32f *blms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
Initializes N internal filter coefficients starting from coef[ind] to the contents of newBuf. - Returns :
-
On success returns the number of coefficients initialized, otherwise the error code (negative int).
- Input Parameters :
- blms : pointer to the asptBlms32f 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
- Output Parameters :
- Error Conditions
- ASPT_NULL_PTR_ERR : newCoef/blms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
blms32fGetDelayLine
DT32S blms32fGetDelayLine(asptBlms32f *blms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
Copies N internal delay line samples starting from delayLine[ind] to dstBuf. - Returns :
-
On success returns the number of samples copied, otherwise the error code (negative int).
- Input Parameters :
- blms : pointer to asptBlms32f filter.
- dstBuf : destination buffer.
- ind : index to the first sample to be copied.
- N : number of samples to be copied.
- flip : if not 0, will flip the samples order.
- Output Parameters :
- Error Conditions
- ASPT_NULL_PTR_ERR : dstBuf/blms->delayLine is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
- Remarks :
-
Samples are stored in dstBuf with newest sample at index 0, and oldest at index N-1, when flip == 0.
<< Back to top
blms32fSetDelayLine
DT32S blms32fSetDelayLine(asptBlms32f *blms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
Initializes N internal delay line samples starting from delayLine[ind] to the contents of the given array. - Returns :
-
On success returns the number of samples initialized, otherwise the error code (negative int).
- Input Parameters :
- blms : pointer to asptBlms32f filter.
- newBuf : new data buffer.
- ind : index to the first sample to be copied.
- N : number of samples to be copied.
- flip : if not 0, will flip the samples order.
- Output Parameters :
- blms->delayLine is updated
- Error Conditions
- ASPT_NULL_PTR_ERR : newBuf/blms->delayLine is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
- Remarks :
-
Samples assumed to be stored in newBuf with newest sample at index 0, and oldest at index N-1, when flip == 0.
<< Back to top
blms32fResize
DT32S blms32fResize(asptBlms32f *blms, DT32S newL, DT32S newB)
Resizes an asptBlms32f filter keeping as much of the filter state as possible. - Returns :
- Input Parameters :
- blms : pointer to the asptBlms32f filter to be resized.
- newL : required new filter length
- newB : required new block length
- Error Conditions
- ASPT_NO_ERR : Resizing is success
- ASPT_NULL_PTR_ERR : NULL pointer error
- ASPT_RANGE_ERR : newL/newB 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 asptBlms32f filters.