Back to C-ASPT Contents Page
asptFdadjlms32f
API Summary
API to create and delete asptFdadjlms32f filters
- DT32S fdadjlms32fInit(asptFdadjlms32f *fdadjlms,DT32S M,DT32S L,DT32F mu,DT32S cs,DT32F *sPath,DT32S sL,DT32F *sPathEst,DT32S seL,DT32S *ip,DT32F *w)
- DT32S fdadjlms32fInitStatic(asptFdadjlms32f *fdadjlms,DT32S M,DT32S L,DT32F mu,DT32S cs,DT32F *sPath,DT32S sL,DT32F *sPathEst,DT32S seL,DT32F *pCof,DT32F *pDat,DT32S *ip,DT32F *w)
- void fdadjlms32fFree(asptFdadjlms32f *fdadjlms)
API to filter and update asptFdadjlms32f filters
API to retrieve the properties of asptFdadjlms32f filters
- DT32S fdadjlms32fGetCoef(asptFdadjlms32f *fdadjlms, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
- DT32S fdadjlms32fGetSecPath(asptFdadjlms32f *fdadjlms, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
- DT32S fdadjlms32fGetEstSecPath(asptFdadjlms32f *fdadjlms, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
- fdadjlms32fGetCoefPtr( asptFdadjlms32f
*fdadjlms )
- fdadjlms32fGetSecPathPtr( asptFdadjlms32f
*fdadjlms )
- fdadjlms32fGetEstSecPathPtr( asptFdadjlms32f
*fdadjlms )
- fdadjlms32fGetFilterLength( asptFdadjlms32f
*fdadjlms )
- fdadjlms32fGetBlockLength( asptFdadjlms32f
*fdadjlms )
- fdadjlms32fGetSecPathLength( asptFdadjlms32f
*fdadjlms )
- fdadjlms32fGetEstSecPathLength( asptFdadjlms32f
*fdadjlms )
- fdadjlms32fGetFftLength( asptFdadjlms32f
*fdadjlms )
- fdadjlms32fGetStepSize( asptFdadjlms32f
*fdadjlms )
- fdadjlms32fGetConstrain( asptFdadjlms32f
*fdadjlms )
API to set the properties of asptFdadjlms32f filters
- DT32S fdadjlms32fReset(asptFdadjlms32f *fdadjlms)
- DT32S fdadjlms32fResetDelayLine(asptFdadjlms32f *fdadjlms)
- DT32S fdadjlms32fResize(asptFdadjlms32f *fdadjlms, DT32S newLen, DT32S newBlock)
- DT32S fdadjlms32fSetCoef(asptFdadjlms32f *fdadjlms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
- DT32S fdadjlms32fSetSecPath(asptFdadjlms32f *fdadjlms, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
- DT32S fdadjlms32fSetEstSecPath(asptFdadjlms32f *fdadjlms, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
- fdadjlms32fSetStepSize( asptFdadjlms32f
*fdadjlms, newSs )
- fdadjlms32fSetConstrain( asptFdadjlms32f
*fdadjlms, newC )
- fdadjlms32fSetSecPathLength( asptFdadjlms32f
*fdadjlms, newL )
- fdadjlms32fSetEstSecPathLength( asptFdadjlms32f
*fdadjlms, newL )
Description
Implements the Frequency Domain ADJoint LMS algorithm. This version is intended for simulation purposes only. Use asptRtfdadjlms filters for real-time applications.
Copyright
Copyright (c) DSP ALGORITHMS 2003; all rights reserved.
<< Back to top
fdadjlms32fInit
DT32S fdadjlms32fInit(asptFdadjlms32f *fdadjlms,DT32S M,DT32S L,DT32F mu,DT32S cs,DT32F *sPath,DT32S sL,DT32F *sPathEst,DT32S seL,DT32S *ip,DT32F *w)
Initializes an asptFdadjlms32f filter and allocates its necessary storage buffers - Returns :
-
Error code. On failure, the filterLength member of the filter is set to zero.
- Input Parameters :
- fdadjlms : pointer to the asptFdadjlms32f to be initialized
- M : number of time domain filter coefficients
- L : block length (number of new samples each block)
- mu : step size.
- cs : constrained (1) or unconstrained (0) filter.
- sPath : pointer to the real secondary path FIR response
- sL : length of the secondary path response sPath
- sPathEst : pointer to the estimated secondary path FIR response
- seL : length of the estimated secondary path response sPathEst
- ip : fft bit reversal table
- w : fft twiddle factor table.
- Output Parameters :
- fdadjlms is initialized using the given input arguments.
- Error Conditions
- ASPT_NO_ERR : Initialization is successful
- ASPT_NULL_PTR_ERR : ip/w is a NULL pointer
- ASPT_RANGE_ERR : L/M/sL/seL is not a valid input value
- ASPT_NO_MEM_ERR : could not allocate memory
<< Back to top
fdadjlms32fInitStatic
DT32S fdadjlms32fInitStatic(asptFdadjlms32f *fdadjlms,DT32S M,DT32S L,DT32F mu,DT32S cs,DT32F *sPath,DT32S sL,DT32F *sPathEst,DT32S seL,DT32F *pCof,DT32F *pDat,DT32S *ip,DT32F *w)
Initializes an asptFdadjlms32f filter to use pre-allocated memory blocks - Returns :
-
Error code. On failure, the filterLength member of the structure is set to zero.
- Input Parameters :
- fdadjlms : pointer to the asptFdadjlms32f to be initialized
- M : number of time domain filter coefficients
- L : block length (number of new samples each block)
- mu : step size.
- cs : constrained (1) or unconstrained (0) filter.
- sPath : pointer to the real secondary path FIR response
- sL : length of the secondary path response sPath
- sPathEst : pointer to the estimated secondary path FIR response
- seL : length of the estimated secondary path response sPathEst
- pCof : pointer to a pre-allocated memory in program memory
of at least [3*fftLength] DT32F locations to be used for the filter coefficients and sec. source coefficients.
- pDat : pointer to a pre-allocated memory in data memory of at least
[2*C1 + 2*fftLength + 2*(fftLength/2+1)] DT32F locations to be used for data storage.
- ip : fft bit reversal table
- w : fft twiddle factor table.
- Output Parameters :
- fdadjlms is initialized using the given input arguments.
- Error Conditions
- ASPT_NO_ERR : Initialization is successful
- ASPT_NULL_PTR_ERR : ip/w/pCof/pDat is a NULL pointer
- ASPT_RANGE_ERR : L/M/sL/seL is not a valid input value
- ASPT_NO_MEM_ERR : could not allocate memory
- Remarks :
-
fftLength = 2^(nextpow2(L+M-1)). C1 = fftLength - blockLength.
<< Back to top
fdadjlms32fFilterUpdate
DT32S fdadjlms32fFilterUpdate(asptFdadjlms32f *fdadjlms, DT32F *ref, DT32F *prim, DT32F *sens)
Calculates the filter output and updates the coefficients vector according to the FDADJLMS algorithm. - Returns :
- Input Parameters :
- fdadjlms : pointer to the asptFdadjlms32f filter
- ref : new reference block of samples.
- prim : primary source block of samples measured at sensor
- Output Parameters :
- sen : array to store the calculated block of sensor samples
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
fdadjlms32fFilterOnly
DT32S fdadjlms32fFilterOnly(asptFdadjlms32f *fdadjlms, DT32F *ref, DT32F *prim, DT32F *sens)
Calculates the filter output but does not update the coefficients vector. It also updates the internal buffers and power estimate. - Returns :
- Input Parameters :
- fdadjlms : pointer to the asptFdadjlms32f filter
- ref : new reference block of samples.
- prim : primary source block of samples measured at sensor
- Output Parameters :
- sen : array to store the calculated block of sensor samples
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
fdadjlms32fFree
void fdadjlms32fFree(asptFdadjlms32f *fdadjlms)
Frees the allocated memory for this asptFdadjlms32f filter. - Returns :
- Input Parameters :
- fdadjlms : pointer to the fdadjlms filter
- Remarks :
-
Use this function only with filters created with fdadjlms32fInit(). Do not use with asptFdadjlms32f filters created using fdadjlms32fInitStatic().
<< Back to top
fdadjlms32fReset
DT32S fdadjlms32fReset(asptFdadjlms32f *fdadjlms)
Resets all filter coefficients to zero.- Returns :
- Input Parameters :
- fdadjlms : pointer to an asptFdadjlms32f filter to be reset.
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
fdadjlms32fResetDelayLine
DT32S fdadjlms32fResetDelayLine(asptFdadjlms32f *fdadjlms)
Resets the internal delay line to zeros.- Returns :
- Input Parameters :
- fdadjlms : pointer to an asptFdadjlms32f filter to be reset.
- Error Conditions
- ASPT_NO_ERR : success
- ASPT_NULL_PTR_ERR : NULL pointer error
<< Back to top
fdadjlms32fGetCoef
DT32S fdadjlms32fGetCoef(asptFdadjlms32f *fdadjlms, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
Copies N internal filter coefficients starting from coef[ind] to dstBuf. - Returns :
-
On success returns the number of coefficients copied, otherwise the error code (negative int).
- Input Parameters :
- fdadjlms : pointer to an asptFdadjlms32f 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.
- Error Conditions
- ASPT_NULL_PTR_ERR : dstBuf/fdadjlms->wFreq is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
fdadjlms32fSetCoef
DT32S fdadjlms32fSetCoef(asptFdadjlms32f *fdadjlms, DT32F *newCoef, DT32S ind, DT32S N, DT32S flip)
Initializes N internal (time domain) filter coefficients starting from coef[ind] to the contents of newCoef. - Returns :
-
On success returns the number of coefficients copied, otherwise the error code (negative int).
- Input Parameters :
- fdadjlms : pointer to an asptFdadjlms32f 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.
- Error Conditions
- ASPT_NULL_PTR_ERR : newCoef/fdadjlms->wFreq is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
fdadjlms32fGetEstSecPath
DT32S fdadjlms32fGetEstSecPath(asptFdadjlms32f *fdadjlms, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
Copies N internal (time domain) coefficients from the estimated secondary path filter starting from coef[ind] to dstBuf. - Returns :
-
On success returns the number of coefficients copied, otherwise the error code (negative int).
- Input Parameters :
- fdadjlms : pointer to an asptFdadjlms32f 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.
- Error Conditions
- ASPT_NULL_PTR_ERR : dstBuf/fdadjlms->secPathEst is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
fdadjlms32fSetEstSecPath
DT32S fdadjlms32fSetEstSecPath(asptFdadjlms32f *fdadjlms, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
Initializes N internal (time domain) coefficients from the estimated secondary path filter starting from coef[ind] to the contents of newCoef. - Returns :
-
On success returns the number of coefficients copied, otherwise the error code (negative int).
- Input Parameters :
- fdadjlms : pointer to an asptFdadjlms32f filter.
- newCoef : destination buffer.
- ind : index to the first coefficient to be initialized.
- N : number of coefficients to be initialized.
- flip : if not 0, will flip the coefficients order.
- Error Conditions
- ASPT_NULL_PTR_ERR : newCoef/fdadjlms->secPathEst is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
fdadjlms32fGetSecPath
DT32S fdadjlms32fGetSecPath(asptFdadjlms32f *fdadjlms, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
Copies N internal (time domain) coefficients from the secondary path filter starting from coef[ind] to dstBuf. - Returns :
-
On success returns the number of coefficients copied, otherwise the error code (negative int).
- Input Parameters :
- fdadjlms : pointer to an asptFdadjlms32f 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.
- Error Conditions
- ASPT_NULL_PTR_ERR : dstBuf/fdadjlms->secPath is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
fdadjlms32fSetSecPath
DT32S fdadjlms32fSetSecPath(asptFdadjlms32f *fdadjlms, DT32F *dstBuf, DT32S ind, DT32S N, DT32S flip)
Initializes N internal (time domain) coefficients from the secondary path filter starting from coef[ind] to the contents of newCoef. - Returns :
-
On success returns the number of coefficients copied, otherwise the error code (negative int).
- Input Parameters :
- fdadjlms : pointer to an asptFdadjlms32f filter.
- newCoef : destination buffer.
- ind : index to the first coefficient to be initialized.
- N : number of coefficients to be initialized.
- flip : if not 0, will flip the coefficients order.
- Error Conditions
- ASPT_NULL_PTR_ERR : newCoef/fdadjlms->secPath is a NULL pointer
- ASPT_RANGE_ERR : ind/N is not a valid input value
<< Back to top
fdadjlms32fResize
DT32S fdadjlms32fResize(asptFdadjlms32f *fdadjlms, DT32S newLen, DT32S newBlock)
Resizes an asptFdadjlms32f filter keeping as much of the filter state as possible. - Returns :
- Input Parameters :
- fdadjlms : pointer to the asptFdadjlms32f filter to be resized.
- newLen : required new filter length
- newBlock : new block length
- Error Conditions
- ASPT_NO_ERR : Resizing is success
- ASPT_NULL_PTR_ERR : NULL pointer error
- ASPT_RANGE_ERR : newLength/newBlock is not a valid input value
- ASPT_NO_MEM_ERR : Could not allocate the necessary filter storage
- Remarks :
-
Use this function only with dynamically allocated asptFdadjlms32f filters.