Back to C-ASPT Contents Page
asptSovtdlms32f
API Summary
API to create and delete asptSovtdlms32f filters
- DT32S sovtdlms32fInit(asptSovtdlms32f *sovtdlms,DT32S L1,DT32S L2,DT32F mu,DT32S *ip,DT32F *w)
- DT32S sovtdlms32fInitStatic(asptSovtdlms32f *sovtdlms,DT32S L1,DT32S L2,DT32F mu,DT32F *pCof,DT32F *pDat,DT32S *ip,DT32F *w)
- void sovtdlms32fFree(asptSovtdlms32f *sovtdlms)
API to filter and update asptSovtdlms32f filters
API to retrieve the properties of asptSovtdlms32f filters
- DT32S sovtdlms32fGetCoef(asptSovtdlms32f *sovtdlms, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovtdlms32fGetLinearCoef(asptSovtdlms32f *sovtdlms, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovtdlms32fGetNonLinearCoef(asptSovtdlms32f *sovtdlms, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovtdlms32fGetLinearDelayLine(asptSovtdlms32f *sovtdlms, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovtdlms32fGetNonLinearDelayLine(asptSovtdlms32f *sovtdlms, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
- sovtdlms32fGetLinearDelayLinePtr( asptSovtdlms32f
*sovtdlms )
- sovtdlms32fGetNonLinearDelayLinePtr( asptSovtdlms32f
*sovtdlms )
- sovtdlms32fGetLinearLength( asptSovtdlms32f
*sovtdlms )
- sovtdlms32fGetNonLinearLength( asptSovtdlms32f
*sovtdlms )
- sovtdlms32fGetCoefPtr( asptSovtdlms32f
*sovtdlms )
- sovtdlms32fGetFilterLength( asptSovtdlms32f
*sovtdlms )
- sovtdlms32fGetFftLength( asptSovtdlms32f
*sovtdlms )
- sovtdlms32fGetStepSize( asptSovtdlms32f
*sovtdlms )
- sovtdlms32fGetLastErrorSample( asptSovtdlms32f
*sovtdlms )
API to set the properties of asptSovtdlms32f filters
- DT32S sovtdlms32fReset(asptSovtdlms32f *sovtdlms)
- DT32S sovtdlms32fResetDelayLine(asptSovtdlms32f *sovtdlms)
- DT32S sovtdlms32fResize(asptSovtdlms32f *sovtdlms, DT32S newL1, DT32S newL2)
- DT32S sovtdlms32fSetCoef(asptSovtdlms32f *sovtdlms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S sovtdlms32fSetLinearCoef(asptSovtdlms32f *sovtdlms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S sovtdlms32fSetNonLinearCoef(asptSovtdlms32f *sovtdlms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S sovtdlms32fSetLinearDelayLine(asptSovtdlms32f *sovtdlms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S sovtdlms32fSetNonLinearDelayLine(asptSovtdlms32f *sovtdlms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- sovtdlms32fSetStepSize( asptSovtdlms32f
*sovtdlms, newSs )
Description
Implements the Second Order Volterra Transform-Domain LMS Adaptive Filter (SOVTDLMS) algorithm.
Copyright
Copyright (c) DSP ALGORITHMS 2003; all rights reserved.
<< Back to top
sovtdlms32fInit
DT32S sovtdlms32fInit(asptSovtdlms32f *sovtdlms,DT32S L1,DT32S L2,DT32F mu,DT32S *ip,DT32F *w)
Initializes an asptSovtdlms32f filter and allocates its necessary storage buffers - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- sovtdlms : pointer to asptSovtdlms32f filter to be initialized
- L1 : memory length of the linear filter part
- L2 : memory length of the non-linear filter part
- mu : step size.
- ip : fft bit reversal table
- w : fft twiddle factor table.
- Output Parameters :
- sovtdlms 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 : L1/L2 is not a valid input value
- ASPT_NO_MEM_ERR : could not allocate memory
<< Back to top
sovtdlms32fInitStatic
DT32S sovtdlms32fInitStatic(asptSovtdlms32f *sovtdlms,DT32S L1,DT32S L2,DT32F mu,DT32F *pCof,DT32F *pDat,DT32S *ip,DT32F *w)
Initializes an asptSovtdlms32f filter to use pre-allocated memory blocks - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- sovtdlms : pointer to asptsovtdlms32f filter to be initialized
- L1 : memory length of the linear filter part
- L2 : memory length of the non-linear filter part
- mu : step size.
- pCof : pointer to a pre-allocated memory in program memory
of at least [fftLength] DT32F locations to be used for the filter coefficients.
- pDat : pointer to a pre-allocated memory in data memory of at least
[max(L1,L2)+2*fftLength + 2] DT32F locations to be used for data storage.
- ip : fft bit reversal table
- w : fft twiddle factor table.
- Output Parameters :
- sovtdlms 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-1)).
<< Back to top
sovtdlms32fFilterUpdate
DT32F sovtdlms32fFilterUpdate(asptSovtdlms32f *sovtdlms, DT32F inp, DT32F des)
Calculates the filter output and updates the filter coefficients for the asptSovtdlms32f filter.- Returns :
- Input Parameters :
- sovtdlms : asptSovtdlms32f filter to be processed
- inp : new input sample
- des : new desired sample
- Remarks :
-
Error sample is stored internally and can be obtained by calling sovtdlms32fGetLastErrorSample().
<< Back to top
sovtdlms32fFilterOnly
DT32F sovtdlms32fFilterOnly(asptSovtdlms32f *sovtdlms, DT32F inp)
Calculates the filter output but does not update the filter coefficients for the asptSovtdlms32f filter. It also updates the internal buffers and power estimate.- Returns :
- Input Parameters :
- sovtdlms : asptSovtdlms32f filter to be processed
- inp : pointer to the new block of input samples
- Remarks :
-
Error sample not calculated.
<< Back to top
sovtdlms32fFree
void sovtdlms32fFree(asptSovtdlms32f *sovtdlms)
Frees the allocated memory for this asptSovtdlms32f filter. - Returns :
- Input Parameters :
- sovtdlms : pointer to the asptSovtdlms32f filter
- Remarks :
-
Use this function only with filters created with sovtdlms32fInit(). Do not use with asptSovtdlms32f filters created using sovtdlms32fInitStatic().
<< Back to top
sovtdlms32fReset
DT32S sovtdlms32fReset(asptSovtdlms32f *sovtdlms)
Resets all filter coefficients to zero.- Returns :
- Input Parameters :
- sovtdlms : pointer to an asptsovtdlms32f filter to be reset.
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
sovtdlms32fResetDelayLine
DT32S sovtdlms32fResetDelayLine(asptSovtdlms32f *sovtdlms)
Resets the internal delay line to zeros.- Returns :
- Input Parameters :
- sovtdlms : pointer to an asptSovtdlms32f filter to be reset.
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
sovtdlms32fGetCoef
DT32S sovtdlms32fGetCoef(asptSovtdlms32f *sovtdlms, 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 :
- sovtdlms : pointer to an asptSovtdlms32f 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/sovtdlms->wFreq is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovtdlms32fSetCoef
DT32S sovtdlms32fSetCoef(asptSovtdlms32f *sovtdlms, 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 :
- sovtdlms : pointer to an asptSovtdlms32f 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/sovtdlms->wFreq is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovtdlms32fGetLinearCoef
DT32S sovtdlms32fGetLinearCoef(asptSovtdlms32f *sovtdlms, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
Copies N linear 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 :
- sovtdlms : pointer to an asptSovtdlms32f 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/sovtdlms->wFreq is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovtdlms32fSetLinearCoef
DT32S sovtdlms32fSetLinearCoef(asptSovtdlms32f *sovtdlms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
Initializes N linear (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 :
- sovtdlms : pointer to an asptSovtdlms32f 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/sovtdlms->wFreq is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovtdlms32fGetNonLinearCoef
DT32S sovtdlms32fGetNonLinearCoef(asptSovtdlms32f *sovtdlms, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
Copies N non-linear 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 :
- sovtdlms : pointer to an asptSovtdlms32f 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/sovtdlms->wFreq is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovtdlms32fSetNonLinearCoef
DT32S sovtdlms32fSetNonLinearCoef(asptSovtdlms32f *sovtdlms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
Initializes N nonlinear (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 :
- sovtdlms : pointer to an asptSovtdlms32f 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/sovtdlms->wFreq is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovtdlms32fGetLinearDelayLine
DT32S sovtdlms32fGetLinearDelayLine(asptSovtdlms32f *sovtdlms, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
Copies N samples of the linear delay line, starting from delayLine[ind] to dstBuf. - Returns :
-
On success returns the number of samples copied, otherwise the error code (negative int).
- Input Parameters :
- sovtdlms : pointer to the asptSovtdlms32f 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/sovtdlms->xTime 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
sovtdlms32fSetLinearDelayLine
DT32S sovtdlms32fSetLinearDelayLine(asptSovtdlms32f *sovtdlms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
Initializes N samples of the linear delay line, 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 :
- sovtdlms : pointer to an asptSovtdlms32f 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 :
- sovtdlms->xTime is updated
- Error Conditions
- ASPT_NULL_PTR_ERR : newBuf/sovtdlms->xTime 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
sovtdlms32fGetNonLinearDelayLine
DT32S sovtdlms32fGetNonLinearDelayLine(asptSovtdlms32f *sovtdlms, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
Copies N samples of the non-linear delay line, starting from delayLine[ind] to dstBuf. - Returns :
-
On success returns the number of samples copied, otherwise the error code (negative int).
- Input Parameters :
- sovtdlms : pointer to the asptSovtdlms32f 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/sovtdlms->x2 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
sovtdlms32fSetNonLinearDelayLine
DT32S sovtdlms32fSetNonLinearDelayLine(asptSovtdlms32f *sovtdlms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
Initializes N samples of the non-linear delay line, 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 :
- sovtdlms : pointer to an asptSovtdlms32f 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 :
- sovtdlms->xTime is updated
- Error Conditions
- ASPT_NULL_PTR_ERR : newBuf/sovtdlms->x2 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
sovtdlms32fResize
DT32S sovtdlms32fResize(asptSovtdlms32f *sovtdlms, DT32S newL1, DT32S newL2)
Resizes an asptSovtdlms32f filter keeping as much of the filter state as possible. - Returns :
- Input Parameters :
- sovtdlms : pointer to the asptSovtdlms32f filter to be resized.
- newL1 : required number of zeros coefficients.
- newL2 : required number of poles coefficients.
- Error Conditions
- ASPT_NO_ERR : Resizing is successful
- ASPT_NULL_PTR_ERR : NULL pointer error
- ASPT_RANGE_ERR : newL1/newL2 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 asptSovtdlms32f filters.