Back to C-ASPT Contents Page
asptSharf32f
API Summary
API to create and delete an asptSharf32f filters
- DT32S sharf32fInit (asptSharf32f *sharf, DT32S nZ, DT32S nP, DT32F ffmu, DT32F fbmu, DT32F *eFir, DT32S nL)
- DT32S sharf32fInitStatic(asptSharf32f *sharf, DT32S nZ, DT32S nP, DT32F ffmu, DT32F fbmu, DT32F *eFir, DT32S nL, DT32F *pCof, DT32F *pDat)
- void sharf32fFree(asptSharf32f *sharf)
API to filter through and update an asptSharf32f filters
API to retrieve the properties of an asptSharf32f objects
- DT32S sharf32fGetFeedForwardCoef(asptSharf32f *sharf, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sharf32fGetFeedBackCoef(asptSharf32f *sharf, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sharf32fGetDelayLine(asptSharf32f *sharf, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- sharf32fGetCoefPtr( asptSharf32f
*sharf )
- sharf32fGetDelayLinePtr( asptSharf32f
*sharf )
- sharf32fGetFilterLength( asptSharf32f
*sharf )
- sharf32fGetFeedForwardLength( asptSharf32f
*sharf )
- sharf32fGetFeedBackLength( asptSharf32f
*sharf )
- sharf32fGetLastErrorSample( asptSharf32f
*sharf )
- sharf32fGetFeedForwardStepSize( asptSharf32f
*sharf )
- sharf32fGetFeedBackStepSize( asptSharf32f
*sharf )
- sharf32fGetErrFilterLength( asptSharf32f
*sharf )
API to set the properties of an asptSharf32f filter
- DT32S sharf32fReset(asptSharf32f *sharf)
- DT32S sharf32fResetDelayLine(asptSharf32f *sharf)
- DT32S sharf32fResize(asptSharf32f *sharf, DT32S newZ, DT32S newP)
- DT32S sharf32fSetFeedForwardCoef(asptSharf32f *sharf, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sharf32fSetFeedBackCoef(asptSharf32f *sharf, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S sharf32fSetDelayLine(asptSharf32f *sharf, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- sharf32fSetFeedForwardStepSize( asptSharf32f
*sharf, newSS )
- sharf32fSetFeedBackStepSize( asptSharf32f
*sharf, newSS )
- sharf32fSetErrFilterLength( asptSharf32f
*sharf, newLen )
- sharf32fSetErrFilter( asptSharf32f
*sharf, newFir )
Description
Implements the SHARF adaptive Recursive filter algorithm using circular buffering.
Copyright
Copyright (c) DSP ALGORITHMS 2003; all rights reserved.
<< Back to top
sharf32fInit
DT32S sharf32fInit (asptSharf32f *sharf, DT32S nZ, DT32S nP, DT32F ffmu, DT32F fbmu, DT32F *eFir, DT32S nL)
Initializes an asptSharf32f filter and dynamically allocates its necessary storage buffers.- Returns :
-
Error code. On failure, the filterLength member of the asptSharf32f filter is set to zero.
- Input Parameters :
- sharf : pointer to an asptSharf32f filter to be initialized
- nZ : number of feed forward coefficients
- nP : number of feedback coefficients
- ffmu : feed forward step size
- fbmu : feedback step size
- efir : pointer to an array of error smoothing filter coefficients
stored with the first coef at index 0 and last at nL-1
- nL : length of smoothing filter
- Output Parameters :
- sharf is initialized using the given input parameters
- Error Conditions
- ASPT_NO_ERR : Initialization success
- ASPT_NULL_PTR_ERR : eFir is a NULL pointer
- ASPT_RANGE_ERR : nZ/nP/nL is not a valid filter length
- ASPT_NO_MEM_ERR : Could not allocate the necessary filter storage
<< Back to top
sharf32fInitStatic
DT32S sharf32fInitStatic(asptSharf32f *sharf, DT32S nZ, DT32S nP, DT32F ffmu, DT32F fbmu, DT32F *eFir, DT32S nL, DT32F *pCof, DT32F *pDat)
Initializes an asptSharf32f filter to use pre-allocated memory blocks.- Returns :
-
Error code. On failure, the filterLength member of the asptSharf32f filter is set to zero.
- Input Parameters :
- sharf : pointer to asptSharf32f filter to be initialized
- nZ : number of feed forward coefficients
- nP : number of feedback coefficients
- ffmu : feed forward step size
- fbmu : feedback step size
- efir : pointer to an array of error smoothing filter coefficients
stored with the first coef at index 0 and last at nL-1
- nL : length of smoothing filter
- pDat : pointer to a pre-allocated memory block to be used
- for the filter coefficients. At least nP : nZ memory
locations must be available starting at this address
- pDat : pointer to a pre-allocated memory block to be used
for data storage. At least nZ+2*nP memory locations must be available starting at this memory address
- Output Parameters :
- sharf is initialized using the given input parameters
- Error Conditions
- ASPT_NO_ERR : Initialization success
- ASPT_NULL_PTR_ERR : pCof/pDat/eFir is a NULL pointer
- ASPT_RANGE_ERR : nZ/nP/nL is not a valid filter length
<< Back to top
sharf32fReset
DT32S sharf32fReset(asptSharf32f *sharf)
Resets all the filter coefficients to zero. - Returns :
- Input Parameters :
- sharf : pointer to an asptSharf32f filter to be reset.
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
sharf32fFree
void sharf32fFree(asptSharf32f *sharf)
Frees the allocated memory for this asptSharf32f filter. - Returns :
- Input Parameters :
- sharf : pointer to the asptSharf32f filter to be de-allocated
- Remarks :
-
Use this function only with filters created with sharf32fInit(). Do not use with asptSharf32f filters created using sharf32fInitStatic().
<< Back to top
sharf32fResetDelayLine
DT32S sharf32fResetDelayLine(asptSharf32f *sharf)
Resets the internal delay lines to zero. - Returns :
- Input Parameters :
- sharf : pointer to an asptSharf32f filter to be reset.
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
sharf32fGetFeedForwardCoef
DT32S sharf32fGetFeedForwardCoef(asptSharf32f *sharf, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
Copies N feed forward filter coefficients starting from coef[ind] to dstBuf. - Returns :
-
on success returns the number of coefficients copied, otherwise an error code
- Input Parameters :
- sharf : pointer to an asptSharf32f 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/sharf->feedforward is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sharf32fGetFeedBackCoef
DT32S sharf32fGetFeedBackCoef(asptSharf32f *sharf, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
Copies N feedback filter coefficients starting from coef[ind] to dstBuf. - Returns :
-
on success returns the number of coefficients copied, otherwise an error code
- Input Parameters :
- sharf : pointer to an asptSharf32f 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/sharf->feedback is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sharf32fSetFeedForwardCoef
DT32S sharf32fSetFeedForwardCoef(asptSharf32f *sharf, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
Initializes N feed forward 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 :
- sharf : pointer to an asptSharf32f 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/sharf->feedforward is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sharf32fSetFeedBackCoef
DT32S sharf32fSetFeedBackCoef(asptSharf32f *sharf, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
Initializes N feedback 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 :
- sharf : pointer to an asptSharf32f 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/sharf->feedback is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
sharf32fGetDelayLine
DT32S sharf32fGetDelayLine(asptSharf32f *sharf, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
Copies N internal delay line samples starting from delayLine[ind] to dstBuf. - Returns :
-
on success returns the number of samples copied, otherwise an error code
- Input Parameters :
- sharf : pointer to the asptSharf32f 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/sharf->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
sharf32fSetDelayLine
DT32S sharf32fSetDelayLine(asptSharf32f *sharf, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
Initializes N internal delay line samples starting from delayLine[ind] to the contents of the given array. - Returns :
-
on success returns the number of samples initialized, otherwise an error code
- Input Parameters :
- sharf : pointer to an asptSharf32f 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 :
- sharf->delayLine is updated
- Error Conditions
- ASPT_NULL_PTR_ERR : newBuf/sharf->delayLine 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
sharf32fResize
DT32S sharf32fResize(asptSharf32f *sharf, DT32S newZ, DT32S newP)
Resizes an asptSharf32f filter keeping as much of the filter state as possible. - Returns :
- Input Parameters :
- sharf : pointer to the asptSharf32f filter to be resized.
- newZ : new number of feed forward filter length
- newP : new number of feedback filter length
- Error Conditions
- ASPT_NO_ERR : Resizing is success
- ASPT_NULL_PTR_ERR : NULL pointer error
- ASPT_RANGE_ERR : newLength 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 asptSharf32f filters.