Back to C-ASPT Contents Page
asptCsoiir232f
API Summary
API to create and delete an asptCsoiir232f filters
API to filter through and update an asptCsoiir232f filters
API to retrieve the properties of an asptCsoiir232f objects
- DT32S csoiir232fGetDelayLine(asptCsoiir232f *soiir, DT32S S, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- csoiir232fGetCfCoef( asptCsoiir232f
*soiir,m )
- csoiir232fGetBwCoef( asptCsoiir232f
*soiir,m )
- csoiir232fGetDelayLinePtr( asptCsoiir232f
*soiir )
- csoiir232fGetLastErrorSample( asptCsoiir232f
*soiir )
- csoiir232fGetSectionError( asptCsoiir232f
*ccsoiir2,m )
- csoiir232fGetSectionOutput( asptCsoiir232f
*ccsoiir2,m )
- csoiir232fGetCfStepSize( asptCsoiir232f
*soiir )
- csoiir232fGetBwStepSize( asptCsoiir232f
*soiir )
- csoiir232fGetCfMin( asptCsoiir232f
*soiir )
- csoiir232fGetBwMin( asptCsoiir232f
*soiir )
- csoiir232fGetCfMax( asptCsoiir232f
*soiir )
- csoiir232fGetBwMax( asptCsoiir232f
*soiir )
API to set the properties of an asptCsoiir232f filter
- DT32S csoiir232fReset(asptCsoiir232f *soiir)
- DT32S csoiir232fResetDelayLine(asptCsoiir232f *soiir)
- DT32S csoiir232fSetDelayLine (asptCsoiir232f *soiir, DT32S S, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
- csoiir232fSetCfCoef( asptCsoiir232f
*soiir,m,ncf )
- csoiir232fSetBwCoef( asptCsoiir232f
*soiir,m,nbw )
- csoiir232fSetCfStepSize( asptCsoiir232f
*soiir, ss )
- csoiir232fSetBwStepSize( asptCsoiir232f
*soiir, ss )
- csoiir232fSetCfMin( asptCsoiir232f
*soiir, cfmin )
- csoiir232fSetBwMin( asptCsoiir232f
*soiir, bwmin )
- csoiir232fSetCfMax( asptCsoiir232f
*soiir, cfmax )
- csoiir232fSetBwMax( asptCsoiir232f
*soiir, bwmax )
Description
Implements the CSOIIR2 adaptive algorithm.
Copyright
Copyright (c) DSP ALGORITHMS 2003; all rights reserved.
<< Back to top
csoiir232fInit
DT32S csoiir232fInit(asptCsoiir232f *soiir, DT32S N, DT32F cfss, DT32F cfbw)
Initializes an asptCsoiir232f filter and dynamically allocates its necessary storage memory.- Returns :
- Input Parameters :
- soiir : asptCsoiir232f filter to be initialized
- N : number of soiir2 sections
- cfss : center frequency step size
- bwss : bandwidth atep size
- Remarks :
-
cf[k] = 0.0f; bw[k] = 0.0f; bwMax = 0.95f; bwMin = 0.1f; cfMax = 3.12f; cfMin = 0.05f; all delay lines are reset to zeros use the csoiir232fSetxxx to change the default values if necessary.
- Error Conditions
- ASPT_NO_ERR : Initialization is successful
- ASPT_RANGE_ERR : N is not a valid input value
- ASPT_NO_MEM_ERR : Could not allocate the necessary filter storage
<< Back to top
csoiir232fInitStatic
DT32S csoiir232fInitStatic(asptCsoiir232f *soiir, DT32S N, DT32F cfss, DT32F cfbw, DT32F *pCof, DT32F *pDat)
Initializes an asptCsoiir232f filter to use pre-allocated memory blocks.- Returns :
- Input Parameters :
- soiir : asptCsoiir232f filter to be initialized
- N : number of soiir2 sections
- cfss : center frequency step size
- bwss : bandwidth atep size
- pDat : pointer to a pre-allocated memory block to be used
for the filter coefficients. At least [2*N] 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 [13*N+3] memory locations must be available starting at this memory address
- Remarks :
-
cf[k] = 0.0f; bw[k] = 0.0f; bwMax = 0.95f; bwMin = 0.1f; cfMax = 3.12f; cfMin = 0.05f; all delay lines are reset to zeros use the csoiir232fSetxxx to change the default values if necessary.
- Error Conditions
- ASPT_NO_ERR : Initialization is successful
- ASPT_NULL_PTR_ERR : pCof/pDat is a NULL pointer
- ASPT_RANGE_ERR : N is not a valid input value
<< Back to top
csoiir232fFilterUpdate
DT32F csoiir232fFilterUpdate(asptCsoiir232f *soiir, DT32F x)
Calculates the filter output and updates the cf and bw coefficients according to the csoiir2 algorithm. - Returns :
-
The output of the cascaded sections (last section output)
- Input Parameters :
- soiir : pointer to asptCsoiir232f filter
- x : new input sample
- Remarks :
-
The last error sample is stored internally and can be retrieved by calling csoiir232fGetLastErrorSample().
<< Back to top
csoiir232fFilterOnly
DT32F csoiir232fFilterOnly (asptCsoiir232f *soiir, DT32F x)
Calculates the filter output but does not update the coefficients. It also updates the internal delay lines. - Returns :
-
The output of the cascaded sections (last section output)
- Input Parameters :
- soiir : pointer to asptCsoiir232f filter
- x : input sample vector
- Remarks :
-
The last error sample is stored internally and can be retrieved by calling csoiir232fGetLastErrorSample().
<< Back to top
csoiir232fReset
DT32S csoiir232fReset(asptCsoiir232f *soiir)
Resets all filter coefficients to zero- Returns :
- Input Parameters :
- soiir : pointer to the asptCsoiir232f filter to be reset.
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
csoiir232fResetDelayLine
DT32S csoiir232fResetDelayLine(asptCsoiir232f *soiir)
Resets all internal delay lines to zero.- Returns :
- Input Parameters :
- soiir : pointer to the asptCsoiir232f filter to be reset
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
csoiir232fSetDelayLine
DT32S csoiir232fSetDelayLine (asptCsoiir232f *soiir, DT32S S, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
Initializes the N; 0<= N <=2 internal delay line samples starting from delayLine[ind] sample. to the contents of the given array. ind = 0 is the newest input sample. - Returns :
-
On success returns the number of samples initialized, otherwise an error code (negative DT32S).
- Input Parameters :
- soiir : pointer to an asptCsoiir2 filter to be set.
- sec : section number for which the delay line to be set
- newBuf : pointer to the new samples vector.
- ind : index to the first sample to be set.
- N : number of samples to be set
- flip : if not 0, will flip the samples order.
- Error Conditions
- ASPT_NULL_PTR_ERR : newBuf/soiir is a NULL pointer
- ASPT_RANGE_ERR : ind/N/sec 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
csoiir232fGetDelayLine
DT32S csoiir232fGetDelayLine(asptCsoiir232f *soiir, DT32S S, DT32F *buf, DT32S ind, DT32S N, DT32S flip)
Copies the N; 0 <= N <=2 internal delay line samples starting from delayLine[ind] to the given buffer; ind = 0 is the newest input sample. - Returns :
-
On success returns the number of samples copied, otherwise the error code (negative DT32S).
- Input Parameters :
- soiir : pointer to the asptCsoiir232f filter to be set
- sec : section number for which the delay line to be set
- dstBuf : pointer to the 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/soiir is a NULL pointer
- ASPT_RANGE_ERR : ind/N/sec 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
csoiir232fFree
void csoiir232fFree(asptCsoiir232f *soiir)
Frees the allocated memory for this asptCsoiir232f filter. - Returns :
- Input Parameters :
- csoiir : pointer to the asptCsoiir232f filter to be de-allocated
- Remarks :
-
Use this function only with filters created with csoiir232fInit(). Do not use with asptCsoiir232f filters created using csoiir232fInitStatic().