Back to C-ASPT Contents Page
asptSovvsslms32f
API Summary
API to create and delete an asptSovvsslms filters
- DT32S sovvsslms32fInit (asptSovvsslms32f *sovvsslms, DT32S L1, DT32S L2, DT32F mu, DT32F muMin, DT32F muMax, DT32S SF)
- DT32S sovvsslms32fInitStatic (asptSovvsslms32f *sovvsslms, DT32S L1, DT32S L2, DT32F mu, DT32F muMin, DT32F muMax, DT32S SF, DT32F *pCof, DT32F *pDat)
- void sovvsslms32fFree(asptSovvsslms32f *sovvsslms)
API to filter through a asptSovvsslms filter
- DT32F sovvsslms32fFilterOnly (asptSovvsslms32f *sovvsslms, DT32F inp)
- DT32F sovvsslms32fFilterUpdate (asptSovvsslms32f *sovvsslms, DT32F inp, DT32F des)
- DT32S sovvsslms32fBlockFilterOnly (asptSovvsslms32f *sovvsslms, DT32F *inp, DT32F *out, DT32S N)
- DT32S sovvsslms32fBlockFilterUpdate (asptSovvsslms32f *sovvsslms,DT32F *inp,DT32F *des,DT32F *out,DT32F *err,DT32S N)
API to retrieve the properties of an asptSovvsslms objects
- DT32S sovvsslms32fGetCoef(asptSovvsslms32f *sovvsslms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovvsslms32fGetLinearCoef(asptSovvsslms32f *sovvsslms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovvsslms32fGetNonLinearCoef(asptSovvsslms32f *sovvsslms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovvsslms32fGetNonLinearDelayLine(asptSovvsslms32f *sovvsslms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovvsslms32fGetLinearDelayLine(asptSovvsslms32f *sovvsslms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- sovvsslms32fGetCoefPtr( asptSovvsslms32f
*sovvsslms )
- sovvsslms32fGetLinearCoefPtr( asptSovvsslms32f
*sovvsslms )
- sovvsslms32fGetNonLinearCoefPtr( asptSovvsslms32f
*sovvsslms )
- sovvsslms32fGetDelayLinePtr( asptSovvsslms32f
*sovvsslms )
- sovvsslms32fGetLinearDelayLinePtr( asptSovvsslms32f
*sovvsslms )
- sovvsslms32fGetNonLinearDelayLinePtr( asptSovvsslms32f
*sovvsslms )
- sovvsslms32fGetFilterLength( asptSovvsslms32f
*sovvsslms )
- sovvsslms32fGetLinearLength( asptSovvsslms32f
*sovvsslms )
- sovvsslms32fGetNonLinearLength( asptSovvsslms32f
*sovvsslms )
- sovvsslms32fGetLastErrorSample( asptSovvsslms32f
*sovvsslms )
- sovvsslms32fGetStepSize( asptSovvsslms32f
*sovvsslms, n )
- sovvsslms32fGetMinStepSize( asptSovvsslms32f
*sovvsslms )
- sovvsslms32fGetMaxStepSize( asptSovvsslms32f
*sovvsslms )
- sovvsslms32fGetSignFlag( asptSovvsslms32f
*sovvsslms )
API to set the properties of an asptSovvsslms filter
- DT32S sovvsslms32fReset(asptSovvsslms32f *sovvsslms)
- DT32S sovvsslms32fResetDelayLine(asptSovvsslms32f *sovvsslms)
- DT32S sovvsslms32fResize(asptSovvsslms32f *sovvsslms, DT32S newL1, DT32S newL2)
- DT32S sovvsslms32fSetCoef(asptSovvsslms32f *sovvsslms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S sovvsslms32fSetLinearCoef(asptSovvsslms32f *sovvsslms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S sovvsslms32fSetNonLinearCoef(asptSovvsslms32f *sovvsslms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S sovvsslms32fSetLinearDelayLine(asptSovvsslms32f *sovvsslms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovvsslms32fSetNonLinearDelayLine(asptSovvsslms32f *sovvsslms, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- sovvsslms32fSetStepSize( asptSovvsslms32f
*sovvsslms, n, newStep )
- sovvsslms32fSetMinStepSize( asptSovvsslms32f
*sovvsslms, a )
- sovvsslms32fSetMaxStepSize( asptSovvsslms32f
*sovvsslms, b )
- sovvsslms32fSetSignFlag( asptSovvsslms32f
*sovvsslms, c )
Description
Implements the Second Order Volterra Variable Step Size LMS non-linear adaptive FIR filter using circular buffering.
Copyright
Copyright (c) DSP ALGORITHMS 2003; all rights reserved.
<< Back to top
sovvsslms32fInit
DT32S sovvsslms32fInit (asptSovvsslms32f *sovvsslms, DT32S L1, DT32S L2, DT32F mu, DT32F muMin, DT32F muMax, DT32S SF)
Initializes an asptSovvsslms32f filter and dynamically allocates its necessary storage buffers.- Returns :
-
Error code. On failure, the filterLength member of the asptSovvsslms32f filter is set to zero.
- Input Parameters :
- sovvsslms : pointer to asptSovvsslms32f filter to be initialized
- L1 : memory length of the linear filter part
- L2 : memory length of the non-linear filter part
- 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
- Output Parameters :
- sovvsslms is initialized using the given input parameters
- Error Conditions
- ASPT_NO_ERR : Initialization success
- ASPT_RANGE_ERR : L1/L2/minMu/maxMu is not a valid filter length
- ASPT_NO_MEM_ERR : Could not allocate the necessary filter storage
<< Back to top
sovvsslms32fInitStatic
DT32S sovvsslms32fInitStatic (asptSovvsslms32f *sovvsslms, DT32S L1, DT32S L2, DT32F mu, DT32F muMin, DT32F muMax, DT32S SF, DT32F *pCof, DT32F *pDat)
Initializes an asptSovvsslms32f 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 asptSovvsslms32f filter is set to zero.
- Input Parameters :
- sovvsslms : pointer to asptSovvsslms32f filter to be initialized
- L1 : memory length of the linear filter part
- L2 : memory length of the non-linear filter part
- 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 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 :
- sovvsslms 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/minMu/maxMu 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
sovvsslms32fFilterOnly
DT32F sovvsslms32fFilterOnly (asptSovvsslms32f *sovvsslms, 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 :
- sovvsslms : pointer to the asptSovvsslms32f filter
- inp : new input sample.
<< Back to top
sovvsslms32fBlockFilterOnly
DT32S sovvsslms32fBlockFilterOnly (asptSovvsslms32f *sovvsslms, DT32F *inp, DT32F *out, DT32S N)
filters a block of N inp samples through the asptSovvsslms32f filter and stores the result in the out array without updating the filter coef. - Returns :
- Input Parameters :
- sovvsslms : pointer to the asptSovvsslms32f 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
sovvsslms32fFilterUpdate
DT32F sovvsslms32fFilterUpdate (asptSovvsslms32f *sovvsslms, DT32F inp, DT32F des)
Calculates the filter output and updates the filter coefficients according to the second order volterra VSSLMS algorithm. - Returns :
- Input Parameters :
- sovvsslms : pointer to the asptSovvsslms32f filter
- inp : new input sample
- des : new desired sample
- Remarks :
-
The error sample is stored internally and can be retrieved by calling sovvsslms32fGetLastErrorSample().
<< Back to top
sovvsslms32fBlockFilterUpdate
DT32S sovvsslms32fBlockFilterUpdate (asptSovvsslms32f *sovvsslms,DT32F *inp,DT32F *des,DT32F *out,DT32F *err,DT32S N)
filters a block of N inp samples through the asptSovvsslms32f filter, stores the result in the out array, and updates the filter coefficients - Returns :
- Input Parameters :
- sovvsslms : pointer to the asptSovvsslms32f filter
- inp : array of N input samples
- des : array of N desired samples
- N : block length
- Output Parameters :
- out : array of N output samples
- err : array of N error samples
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : inp/out is a NULL pointer
<< Back to top
sovvsslms32fFree
void sovvsslms32fFree(asptSovvsslms32f *sovvsslms)
Frees the allocated memory for this asptSovvsslms32f filter. - Returns :
- Input Parameters :
- sovvsslms : pointer to the asptSovvsslms32f filter to be de-allocated
- Remarks :
-
Use this function only with filters created with sovvsslms32fInit(). Do not use with asptSovvsslms32f filters created using sovvsslms32fInitStatic().
<< Back to top
sovvsslms32fResetDelayLine
DT32S sovvsslms32fResetDelayLine(asptSovvsslms32f *sovvsslms)
Resets all internal filter states to zeros.- Returns :
- Input Parameters :
- sovvsslms : pointer to an asptSovvsslms32f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : sovvsslms->delayLine is a NULL pointer
<< Back to top
sovvsslms32fReset
DT32S sovvsslms32fReset(asptSovvsslms32f *sovvsslms)
Resets all internal filter coefficients to zeros.- Returns :
- Input Parameters :
- sovvsslms : pointer to an asptSovvsslms32f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : sovvsslms->coef is a NULL pointer
<< Back to top
sovvsslms32fGetCoef
DT32S sovvsslms32fGetCoef(asptSovvsslms32f *sovvsslms, 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 :
- sovvsslms : pointer to an asptSovvsslms32f 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/sovvsslms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovvsslms32fGetLinearCoef
DT32S sovvsslms32fGetLinearCoef(asptSovvsslms32f *sovvsslms, 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 :
- sovvsslms : pointer to an asptSovvsslms32f 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/sovvsslms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovvsslms32fGetNonLinearCoef
DT32S sovvsslms32fGetNonLinearCoef(asptSovvsslms32f *sovvsslms, 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 :
- sovvsslms : pointer to an asptSovvsslms32f 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/sovvsslms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovvsslms32fSetCoef
DT32S sovvsslms32fSetCoef(asptSovvsslms32f *sovvsslms, 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 :
- sovvsslms : pointer to an asptSovvsslms32f 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 :
- sovvsslms->coef is updated
- Error Conditions
- ASPT_NULL_PTR_ERR : newCoef/sovvsslms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovvsslms32fSetLinearCoef
DT32S sovvsslms32fSetLinearCoef(asptSovvsslms32f *sovvsslms, 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 :
- sovvsslms : pointer to an asptSovvsslms32f 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 :
- sovvsslms->coef is updated
- Error Conditions
- ASPT_NULL_PTR_ERR : newCoef/sovvsslms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovvsslms32fSetNonLinearCoef
DT32S sovvsslms32fSetNonLinearCoef(asptSovvsslms32f *sovvsslms, 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 :
- sovvsslms : pointer to an asptSovvsslms32f 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 :
- sovvsslms->coef is updated
- Error Conditions
- ASPT_NULL_PTR_ERR : newCoef/sovvsslms->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovvsslms32fSetNonLinearDelayLine
DT32S sovvsslms32fSetNonLinearDelayLine(asptSovvsslms32f *sovvsslms, 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 :
- sovvsslms : pointer to an asptSovvsslms32f 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 :
- sovvsslms->coef is updated
- Error Conditions
- ASPT_NULL_PTR_ERR : newBuf/sovvsslms->delayLine is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovvsslms32fSetLinearDelayLine
DT32S sovvsslms32fSetLinearDelayLine(asptSovvsslms32f *sovvsslms, 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 :
- sovvsslms : pointer to an asptSovvsslms32f 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 :
- sovvsslms->coef is updated
- Error Conditions
- ASPT_NULL_PTR_ERR : newBuf/sovvsslms->delayLine is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovvsslms32fGetNonLinearDelayLine
DT32S sovvsslms32fGetNonLinearDelayLine(asptSovvsslms32f *sovvsslms, 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 :
- sovvsslms : pointer to the asptSovvsslms32f 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/sovvsslms->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
sovvsslms32fGetLinearDelayLine
DT32S sovvsslms32fGetLinearDelayLine(asptSovvsslms32f *sovvsslms, 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 :
- sovvsslms : pointer to the asptSovvsslms32f 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/sovvsslms->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
sovvsslms32fResize
DT32S sovvsslms32fResize(asptSovvsslms32f *sovvsslms, DT32S newL1, DT32S newL2)
Resizes an asptSovvsslms32f filter keeping as much of the filter state as possible. - Returns :
- Input Parameters :
- sovvsslms : pointer to the asptSovvsslms32f 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 asptSovvsslms32f filters.