Back to C-ASPT Contents Page
asptSovfir32f
API Summary
API to create and delete an sovFir filters
API to filter through a sovFir filter
API to retrieve the properties of an sovFir objects
- DT32S sovfir32fGetCoef(asptSovfir32f *sovfir, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovfir32fGetLinearCoef(asptSovfir32f *sovfir, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovfir32fGetNonLinearCoef(asptSovfir32f *sovfir, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovfir32fGetNonLinearDelayLine(asptSovfir32f *sovfir, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovfir32fGetLinearDelayLine(asptSovfir32f *sovfir, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- sovfir32fGetCoefPtr( asptSovfir32f
*sovfir )
- sovfir32fGetLinearCoefPtr( asptSovfir32f
*sovfir )
- sovfir32fGetNonLinearCoefPtr( asptSovfir32f
*sovfir )
- sovfir32fGetDelayLinePtr( asptSovfir32f
*sovfir )
- sovfir32fGetFilterLength( asptSovfir32f
*sovfir )
- sovfir32fGetLinearLength( asptSovfir32f
*sovfir )
- sovfir32fGetNonLinearLength( asptSovfir32f
*sovfir )
API to set the properties of an sovFir filter
- DT32S sovfir32fResetDelayLine(asptSovfir32f *sovfir)
- DT32S sovfir32fResize(asptSovfir32f *sovfir, DT32S newL1, DT32S newL2)
- DT32S sovfir32fSetCoef(asptSovfir32f *sovfir, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S sovfir32fSetLinearCoef(asptSovfir32f *sovfir, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S sovfir32fSetNonLinearCoef(asptSovfir32f *sovfir, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S sovfir32fSetLinearDelayLine(asptSovfir32f *sovfir, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sovfir32fSetNonLinearDelayLine(asptSovfir32f *sovfir, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
Description
Implements the Second Order Volterra non-linear 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
sovfir32fInit
DT32S sovfir32fInit (asptSovfir32f *sovfir, DT32S L1, DT32S L2, DT32F *pCof)
Initializes asptSovfir32f filter and dynamically allocates its necessary storage buffers and couples the filter to the given array of filter coefficients.- Returns :
-
Error code. On failure, the filterLength member of the asptSovfir filter is set to zero.
- Input Parameters :
- sovfir : pointer to asptSovfir32f filter to be initialized
- L1 : memory length of the linear filter part
- L2 : memory length of the non-linear filter part
- pCof : pointer to the the array of filter coefficients stored
- with L1 linear coefficients followed by rsum(1 : L2)
non-linear coefficients
- Output Parameters :
- sovfir is initialized using the given input parameters
- Error Conditions
- ASPT_NO_ERR : Initialization success
- ASPT_NULL_PTR_ERR : pCof 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
sovfir32fInitStatic
DT32S sovfir32fInitStatic (asptSovfir32f *sovfir, DT32S L1, DT32S L2, DT32F *pCof, DT32F *pDat)
Initializes asptSovfir32f 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 asptFir32f filter is set to zero.
- Input Parameters :
- sovfir : pointer to asptSovfir32f filter to be initialized
- L1 : memory length of the linear filter part
- L2 : memory length of the non-linear filter part
- pCof : pointer to the array of filter coefficients stored
- with L1 linear coefficients followed by rsum(1 : L2)
non-linear 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 :
- sovfir 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
sovfir32fFilter
DT32F sovfir32fFilter(asptSovfir32f *sovfir, DT32F inp)
Calculates the filter output due to input sample inp and updates the internal filter states. - Returns :
- Input Parameters :
- fir : pointer to the asptSovfir32f filter
- inp : new input sample.
<< Back to top
sovfir32fBlockFilter
DT32S sovfir32fBlockFilter(asptSovfir32f *sovfir, DT32F *inp, DT32F *out, DT32S N)
filters a block of N inp samples through the asptSovfir32f filter and stores the result in the out array. - Returns :
- Input Parameters :
- sovfir : pointer to the asptSovfir32f 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
sovfir32fFree
void sovfir32fFree(asptSovfir32f *sovfir)
Frees the allocated memory for this asptSovfir32f filter. - Returns :
- Input Parameters :
- sovfir : pointer to the asptSovfir32f filter to be de-allocated
- Remarks :
-
Use this function only with filters created with sovfir32fInit(). Do not use with asptSovfir32f filters created using sovfir32fInitStatic().
<< Back to top
sovfir32fResetDelayLine
DT32S sovfir32fResetDelayLine(asptSovfir32f *sovfir)
Resets all internal filter states to zeros.- Returns :
- Input Parameters :
- sovfir : pointer to an asptSovfir32f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : sovfir->delayLine is a NULL pointer
<< Back to top
sovfir32fGetCoef
DT32S sovfir32fGetCoef(asptSovfir32f *sovfir, 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 :
- sovfir : pointer to an asptSovfir32f 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/sovfir->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovfir32fGetLinearCoef
DT32S sovfir32fGetLinearCoef(asptSovfir32f *sovfir, 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 :
- sovfir : pointer to an asptSovfir32f 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/sovfir->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovfir32fGetNonLinearCoef
DT32S sovfir32fGetNonLinearCoef(asptSovfir32f *sovfir, 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 :
- sovfir : pointer to an asptSovfir32f 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/sovfir->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovfir32fSetCoef
DT32S sovfir32fSetCoef(asptSovfir32f *sovfir, 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 :
- sovfir : pointer to an asptSovfir32f 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/sovfir->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovfir32fSetLinearCoef
DT32S sovfir32fSetLinearCoef(asptSovfir32f *sovfir, 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 :
- sovfir : pointer to an asptSovfir32f 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/sovfir->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovfir32fSetNonLinearCoef
DT32S sovfir32fSetNonLinearCoef(asptSovfir32f *sovfir, 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 :
- sovfir : pointer to an asptSovfir32f 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/sovfir->coef is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovfir32fSetNonLinearDelayLine
DT32S sovfir32fSetNonLinearDelayLine(asptSovfir32f *sovfir, 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 :
- sovfir : pointer to an asptSovfir32f 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/sovfir->delayLine is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovfir32fSetLinearDelayLine
DT32S sovfir32fSetLinearDelayLine(asptSovfir32f *sovfir, 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 :
- sovfir : pointer to an asptSovfir32f 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/sovfir->delayLine is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sovfir32fGetNonLinearDelayLine
DT32S sovfir32fGetNonLinearDelayLine(asptSovfir32f *sovfir, 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 :
- sovfir : pointer to the asptSovfir32f 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/sovfir->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
sovfir32fGetLinearDelayLine
DT32S sovfir32fGetLinearDelayLine(asptSovfir32f *sovfir, 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 :
- sovfir : pointer to the asptSovfir32f 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/sovfir->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
sovfir32fResize
DT32S sovfir32fResize(asptSovfir32f *sovfir, DT32S newL1, DT32S newL2)
Resizes an asptSovfir32f filter keeping as much of the filter state as possible. - Returns :
- Input Parameters :
- sovfir : pointer to asptSovfir32f 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 asptSovfir32f filters.