Back to C-ASPT Contents Page
asptSovrls32f
API Summary
API to create and delete an sovFir filters
- DT32S sovrls32fInit (asptSovrls32f *sovrls, DT32S L1, DT32S L2, DT32F mu, DT32F b)
- DT32S sovrls32fInitStatic (asptSovrls32f *sovrls, DT32S L1, DT32S L2, DT32F mu, DT32F b, DT32F *pCof, DT32F *pDat)
- void sovrls32fFree(asptSovrls32f *sovrls)
API to filter through a sovFir filter
API to retrieve the properties of an sovFir objects
- DT32S sovrls32fGetCoef(asptSovrls32f *sovrls, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovrls32fGetLinearCoef(asptSovrls32f *sovrls, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovrls32fGetNonLinearCoef(asptSovrls32f *sovrls, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovrls32fGetNonLinearDelayLine(asptSovrls32f *sovrls, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovrls32fGetLinearDelayLine(asptSovrls32f *sovrls, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- sovrls32fGetCoefPtr( asptSovrls32f
*sovrls )
- sovrls32fGetLinearCoefPtr( asptSovrls32f
*sovrls )
- sovrls32fGetNonLinearCoefPtr( asptSovrls32f
*sovrls )
- sovrls32fGetDelayLinePtr( asptSovrls32f
*sovrls )
- sovrls32fGetLinearDelayLinePtr( asptSovrls32f
*sovrls )
- sovrls32fGetNonLinearDelayLinePtr( asptSovrls32f
*sovrls )
- sovrls32fGetFilterLength( asptSovrls32f
*sovrls )
- sovrls32fGetLinearLength( asptSovrls32f
*sovrls )
- sovrls32fGetNonLinearLength( asptSovrls32f
*sovrls )
- sovrls32fGetLastErrorSample( asptSovrls32f
*sovrls )
- sovrls32fGetForgetFactor( asptSovrls32f
*sovrls )
API to set the properties of an sovFir filter
- DT32S sovrls32fReset(asptSovrls32f *sovrls)
- DT32S sovrls32fResetDelayLine(asptSovrls32f *sovrls)
- DT32S sovrls32fResize(asptSovrls32f *sovrls, DT32S newL1, DT32S newL2)
- DT32S sovrls32fSetCoef(asptSovrls32f *sovrls, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S sovrls32fSetLinearCoef(asptSovrls32f *sovrls, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S sovrls32fSetNonLinearCoef(asptSovrls32f *sovrls, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S sovrls32fSetLinearDelayLine(asptSovrls32f *sovrls, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovrls32fSetNonLinearDelayLine(asptSovrls32f *sovrls, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- sovrls32fSetForgetFactor( asptSovrls32f
*sovrls, newFactor )
Description
Implements the Second Order Volterra RLS non-linear adaptive FIR filter.
Copyright
Copyright (c) DSP ALGORITHMS 2003; all rights reserved.
<< Back to top
sovrls32fInit
DT32S sovrls32fInit (asptSovrls32f *sovrls, DT32S L1, DT32S L2, DT32F mu, DT32F b)
Initializes an asptSovrls32f filter and dynamically allocates its necessary storage buffers.- Returns :
-
Error code. On failure, the filterLength member of the asptSovrls32f filter is set to zero.
- Input Parameters :
- sovrls : pointer to asptSovrls32f filter to be initialized
- L1 : memory length of the linear filter part
- L2 : memory length of the non-linear filter part
- mu : forgetting factor.
- b : small scalar to initialize the auto-correlation matrix inverse
- Output Parameters :
- sovrls is initialized using the given input parameters
- Error Conditions
- ASPT_NO_ERR : Initialization success
- ASPT_RANGE_ERR : L1/L2/b is not a valid filter length
- ASPT_NO_MEM_ERR : Could not allocate the necessary filter storage
<< Back to top
sovrls32fInitStatic
DT32S sovrls32fInitStatic (asptSovrls32f *sovrls, DT32S L1, DT32S L2, DT32F mu, DT32F b, DT32F *pCof, DT32F *pDat)
Initializes an asptSovrls32f filter to use pre-allocated memory blocks and couples the filter to the given filter coefficients.- Returns :
-
Error code. On failure, the filterLength member of the asptSovrls32f filter is set to zero.
- Input Parameters :
- sovrls : pointer to asptSovrls32f filter to be initialized
- L1 : memory length of the linear filter part
- L2 : memory length of the non-linear filter part
- mu : forgetting factor.
- b : small scalar to initialize the auto-correlation matrix inverse
- pCof : pointer to a pre-allocated memory space of length at
least [L1 + rsum(1,L2)]to be used for storing the adaptive filter coefficients
- pDat : pointer to a pre-allocated memory block to be used
for data storage. At least [Ll+Lnl+L+rsum(1,L)] memory locations must be available starting at this memory address
- Output Parameters :
- sovrls is initialized using the given input parameters
- Error Conditions
- ASPT_NO_ERR : Initialization success
- ASPT_NULL_PTR_ERR : pCof/pDat is a NULL pointer
- ASPT_RANGE_ERR : L1/L2/b is not a valid filter length
- ASPT_NO_MEM_ERR : Could not allocate the necessary filter storage
- Remarks :
-
Lnl = rsum(1,L2) = 1 + 2 + ... + L2 Ll = MAX(L1,L2) L = L1 + rsum(1,L2)
<< Back to top
sovrls32fFilterOnly
DT32F sovrls32fFilterOnly (asptSovrls32f *sovrls, DT32F inp)
Calculates the filter output due to input sample inp and updates the internal filter states but does not update the filter coefficients. - Returns :
- Input Parameters :
- sovfir : pointer to the asptSovrls32f filter
- inp : new input sample.
<< Back to top
sovrls32fFilterUpdate
DT32F sovrls32fFilterUpdate (asptSovrls32f *sovrls, DT32F inp, DT32F des)
Calculates the filter output and updates the filter coefficients according to the Second Order Volterra RLS algorithm. - Returns :
- Input Parameters :
- sovfir : pointer to the asptSovrls32f filter
- inp : new input sample
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling sovrls32fGetLastErrorSample().
<< Back to top
sovrls32fFree
void sovrls32fFree(asptSovrls32f *sovrls)
Frees the allocated memory for this asptSovrls32f filter. - Returns :
- Input Parameters :
- sovrls : pointer to the asptSovrls32f filter to be de-allocated
- Remarks :
-
Use this function only with filters created with sovrls32fInit(). Do not use with asptSovrls32f filters created using sovrls32fInitStatic().
<< Back to top
sovrls32fResetDelayLine
DT32S sovrls32fResetDelayLine(asptSovrls32f *sovrls)
Resets all internal filter states to zeros.- Returns :
- Input Parameters :
- sovrls : pointer to an asptSovrls32f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : sovrls->delayLine is a NULL pointer
<< Back to top
sovrls32fReset
DT32S sovrls32fReset(asptSovrls32f *sovrls)
Resets all internal filter coefficients to zeros.- Returns :
- Input Parameters :
- sovrls : pointer to an asptSovrls32f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : sovrls->coef is a NULL pointer
<< Back to top
sovrls32fGetCoef
DT32S sovrls32fGetCoef(asptSovrls32f *sovrls, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
Copies N filter coefficients starting from coef[ind] to dstBuf. - Returns :
-
on success returns the number of coefficients copied, otherwise an error code
- Input Parameters :
- sovrls : pointer to an asptSovrls32f 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/sovrls->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovrls32fGetLinearCoef
DT32S sovrls32fGetLinearCoef(asptSovrls32f *sovrls, DT32F *buf, 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 an error code
- Input Parameters :
- sovrls : pointer to an asptSovrls32f 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/sovrls->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovrls32fGetNonLinearCoef
DT32S sovrls32fGetNonLinearCoef(asptSovrls32f *sovrls, DT32F *buf, 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 an error code
- Input Parameters :
- sovrls : pointer to an asptSovrls32f 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/sovrls->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovrls32fSetCoef
DT32S sovrls32fSetCoef(asptSovrls32f *sovrls, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
Initializes the N filter coefficients starting from coef[ind] to the contents of newCoef.- Returns :
-
on success returns the number of coefficients initialized, otherwise an error code
- Input Parameters :
- sovrls : pointer to an asptSovrls32f 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/sovrls->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovrls32fSetLinearCoef
DT32S sovrls32fSetLinearCoef(asptSovrls32f *sovrls, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
Initializes the N linear filter coefficients starting from coef[ind] to the contents of newCoef.- Returns :
-
on success returns the number of coefficients initialized, otherwise an error code
- Input Parameters :
- sovrls : pointer to an asptSovrls32f 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/sovrls->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovrls32fSetNonLinearCoef
DT32S sovrls32fSetNonLinearCoef(asptSovrls32f *sovrls, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
Initializes the N non-linear filter coefficients starting from coef[ind] to the contents of newCoef.- Returns :
-
on success returns the number of coefficients initialized, otherwise an error code
- Input Parameters :
- sovrls : pointer to an asptSovrls32f 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/sovrls->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovrls32fSetNonLinearDelayLine
DT32S sovrls32fSetNonLinearDelayLine(asptSovrls32f *sovrls, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
Initializes the N non-linear delay line samples starting from delayLine[ind] to the contents of newBuf.- Returns :
-
on success returns the number of coefficients initialized, otherwise an error code
- Input Parameters :
- sovrls : pointer to an asptSovrls32f filter to be set.
- newBuf : 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 : newBuf/sovrls->delayLine is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovrls32fSetLinearDelayLine
DT32S sovrls32fSetLinearDelayLine(asptSovrls32f *sovrls, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
Initializes the N linear delay line samples starting from delayLine[ind] to the contents of newBuf.- Returns :
-
on success returns the number of coefficients initialized, otherwise an error code
- Input Parameters :
- sovrls : pointer to an asptSovrls32f filter to be set.
- newBuf : 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 : newBuf/sovrls->delayLine is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovrls32fGetNonLinearDelayLine
DT32S sovrls32fGetNonLinearDelayLine(asptSovrls32f *sovrls, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
Copies N samples from the internal non-linear delay line starting from delayLine[ind] to dstBuf. - Returns :
-
on success returns the number of samples copied, otherwise an error code
- Input Parameters :
- sovrls : pointer to the asptSovrls32f 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/sovrls->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
sovrls32fGetLinearDelayLine
DT32S sovrls32fGetLinearDelayLine(asptSovrls32f *sovrls, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
Copies N samples from the internal linear delay line starting from delayLine[ind] to dstBuf. - Returns :
-
on success returns the number of samples copied, otherwise an error code
- Input Parameters :
- sovrls : pointer to the asptSovrls32f 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/sovrls->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
sovrls32fResize
DT32S sovrls32fResize(asptSovrls32f *sovrls, DT32S newL1, DT32S newL2)
Resizes an asptSovrls32f filter keeping as much of the filter state as possible. - Returns :
- Input Parameters :
- sovrls : pointer to the asptSovrls32f filter to be resized.
- newL1 : new number of linear coefficients
- newL2 : new non-linear memory length
- Error Conditions
- ASPT_NO_ERR : Resizing is success
- ASPT_NULL_PTR_ERR : NULL pointer error
- ASPT_RANGE_ERR : newL1/newL2 is not a valid filter length
- ASPT_NO_MEM_ERR : Could not allocate the necessary filter storage
- Remarks :
-
Use this function only with dynamically allocated asptSovrls32f filters.