43 printf(
"Enter DSPLIB_cascadeBiquad_init_checkParams\n");
69 const void *restrict pIn,
70 const void *restrict pFilterCoeff,
71 const void *restrict pFilterVar,
72 const void *restrict pOut)
77 printf(
"Enter DSPLIB_cascadeBiquad_exec_checkParams\n");
79 if ((pIn == NULL) || (pFilterCoeff == NULL) || (pFilterVar == NULL) || (pOut == NULL)) {
89 template <
typename dataType>
static inline dataType
fast_recip(dataType x)
91 typedef typename c7x::make_full_vector<dataType>::type vec;
98 vec out = f * (2 - a * f);
109 int32_t offset = ((numStages * 5 + eleCount) / eleCount) * eleCount *
sizeof(
DSPLIB_F32);
114 template <
typename dataType>
118 #if DSPLIB_DEBUGPRINT
119 printf(
"DSPLIB_DEBUGPRINT DSPLIB_cascadeBiquad_store_coefficients\n");
122 int32_t loadCounter = 0;
123 int32_t storeCounter_0 = 0;
124 int32_t storeCounter_1 = 0;
126 dataType *pFilterCoeffLocal = (dataType *) pFilterCoeff;
130 typedef typename c7x::make_full_vector<dataType>::type vec;
131 int eleCount = c7x::element_count_of<vec>::value;
132 int32_t offset = ((numStages * 5 + eleCount) / eleCount) * eleCount;
134 #if DSPLIB_DEBUGPRINT
135 printf(
"DSPLIB_DEBUGPRINT eleCount %d offset %d numStages %d\n", eleCount, offset, numStages);
138 for (uint32_t coeffCount = 0; coeffCount < numStages * 5; coeffCount = coeffCount + 5) {
139 float coeff0 = pFilterCoeffLocal[loadCounter];
143 float r = fast_recip<dataType>(b10);
144 float b11 = pFilterCoeffLocal[loadCounter] * r;
146 float b12 = pFilterCoeffLocal[loadCounter] * r;
148 float a11 = -pFilterCoeffLocal[loadCounter];
150 float a12 = -pFilterCoeffLocal[loadCounter];
152 float b11_a11 = b11 + a11;
153 float b12_a12 = b12 + a12;
154 outGain = outGain * b10;
155 #if DSPLIB_DEBUGPRINT
156 printf(
"DSPLIB_DEBUGPRINT coeffCount %f b10 %f outGain %f\n", coeffCount, b10, outGain);
159 pFilterCoeffLocal[storeCounter_0] = b11_a11;
161 pFilterCoeffLocal[storeCounter_0] = b12_a12;
163 pFilterCoeffLocal[offset + storeCounter_1] = a12;
165 pFilterCoeffLocal[offset + storeCounter_1] = a11;
167 #if DSPLIB_DEBUGPRINT
168 printf(
"DSPLIB_DEBUGPRINT a11 %f a12 %f b11 %f b12 %f b11_a11 %f b12_a12 %f \n", a11, a12, b11, b12, b11_a11,
186 #if DSPLIB_DEBUGPRINT
187 printf(
"DSPLIB_DEBUGPRINT Enter DSPLIB_cascadeBiquad_init\n");
189 pKerPrivArgs->
initArgs = *pKerInitArgs;
191 int32_t ele_size = 1;
217 #if DSPLIB_DEBUGPRINT
218 printf(
"DSPLIB_DEBUGPRINT bufParamsIn->data_type == DSPLIB_FLOAT32\n");
223 bufParamsOut, pKerInitArgs);
228 bufParamsFilterVar, bufParamsOut, pKerInitArgs);
245 void *restrict pFilterCoeff,
246 void *restrict pFilterVar,
251 #if DSPLIB_DEBUGPRINT
252 printf(
"DSPLIB_DEBUGPRINT Enter DSPLIB_cascadeBiquad_exec\n");
260 pKerPrivArgs->
outGain = DSPLIB_cascadeBiquad_store_coefficients<float>(numStages, pFilterCoeff);
265 #if DSPLIB_DEBUGPRINT
266 printf(
"DSPLIB_DEBUGPRINT pKerPrivArgs->outGain %f\n", pKerPrivArgs->
outGain);
268 status = pKerPrivArgs->
execute(handle, pIn, pFilterCoeff, pFilterVar, pOut);
template DSPLIB_STATUS DSPLIB_cascadeBiquad7Stage_init_ci< float >(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsIn, const DSPLIB_bufParams1D_t *bufParamsFilterCoeff, const DSPLIB_bufParams2D_t *bufParamsFilterVar, const DSPLIB_bufParams2D_t *bufParamsOut, const DSPLIB_cascadeBiquad_InitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_cascadeBiquad7Stage_exec_ci< float >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pFilterCoeff, void *restrict pFilterVar, void *restrict pOut)
static dataType fast_recip(dataType x)
dataType DSPLIB_cascadeBiquad_store_coefficients(uint32_t numStages, void *restrict pFilterCoeff)
template DSPLIB_STATUS DSPLIB_cascadeBiquad_init_ci< float >(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsIn, const DSPLIB_bufParams1D_t *bufParamsFilterCoeff, const DSPLIB_bufParams2D_t *bufParamsFilterVar, const DSPLIB_bufParams2D_t *bufParamsOut, const DSPLIB_cascadeBiquad_InitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_cascadeBiquad_exec_ci< float >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pFilterCoeff, void *restrict pFilterVar, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_cascadeBiquad_exec_cn< float >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pFilterCoeff, void *restrict pFilterVar, void *restrict pOut)
DSPLIB_STATUS DSPLIB_cascadeBiquad_init_cn(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsIn, DSPLIB_bufParams1D_t *bufParamsFilterCoeff, DSPLIB_bufParams2D_t *bufParamsFilterVar, DSPLIB_bufParams2D_t *bufParamsOut, DSPLIB_cascadeBiquad_InitArgs *pKerInitArgs)
This function is the initialization function for the natural C implementation of the kernel....
Header file for kernel's internal use. For the kernel's interface, please see DSPLIB_cascadeBiquad.
DSPLIB_STATUS_NAME
The enumeration of all status codes.
float DSPLIB_F32
Single precision floating point.
void * DSPLIB_kernelHandle
Handle type for DSPLIB operations.
@ DSPLIB_FUNCTION_OPTIMIZED
@ DSPLIB_ERR_NULL_POINTER
@ DSPLIB_ERR_NOT_IMPLEMENTED
@ DSPLIB_ERR_INVALID_TYPE
int32_t DSPLIB_cascadeBiquad_getHandleSize(DSPLIB_cascadeBiquad_InitArgs *pKerInitArgs)
This is a query function to calculate the size of internal handle.
DSPLIB_STATUS DSPLIB_cascadeBiquad_exec(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pFilterCoeff, void *restrict pFilterVar, void *restrict pOut)
This function is the main kernel compute function.
DSPLIB_STATUS DSPLIB_cascadeBiquad_exec_checkParams(DSPLIB_kernelHandle handle, const void *restrict pIn, const void *restrict pFilterCoeff, const void *restrict pFilterVar, const void *restrict pOut)
This function checks the validity of the parameters passed to DSPLIB_cascadeBiquad_exec function....
int32_t DSPLIB_cascadeBiquad_get_coefficientsBufferSize(uint32_t numStages)
This is a query function to calculate the sizes of coefficient buffer needed based on the number of s...
DSPLIB_STATUS DSPLIB_cascadeBiquad_init(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsIn, DSPLIB_bufParams1D_t *bufParamsFilterCoeff, DSPLIB_bufParams2D_t *bufParamsFilterVar, DSPLIB_bufParams2D_t *bufParamsOut, DSPLIB_cascadeBiquad_InitArgs *pKerInitArgs)
This function should be called before the DSPLIB_cascadeBiquad_exec function is called....
DSPLIB_STATUS DSPLIB_cascadeBiquad_init_checkParams(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsIn, const DSPLIB_bufParams1D_t *bufParamsFilterCoeff, const DSPLIB_bufParams2D_t *bufParamsFilterVar, const DSPLIB_bufParams2D_t *bufParamsOut, const DSPLIB_cascadeBiquad_InitArgs *pKerInitArgs)
This function checks the validity of the parameters passed to DSPLIB_cascadeBiquad_init function....
A structure for a 1 dimensional buffer descriptor.
uint32_t dim_x
Width of buffer in X dimension in elements.
uint32_t data_type
Values are of type DSPLIB_data_type_e.
A structure for a 2 dimensional buffer descriptor.
uint32_t data_type
Values are of type DSPLIB_data_type_e.
int32_t stride_y
Stride in Y dimension in bytes.
Structure containing the parameters to initialize the kernel.
int8_t funcStyle
Variant of the function refer to DSPLIB_FUNCTION_STYLE
uint32_t numStages
Size of batch in terms of number of channels of input data
Structure that is reserved for internal use by the kernel.
uint32_t filterCoeff
number of filter coefficients for all stages
uint32_t filterVarPitch
Pitch of filter Variable buffer for different channels DSPLIB_cascadeBiquad_init that will be retriev...
uint32_t dataBufferOutPitch
Pitch of output buffer for different batches DSPLIB_cascadeBiquad_init that will be retrieved and use...
DSPLIB_cascadeBiquad_InitArgs initArgs
Structure holding initialization parameters
uint32_t dataBufferInPitch
Pitch of input buffer for different batches DSPLIB_cascadeBiquad_init that will be retrieved and used...
float outGain
b10*b20*b30*... Gain a11, a12 coefficients
pFxnDSPLIB_cascadeBiquad_exec execute
Function pointer to point to the right execution variant between DSPLIB_cascadeBiquad_exec_cn and DSP...