Back to C-ASPT Contents Page
asptMvsslms32f
API Summary
API to create and delete an asptMvsslms32f filters
- DT32S mvsslms32fInit (asptMvsslms32f *mvsslms,DT32S L, DT32F mu, DT32F minMu, DT32F maxMu, DT32S SF)
- DT32S mvsslms32fInitStatic(asptMvsslms32f *mvsslms,DT32S L, DT32F mu, DT32F minMu, DT32F maxMu, DT32S SF, DT32F *pCof, DT32F *pDat)
- void mvsslms32fFree(asptMvsslms32f *mvsslms)
API to filter through and update an asptMvsslms32f filters
API to retrieve the properties of an asptMvsslms32f filter
API to set the properties of an asptMvsslms32f filter
- DT32S mvsslms32fReset(asptMvsslms32f *mvsslms)
- DT32S mvsslms32fResetDelayLine(asptMvsslms32f *mvsslms)
- DT32S mvsslms32fResize(asptMvsslms32f *mvsslms, DT32S newLength)
- DT32S mvsslms32fSetCoef(asptMvsslms32f *mvsslms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S mvsslms32fSetDelayLine(asptMvsslms32f *mvsslms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- mvsslms32fSetStepSize( asptMvsslms32f
*mvsslms32f, newStep )
- mvsslms32fSetMinStepSize( asptMvsslms32f
*mvsslms32f, a )
- mvsslms32fSetMaxStepSize( asptMvsslms32f
*mvsslms32f, b )
- mvsslms32fSetSignFlag( asptMvsslms32f
*mvsslms32f, c )
Description
Implements the Modified Variable Step Size LMS adaptive filter algorithm. This algorithm uses a single variable step size, unlike the VSSLMS algorithm that uses a vector of L variable step sizes.
Copyright
Copyright (c) DSP ALGORITHMS 2003; all rights reserved.
<< Back to top
mvsslms32fInit
DT32S mvsslms32fInit (asptMvsslms32f *mvsslms,DT32S L, DT32F mu, DT32F minMu, DT32F maxMu, DT32S SF)
Initializes an asptMvsslms32f filter and allocates its necessary storage buffers. - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- mvsslms : asptMvsslms32f filter to be initialized
- L : number of filter coefficients
- mu : initial step size.
- minMu : lower bound for stepSize
- maxMu : higher bound for stepSize.
- SF : if 1, sign-sign algorithm is used to update the stepSize
- Error Conditions
- ASPT_NO_ERR : Initialization is successful
- ASPT_RANGE_ERR : L/minMu/maxMu is not a valid input value
- ASPT_NO_MEM_ERR : could not allocate memory
<< Back to top
mvsslms32fInitStatic
DT32S mvsslms32fInitStatic(asptMvsslms32f *mvsslms,DT32S L, DT32F mu, DT32F minMu, DT32F maxMu, DT32S SF, DT32F *pCof, DT32F *pDat)
Initializes an asptMvsslms32f filter to use pre-allocated memory. - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- mvsslms : asptMvsslms32f filter to be initialized
- L : number of filter coefficients
- mu : initial step size
- minMu : lower bound for stepSize
- maxMu : higher bound for stepSize
- SF : if 1, sign-sign algorithm is used to update the stepSize
- 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_RANGE_ERR : L/minMu/maxMu is not a valid input value
- ASPT_NULL_PTR_ERR : pDat/pCof is a NULL pointer
<< Back to top
mvsslms32fFilterUpdate
DT32F mvsslms32fFilterUpdate(asptMvsslms32f *mvsslms, DT32F inp, DT32F des)
Calculates the filter output and updates the coefficients vector according to the Modified Variable Step Size LMS algorithm. - Returns :
-
The filter output sample.
- Input Parameters :
- mvsslms : pointer to the asptMvsslms32f filter
- inp : new input sample.
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling mvsslms32fGetLastErrorSample().
<< Back to top
mvsslms32fFilterOnly
DT32F mvsslms32fFilterOnly (asptMvsslms32f *mvsslms, DT32F inp)
Calculates the filter output but does not updates the coefficients. - Returns :
-
The filter output sample.
- Input Parameters :
- mvsslms : pointer to the asptMvsslms32f filter
- inp : new input sample.
- Remarks :
-
error sample is not calculated.
<< Back to top
mvsslms32fLCFilterUpdate
DT32F mvsslms32fLCFilterUpdate(asptMvsslms32f *mvsslms, DT32F des)
Calculates the filter output and updates the coefficients vector according to the Variable Step Size LMS algorithm for the Linear Combiner filter configuration. Assumes the delay line has been already updated externally before calling this function. - Returns :
-
The filter output sample.
- Input Parameters :
- mvsslms : pointer to the asptMvsslms32f filter
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling mvsslms32fGetLastErrorSample().
<< Back to top
mvsslms32fLCFilterOnly
DT32F mvsslms32fLCFilterOnly (asptMvsslms32f *mvsslms)
Calculates the filter output but does not updates the coefficients for the Linear Combiner filter configuration. Assumes the delay line has been already updated externally before calling this function. - Returns :
-
The filter output sample.
- Input Parameters :
- mvsslms : pointer to the asptMvsslms32f filter
- Remarks :
-
error sample is not calculated.
<< Back to top
mvsslms32fFree
void mvsslms32fFree(asptMvsslms32f *mvsslms)
Frees the allocated memory for this mvsslms filter. - Returns :
- Input Parameters :
- mvsslms : pointer to the asptMvsslms32f filter
- Remarks :
-
Use this function only with filters created with mvsslms32fInit(). Do not use with asptMvsslms32f filters created using mvsslms32fInitStatic().
<< Back to top
mvsslms32fReset
DT32S mvsslms32fReset(asptMvsslms32f *mvsslms)
Resets all filter coefficients to zero.- Returns :
- Input Parameters :
- mvsslms : pointer to an asptMvsslms32f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
mvsslms32fResetDelayLine
DT32S mvsslms32fResetDelayLine(asptMvsslms32f *mvsslms)
Resets all internal delay lines to zero.- Returns :
- Input Parameters :
- mvsslms : pointer to an asptMvsslms32f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
mvsslms32fGetCoef
DT32S mvsslms32fGetCoef(asptMvsslms32f *mvsslms, 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 :
- mvsslms : pointer to an asptMvsslms32f 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/mvsslms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
mvsslms32fSetCoef
DT32S mvsslms32fSetCoef(asptMvsslms32f *mvsslms, 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 :
- mvsslms : pointer to an asptMvsslms32f 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/mvsslms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
mvsslms32fGetDelayLine
DT32S mvsslms32fGetDelayLine(asptMvsslms32f *mvsslms, 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 :
- mvsslms : pointer to the asptMvsslms32f 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/mvsslms->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
mvsslms32fSetDelayLine
DT32S mvsslms32fSetDelayLine(asptMvsslms32f *mvsslms, 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 :
- mvsslms : pointer to an asptMvsslms32f 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 :
- mvsslms->delayLine is updated
- Error Conditions
- ASPT_NULL_PTR_ERR : newBuf/mvsslms->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
mvsslms32fResize
DT32S mvsslms32fResize(asptMvsslms32f *mvsslms, DT32S newLength)
Resizes an asptMvsslms32f filter keeping as much of the filter state as possible. - Returns :
- Input Parameters :
- mvsslms : pointer to the asptMvsslms32f filter to be resized.
- newLen : required new filter length.
- Error Conditions
- ASPT_NO_ERR : Resizing is success
- ASPT_NULL_PTR_ERR : NULL pointer error
- ASPT_RANGE_ERR : newLength 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 asptMvsslms32f filters.