Back to C-ASPT Contents Page
asptIir32f
API Summary
API to create and delete an asptIir32f filters
API to filter through an asptIir32f filters
API to retrieve the properties of an asptIir32f objects
- DT32S iir32fGetFeedForwardCoef(asptIir32f *iir32f, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S iir32fGetFeedBackCoef(asptIir32f *iir32f, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S iir32fGetDelayLine(asptIir32f *iir32f, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- iir32fGetFeedForwardCoefPtr( asptIir32f
*iir32f )
- iir32fGetFeedBackCoefPtr( asptIir32f
*iir32f )
- iir32fGetDelayLinePtr( asptIir32f
*iir32f )
- iir32fGetFeedForwardLength( asptIir32f
*iir32f )
- iir32fGetFeedBackLength( asptIir32f
*iir32f )
- iir32fGetFilterLength( asptIir32f
*iir32f )
API to set the properties of an asptIir32f filter
- DT32S iir32fResetDelayLine(asptIir32f *iir32f)
- DT32S iir32fResize(asptIir32f *iir32f, DT32S newFF, DT32S newFB)
- DT32S iir32fSetFeedForwardCoef(asptIir32f *iir32f, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S iir32fSetFeedBackCoef(asptIir32f *iir32f, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- DT32S iir32fSetDelayLine(asptIir32f *iir32f, DT32F *newBuf, DT32S ind, DT32S N, DT32S flip)
Description
Implements the Direct Form II Iinite Impulse Response (IIR) filter using circular buffering. asptIir filters support sample per sample as well as block processing.
Copyright
Copyright (c) DSP ALGORITHMS 2003; all rights reserved.
<< Back to top
iir32fInit
DT32S iir32fInit (asptIir32f *iir, DT32S nZ, DT32S nP, DT32F *zCof, DT32F *pCof)
Initializes an asptIir32f filter and dynamically allocates its necessary storage buffers.- Returns :
-
Error code. On failure, the filterLength member of the asptIir32f filter is set to zero.
- Input Parameters :
- iir : pointer to asptIir32f filter to be initialized
- nZ : number of feed forward coefficients
- nP : number of feedback coefficients
- zCof : pointer to the array of nZ feed forward coefficients
- pCof : pointer to the array of nP feed forward coefficients
- Output Parameters :
- iir is initialized using the given input parameters
- Error Conditions
- ASPT_NO_ERR : Initialization success
- ASPT_NULL_PTR_ERR : zCof/pCof is a NULL pointer
- ASPT_RANGE_ERR : nZ/nP is not a valid filter length
- ASPT_NO_MEM_ERR : Could not allocate the necessary filter storage
<< Back to top
iir32fInitStatic
DT32S iir32fInitStatic(asptIir32f *iir, DT32S nZ, DT32S nP, DT32F *zCof, DT32F *pCof, DT32F *pDat)
Initializes an asptIir32f filter to use pre-allocated memory blocks.- Returns :
-
Error code. On failure, the filterLength member of the asptIir32f filter is set to zero.
- Input Parameters :
- iir : pointer to asptIir32f filter to be initialized
- nZ : number of feed forward coefficients
- nP : number of feedback coefficients
- zCof : pointer to the array of nZ feed forward coefficients
- pCof : pointer to the array of nP feed forward coefficients
- pDat : pointer to a pre-allocated memory block to be used
for data storage. At least (MAX(nZ,nP)) memory locations must be available starting at this memory address
- Output Parameters :
- iir is initialized using the given input parameters
- Error Conditions
- ASPT_NO_ERR : Initialization success
- ASPT_NULL_PTR_ERR : pCof/zCof/pDat is a NULL pointer
- ASPT_RANGE_ERR : nZ/nP is not a valid filter length
<< Back to top
iir32fBlockFilter
DT32S iir32fBlockFilter(asptIir32f *iir, DT32F *inp, DT32F *out, DT32S BlockLength)
Calculates the filter output; block processing. - Returns :
- Input Parameters :
- iir : pointer to asptIir32f filter
- inp : array of input samples.
- Output Parameters :
- out : array of output samples
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : inp/out is a NULL pointer
<< Back to top
iir32fFree
void iir32fFree(asptIir32f *iir)
Frees the allocated memory for this asptIir32f filter. - Returns :
- Input Parameters :
- iir : pointer to the asptIir32f filter to be de-allocated
- Remarks :
-
Use this function only with filters created with iir32fInit(). Do not use with asptIir32f filters created using iir32fInitStatic().
<< Back to top
iir32fResetDelayLine
DT32S iir32fResetDelayLine(asptIir32f *iir32f)
Resets the internal delay lines to zero. - Returns :
- Input Parameters :
- iir : pointer to asptIir32f filter to be reset.
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
iir32fGetFeedForwardCoef
DT32S iir32fGetFeedForwardCoef(asptIir32f *iir32f, 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 :
- iir : pointer to asptIir32f 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/iir->feedforward is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
iir32fGetFeedBackCoef
DT32S iir32fGetFeedBackCoef(asptIir32f *iir32f, 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 :
- iir : pointer to asptIir32f 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/iir->feedback is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
iir32fSetFeedForwardCoef
DT32S iir32fSetFeedForwardCoef(asptIir32f *iir32f, 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 :
- iir : pointer to asptIir32f 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/iir->feedforward is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
iir32fSetFeedBackCoef
DT32S iir32fSetFeedBackCoef(asptIir32f *iir32f, 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 :
- iir : pointer to asptIir32f 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/iir->feedback is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
iir32fGetDelayLine
DT32S iir32fGetDelayLine(asptIir32f *iir32f, 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 :
- iir : pointer to asptIir32f 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/iir->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
iir32fSetDelayLine
DT32S iir32fSetDelayLine(asptIir32f *iir32f, DT32F *newBuf, 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 :
- iir : pointer to asptIir32f 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 :
- iir->delayLine is updated
- Error Conditions
- ASPT_NULL_PTR_ERR : newBuf/iir->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
iir32fResize
DT32S iir32fResize(asptIir32f *iir32f, DT32S newFF, DT32S newFB)
Resizes an asptIir32f filter keeping as much of the filter state as possible. - Returns :
- Input Parameters :
- iir : pointer to the asptIir32f 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 asptIir32f filters.