Back to C-ASPT Contents Page
asptFxlms32f
API Summary
API to create and delete an asptFxlms32f filters
- DT32S fxlms32fInit (asptFxlms32f *fxlms,DT32S L, DT32F mu, DT32F *sPath, DT32S sL, DT32F *sPathEst, DT32S seL)
- DT32S fxlms32fInitStatic(asptFxlms32f *fxlms,DT32S L, DT32F mu, DT32F *sPath, DT32S sL, DT32F *sPathEst, DT32S seL, DT32F *pCof, DT32F *pDat)
- void fxlms32fFree(asptFxlms32f *fxlms)
API to filter through and update an asptFxlms32f filters
API to retrieve the properties of an asptFxlms32f filter
API to set the properties of an asptFxlms32f filter
- DT32S fxlms32fReset(asptFxlms32f *fxlms)
- DT32S fxlms32fResetDelayLine(asptFxlms32f *fxlms)
- DT32S fxlms32fResize(asptFxlms32f *fxlms, DT32S newLength)
- DT32S fxlms32fSetCoef(asptFxlms32f *fxlms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S fxlms32fSetDelayLine(asptFxlms32f *fxlms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- fxlms32fSetStepSize( asptFxlms32f
*fxlms, newStep )
- fxlms32fSetSecPathPtr( asptFxlms32f
*fxlms, newPtr )
- fxlms32fSetEstSecPathPtr( asptFxlms32f
*fxlms, newPtr )
- fxlms32fSetSecPathLength( asptFxlms32f
*fxlms, newLength )
- fxlms32fSetEstSecPathLength( asptFxlms32f
*fxlms, newLength )
Description
Implements the Filtered-X algorithm. This version is intended for simulation purposes only. Use asptRtfxlms filters for real-time applications.
Copyright
Copyright (c) DSP ALGORITHMS 2003; all rights reserved.
<< Back to top
fxlms32fInit
DT32S fxlms32fInit (asptFxlms32f *fxlms,DT32S L, DT32F mu, DT32F *sPath, DT32S sL, DT32F *sPathEst, DT32S seL)
Initializes an asptFxlms32f filter and allocates its necessary storage buffers. - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- fxlms : asptFxlms32f filter to be initialized
- L : number of filter coefficients
- mu : step size.
- sPath : pointer to the real secondary path FIR response
- sL : length of the secondary path response sPath
- sPathEst : pointer to the estimated secondary path FIR response
- seL : length of the estimated secondary path response sPathEst
- Error Conditions
- ASPT_NO_ERR : Initialization is successful
- ASPT_NULL_PTR_ERR : sPath/sPathEst is a NULL pointer
- ASPT_RANGE_ERR : L/sL/seL is not a valid input value
- ASPT_NO_MEM_ERR : could not allocate memory
<< Back to top
fxlms32fInitStatic
DT32S fxlms32fInitStatic(asptFxlms32f *fxlms,DT32S L, DT32F mu, DT32F *sPath, DT32S sL, DT32F *sPathEst, DT32S seL, DT32F *pCof, DT32F *pDat)
Initializes an asptFxlms32f filter to use pre-allocated memory. - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- fxlms : asptFxlms32f filter to be initialized
- L : number of filter coefficients
- mu : step size.
- sPath : pointer to the real secondary path FIR response
- sL : length of the secondary path response sPath
- sPathEst : pointer to the estimated secondary path FIR response
- seL : length of the estimated secondary path response sPathEst
- 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 (sL+L+MAX(L,seL)) memory locations must be available starting at this memory address
- Error Conditions
- ASPT_NO_ERR : Initialization is successful
- ASPT_NULL_PTR_ERR : sPath/sPathEst/pCof/pDat is a NULL pointer
- ASPT_RANGE_ERR : L/sL/seL is not a valid input value
- ASPT_NO_MEM_ERR : could not allocate memory
<< Back to top
fxlms32fFilterUpdate
DT32F fxlms32fFilterUpdate(asptFxlms32f *fxlms, DT32F ref, DT32F prim)
Calculates the filter output and updates the coefficients vector according to the FXLMS algorithm. - Returns :
-
The filter output measured at the sensor. That is the filter output filtered through the physical secondary path.
- Input Parameters :
- fxlms : pointer to the asptFxlms32f filter
- ref : new reference sample.
- prim : primary source sample measured at the sensor
- Remarks :
-
The sensor sample can be obtained by calling fxlms32fGetLastSensorSample().
<< Back to top
fxlms32fFilterOnly
DT32F fxlms32fFilterOnly (asptFxlms32f *fxlms, DT32F ref)
Calculates the filter output but does not updates the coefficients. It also updates the input power. - Returns :
-
The filter output measured at the sensor. That is the filter output filtered through the physical secondary path.
- Input Parameters :
- fxlms : pointer to the asptFxlms32f filter
- ref : new reference sample.
- Remarks :
-
sensor sample is not calculated.
<< Back to top
fxlms32fFree
void fxlms32fFree(asptFxlms32f *fxlms)
Frees the allocated memory for this fxlms filter. - Returns :
- Input Parameters :
- fxlms : pointer to the asptFxlms32f filter
- Remarks :
-
Use this function only with filters created with fxlms32fInit(). Do not use with asptFxlms32f filters created using fxlms32fInitStatic().
<< Back to top
fxlms32fReset
DT32S fxlms32fReset(asptFxlms32f *fxlms)
Resets all filter coefficients to zero.- Returns :
- Input Parameters :
- fxlms : pointer to an asptFxlms32f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
fxlms32fResetDelayLine
DT32S fxlms32fResetDelayLine(asptFxlms32f *fxlms)
Resets all internal delay lines to zero.- Returns :
- Input Parameters :
- fxlms : pointer to an asptFxlms32f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
fxlms32fGetCoef
DT32S fxlms32fGetCoef(asptFxlms32f *fxlms, 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 :
- fxlms : pointer to an asptFxlms32f 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/fxlms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
fxlms32fSetCoef
DT32S fxlms32fSetCoef(asptFxlms32f *fxlms, 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 :
- fxlms : pointer to an asptFxlms32f 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/fxlms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
fxlms32fGetDelayLine
DT32S fxlms32fGetDelayLine(asptFxlms32f *fxlms, 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 :
- fxlms : pointer to the asptFxlms32f 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/fxlms->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
fxlms32fSetDelayLine
DT32S fxlms32fSetDelayLine(asptFxlms32f *fxlms, 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 :
- fxlms : pointer to an asptFxlms32f 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 :
- fxlms->delayLine is updated
- Error Conditions
- ASPT_NULL_PTR_ERR : newBuf/fxlms->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
fxlms32fResize
DT32S fxlms32fResize(asptFxlms32f *fxlms, DT32S newLength)
Resizes an asptFxlms32f filter keeping as much of the filter state as possible. - Returns :
- Input Parameters :
- fxlms : pointer to the asptFxlms32f 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 asptFxlms32f filters.