Back to C-ASPT Contents Page
asptSovlms32f
API Summary
API to create and delete an sovFir filters
- DT32S sovlms32fInit (asptSovlms32f *sovlms, DT32S L1, DT32S L2, DT32F muL, DT32F muN)
- DT32S sovlms32fInitStatic (asptSovlms32f *sovlms, DT32S L1, DT32S L2, DT32F muL, DT32F muN, DT32F *pCof, DT32F *pDat)
- void sovlms32fFree(asptSovlms32f *sovlms)
API to filter through a sovFir filter
- DT32F sovlms32fFilterOnly(asptSovlms32f *sovlms, DT32F inp)
- DT32S sovlms32fBlockFilter(asptSovlms32f *sovlms, DT32F *inp, DT32F *out, DT32S N)
- DT32F sovlms32fFilterUpdate(asptSovlms32f *sovlms, DT32F inp, DT32F des)
- DT32F sovlms32fFilterUpdateSignErr(asptSovlms32f *sovlms, DT32F inp, DT32F des)
- DT32F sovlms32fFilterUpdateSignReg(asptSovlms32f *sovlms, DT32F inp, DT32F des)
- DT32F sovlms32fFilterUpdateSignSign(asptSovlms32f *sovlms, DT32F inp, DT32F des)
API to retrieve the properties of an sovFir objects
- DT32S sovlms32fGetCoef(asptSovlms32f *sovlms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovlms32fGetLinearCoef(asptSovlms32f *sovlms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovlms32fGetNonLinearCoef(asptSovlms32f *sovlms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovlms32fGetNonLinearDelayLine(asptSovlms32f *sovlms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovlms32fGetLinearDelayLine(asptSovlms32f *sovlms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- sovlms32fGetCoefPtr( asptSovlms32f
*sovlms )
- sovlms32fGetLinearCoefPtr( asptSovlms32f
*sovlms )
- sovlms32fGetNonLinearCoefPtr( asptSovlms32f
*sovlms )
- sovlms32fGetDelayLinePtr( asptSovlms32f
*sovlms )
- sovlms32fGetLinearDelayLinePtr( asptSovlms32f
*sovlms )
- sovlms32fGetNonLinearDelayLinePtr( asptSovlms32f
*sovlms )
- sovlms32fGetFilterLength( asptSovlms32f
*sovlms )
- sovlms32fGetLinearLength( asptSovlms32f
*sovlms )
- sovlms32fGetNonLinearLength( asptSovlms32f
*sovlms )
- sovlms32fGetLastErrorSample( asptSovlms32f
*sovlms )
- sovlms32fGetLinearStepSize( asptSovlms32f
*sovlms )
- sovlms32fGetNonLinearStepSize( asptSovlms32f
*sovlms )
API to set the properties of an sovFir filter
- DT32S sovlms32fReset(asptSovlms32f *sovlms)
- DT32S sovlms32fResetDelayLine(asptSovlms32f *sovlms)
- DT32S sovlms32fResize(asptSovlms32f *sovlms, DT32S newL1, DT32S newL2)
- DT32S sovlms32fSetCoef(asptSovlms32f *sovlms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S sovlms32fSetLinearCoef(asptSovlms32f *sovlms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S sovlms32fSetNonLinearCoef(asptSovlms32f *sovlms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S sovlms32fSetLinearDelayLine(asptSovlms32f *sovlms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovlms32fSetNonLinearDelayLine(asptSovlms32f *sovlms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- sovlms32fSetLinearStepSize( asptSovlms32f
*sovlms, newStep )
- sovlms32fSetNonLinearStepSize( asptSovlms32f
*sovlms, newStep )
Description
Implements the Second Order Volterra LMS non-linear adaptive FIR
filter using circular buffering.
The filter supports sample per sample as well as block processing.
Copyright
Copyright (c) DSP ALGORITHMS 2003; all rights reserved.
<< Back to top
sovlms32fInit
DT32S sovlms32fInit (asptSovlms32f *sovlms, DT32S L1, DT32S L2, DT32F muL, DT32F muN)
Initializes an asptSovlms32f filter and dynamically allocates its
necessary storage buffers.
- Returns :
-
Error code. On failure, the filterLength member of the asptSovlms32f
filter is set to zero.
- Input Parameters :
- sovlms : pointer to asptSovlms32f filter to be initialized
- L1 : memory length of the linear filter part
- L2 : memory length of the non-linear filter part
- muL : step size of the filter linear part
- muN : step size of the filter non-linear part
- Output Parameters :
- sovlms is initialized using the given input parameters
- Error Conditions
- ASPT_NO_ERR : Initialization success
- ASPT_RANGE_ERR : L1/L2 is not a valid filter length
- ASPT_NO_MEM_ERR : Could not allocate the necessary filter storage
<< Back to top
sovlms32fInitStatic
DT32S sovlms32fInitStatic (asptSovlms32f *sovlms, DT32S L1, DT32S L2, DT32F muL, DT32F muN, DT32F *pCof, DT32F *pDat)
Initializes an asptSovlms32f 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 asptSovlms32f
filter is set to zero.
- Input Parameters :
- sovlms : pointer to asptSovlms32f filter to be initialized
- L1 : memory length of the linear filter part
- L2 : memory length of the non-linear filter part
- muL : step size of the filter linear part
- muN : step size of the filter non-linear part
- 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 [max(L1,L2)+rsum(1,L2)]
memory locations must be available starting at this
memory address
- Output Parameters :
- sovlms 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 is not a valid filter length
- ASPT_NO_MEM_ERR : Could not allocate the necessary filter storage
- Remarks :
-
rsum(1,L2) = 1 + 2 + ... + L2
<< Back to top
sovlms32fFilterOnly
DT32F sovlms32fFilterOnly(asptSovlms32f *sovlms, 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 asptSovlms32f filter
- inp : new input sample.
<< Back to top
sovlms32fBlockFilter
DT32S sovlms32fBlockFilter(asptSovlms32f *sovlms, DT32F *inp, DT32F *out, DT32S N)
filters a block of N inp samples through the asptSovlms32f filter and
stores the result in the out array.
- Returns :
- Input Parameters :
- sovlms : pointer to the asptSovlms32f filter
- inp : array of N input samples
- Output Parameters :
- out : array of N output samples
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : inp/out is a NULL pointer
<< Back to top
sovlms32fFilterUpdate
DT32F sovlms32fFilterUpdate(asptSovlms32f *sovlms, DT32F inp, DT32F des)
Calculates the filter output and updates the filter coefficients
according to the second order volterra LMS algorithm.
- Returns :
- Input Parameters :
- sovfir : pointer to the asptSovlms32f filter
- inp : new input sample
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling
sovlms32fGetLastErrorSample().
<< Back to top
sovlms32fFilterUpdateSignErr
DT32F sovlms32fFilterUpdateSignErr(asptSovlms32f *sovlms, DT32F inp, DT32F des)
Calculates the filter output and updates the coefficients vector
according to the Second Order Volterra Sign Error LMS algorithm.
The sign of the error sample is used in the coefficients update
instead of the error value itself.
- Returns :
-
The filter output sample.
- Input Parameters :
- sovlms : pointer to the asptSovlms32f filter
- inp : new input sample.
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling
sovlms32fGetLastErrorSample().
<< Back to top
sovlms32fFilterUpdateSignReg
DT32F sovlms32fFilterUpdateSignReg(asptSovlms32f *sovlms, DT32F inp, DT32F des)
Calculates the filter output and updates the coefficients vector
according to the Second Order Volterra Sign Regressor LMS algorithm.
The sign of the input sample is used in the coefficients update instead
of the input sample value.
- Returns :
-
The filter output sample.
- Input Parameters :
- sovlms : pointer to the asptSovlms32f filter
- inp : new input sample.
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling
sovlms32fGetLastErrorSample().
<< Back to top
sovlms32fFilterUpdateSignSign
DT32F sovlms32fFilterUpdateSignSign(asptSovlms32f *sovlms, DT32F inp, DT32F des)
Calculates the filter output and updates the coefficients vector
according to the Second Order Volterra Sign-Sign LMS 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 :
-
The filter output sample.
- Input Parameters :
- sovlms : pointer to the asptSovlms32f filter
- inp : new input sample.
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling
sovlms32fGetLastErrorSample().
<< Back to top
sovlms32fFree
void sovlms32fFree(asptSovlms32f *sovlms)
Frees the allocated memory for this asptSovlms32f filter.
- Returns :
- Input Parameters :
- sovlms : pointer to the asptSovlms32f filter to be de-allocated
- Remarks :
-
Use this function only with filters created with sovlms32fInit(). Do not
use with asptSovlms32f filters created using sovlms32fInitStatic().
<< Back to top
sovlms32fResetDelayLine
DT32S sovlms32fResetDelayLine(asptSovlms32f *sovlms)
Resets all internal filter states to zeros.
- Returns :
- Input Parameters :
- sovlms : pointer to an asptSovlms32f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : sovlms->delayLine is a NULL pointer
<< Back to top
sovlms32fReset
DT32S sovlms32fReset(asptSovlms32f *sovlms)
Resets all internal filter coefficients to zeros.
- Returns :
- Input Parameters :
- sovlms : pointer to an asptSovlms32f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : sovlms->coef is a NULL pointer
<< Back to top
sovlms32fGetCoef
DT32S sovlms32fGetCoef(asptSovlms32f *sovlms, 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 :
- sovlms : pointer to an asptSovlms32f 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/sovlms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovlms32fGetLinearCoef
DT32S sovlms32fGetLinearCoef(asptSovlms32f *sovlms, 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 :
- sovlms : pointer to an asptSovlms32f 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/sovlms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovlms32fGetNonLinearCoef
DT32S sovlms32fGetNonLinearCoef(asptSovlms32f *sovlms, 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 :
- sovlms : pointer to an asptSovlms32f 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/sovlms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovlms32fSetCoef
DT32S sovlms32fSetCoef(asptSovlms32f *sovlms, 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 :
- sovlms : pointer to an asptSovlms32f 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/sovlms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovlms32fSetLinearCoef
DT32S sovlms32fSetLinearCoef(asptSovlms32f *sovlms, 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 :
- sovlms : pointer to an asptSovlms32f 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/sovlms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovlms32fSetNonLinearCoef
DT32S sovlms32fSetNonLinearCoef(asptSovlms32f *sovlms, 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 :
- sovlms : pointer to an asptSovlms32f 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/sovlms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovlms32fSetNonLinearDelayLine
DT32S sovlms32fSetNonLinearDelayLine(asptSovlms32f *sovlms, 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 :
- sovlms : pointer to an asptSovlms32f 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/sovlms->delayLine is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovlms32fSetLinearDelayLine
DT32S sovlms32fSetLinearDelayLine(asptSovlms32f *sovlms, 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 :
- sovlms : pointer to an asptSovlms32f 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/sovlms->delayLine is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovlms32fGetNonLinearDelayLine
DT32S sovlms32fGetNonLinearDelayLine(asptSovlms32f *sovlms, 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 :
- sovlms : pointer to the asptSovlms32f 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/sovlms->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
sovlms32fGetLinearDelayLine
DT32S sovlms32fGetLinearDelayLine(asptSovlms32f *sovlms, 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 :
- sovlms : pointer to the asptSovlms32f 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/sovlms->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
sovlms32fResize
DT32S sovlms32fResize(asptSovlms32f *sovlms, DT32S newL1, DT32S newL2)
Resizes an asptSovlms32f filter keeping as much of the filter
state as possible.
- Returns :
- Input Parameters :
- sovlms : pointer to the asptSovlms32f 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 asptSovlms32f filters.