DSPLIB User Guide
DSPLIB_cascadeBiquad7stage_ci.cpp
Go to the documentation of this file.
1 /******************************************************************************/
5 /* Copyright (C) 2017 Texas Instruments Incorporated - https://www.ti.com/
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the
17  * distribution.
18  *
19  * Neither the name of Texas Instruments Incorporated nor the names of
20  * its contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  *
35  ******************************************************************************/
36 
37 /******************************************************************************
38  * Version 1.0 Date 4/13/22 Author: Asheesh Bhardwaj
39  *****************************************************************************/
40 
41 /*******************************************************************************
42  *
43  * INCLUDES
44  *
45  ******************************************************************************/
46 
47 #include "../common/c71/DSPLIB_inlines.h"
49 
50 template <typename dataType>
52  const DSPLIB_bufParams2D_t *bufParamsIn,
53  const DSPLIB_bufParams1D_t *bufParamsFilterCoeff,
54  const DSPLIB_bufParams2D_t *bufParamsFilterVar,
55  const DSPLIB_bufParams2D_t *bufParamsOut,
56  const DSPLIB_cascadeBiquad_InitArgs *pKerInitArgs)
57 {
59  __SE_TEMPLATE_v1 se1Params;
60 
61  __SA_TEMPLATE_v1 sa0Params;
62  __SA_TEMPLATE_v1 sa1Params;
63  __SA_TEMPLATE_v1 sa2Params;
64  __SA_TEMPLATE_v1 sa3Params;
65 
67  uint8_t *pBlock = pKerPrivArgs->bufPblock;
68  uint32_t dataSize = pKerPrivArgs->initArgs.dataSize;
69  uint32_t numChannels = pKerPrivArgs->initArgs.numChannels;
70  uint32_t numStages = pKerPrivArgs->initArgs.numStages;
71  uint32_t dataBufferInPitch = pKerPrivArgs->dataBufferInPitch;
72  uint32_t dataBufferOutPitch = pKerPrivArgs->dataBufferOutPitch;
73  uint32_t filterVarPitch = pKerPrivArgs->filterVarPitch;
74 
75  __SE_ELEDUP SE_ELEDUP = __SE_ELEDUP_OFF;
76 
77  typedef typename c7x::make_full_vector<dataType>::type vec;
78  __SE_VECLEN SE_VECLEN = c7x::se_veclen<vec>::value;
79  __SA_VECLEN SA_VECLEN = c7x::sa_veclen<vec>::value;
80  __SE_ELETYPE SE_ELETYPE = c7x::se_eletype<vec>::value;
81 
82  uint32_t eleCount = c7x::element_count_of<vec>::value;
83 
84 #if DSPLIB_DEBUGPRINT
85  printf("DSPLIB_DEBUGPRINT Enter DSPLIB_cascadeBiquad7Stage_init_ci\n");
86  printf("DSPLIB_DEBUGPRINT SE_VECLEN: %d, SA_VECLEN: %d, SE_ELETYPE: %d numChannels %d numStages %d\n", SE_VECLEN,
87  SA_VECLEN, SE_ELETYPE, numChannels, numStages);
88 #endif
89 
90  // if (eleCount == 8) {
91  SE_ELEDUP = __SE_ELEDUP_8X;
92  // }
93  // else {
94  // /* Do nothing here */
95  // }
96 
97 #if DSPLIB_DEBUGPRINT
98  printf("DSPLIB_DEBUGPRINT SE_VECLEN: %d, SA_VECLEN: %d, SE_ELETYPE: %d SE_ELEDUP %d eleCount %d __SE_ELEDUP_8X %d\n",
99  SE_VECLEN, SA_VECLEN, SE_ELETYPE, SE_ELEDUP, eleCount, __SE_ELEDUP_8X);
100 #endif
101 
102  uint32_t icnt1Param = (numChannels > eleCount) ? eleCount : numChannels;
103  icnt1Param = (icnt1Param == 0) ? 1 : icnt1Param;
104  uint32_t icnt2Param = (numChannels % eleCount == 0) ? (numChannels / eleCount) : (numChannels + eleCount) / eleCount;
105 
106  /**********************************************************************/
107  /* Prepare streaming engine 1 to fetch the coefficients */
108  /**********************************************************************/
109  se1Params = __gen_SE_TEMPLATE_v1();
110 
111  se1Params.ICNT0 = 1;
112  se1Params.ICNT1 = numStages * 2;
113  se1Params.DIM1 = (int32_t) 1;
114  se1Params.ICNT2 = dataSize;
115  se1Params.DIM2 = 0;
116  se1Params.ICNT3 = icnt2Param;
117  se1Params.DIM3 = 0;
118  se1Params.ELETYPE = SE_ELETYPE;
119  se1Params.VECLEN = SE_VECLEN;
120  se1Params.DECDIM1_WIDTH = numStages * 2;
121  se1Params.DECDIM1 = __SE_DECDIM_DIM1;
122  se1Params.ELEDUP = SE_ELEDUP;
123  se1Params.DIMFMT = __SE_DIMFMT_4D;
124 
125  /**********************************************************************/
126  /* Prepare streaming address generator 2 to fetch the input */
127  /**********************************************************************/
128  sa2Params = __gen_SA_TEMPLATE_v1();
129 
130  sa2Params.ICNT0 = icnt1Param;
131  sa2Params.ICNT1 = dataSize;
132  sa2Params.DIM1 = (int32_t) dataBufferInPitch;
133  sa2Params.ICNT2 = icnt2Param;
134  sa2Params.DIM2 = eleCount;
135  sa2Params.VECLEN = SA_VECLEN;
136  sa2Params.DECDIM1_WIDTH = numChannels;
137  sa2Params.DECDIM1 = __SA_DECDIM_DIM2;
138  sa2Params.DIMFMT = __SA_DIMFMT_3D;
139 
140  /**********************************************************************/
141  /* Prepare streaming address 3 to fetch filter variables */
142  /**********************************************************************/
143  sa3Params = __gen_SA_TEMPLATE_v1();
144 
145  sa3Params.ICNT0 = icnt1Param;
146  sa3Params.ICNT1 = numStages * 2;
147  sa3Params.DIM1 = (int32_t) filterVarPitch;
148  sa3Params.ICNT2 = icnt2Param;
149  sa3Params.DIM2 = eleCount;
150  sa3Params.VECLEN = SA_VECLEN;
151  sa3Params.DECDIM1_WIDTH = numChannels;
152  sa3Params.DECDIM1 = __SA_DECDIM_DIM2;
153  sa3Params.DIMFMT = __SA_DIMFMT_3D;
154 
155  /**********************************************************************/
156  /* Prepare SA template to store output */
157  /**********************************************************************/
158  sa0Params = __gen_SA_TEMPLATE_v1();
159 
160  sa0Params.ICNT0 = icnt1Param;
161  sa0Params.ICNT1 = dataSize;
162  sa0Params.DIM1 = (int32_t) dataBufferOutPitch;
163  sa0Params.ICNT2 = icnt2Param;
164  sa0Params.DIM2 = eleCount;
165  sa0Params.DECDIM1_WIDTH = numChannels;
166  sa0Params.DECDIM1 = __SA_DECDIM_DIM2;
167  sa0Params.DECDIM2_WIDTH = dataBufferOutPitch * dataSize;
168  sa0Params.DECDIM2 = __SA_DECDIM_DIM2;
169  sa0Params.VECLEN = SA_VECLEN;
170  sa0Params.DIMFMT = __SA_DIMFMT_3D;
171 
172  /**********************************************************************/
173  /* Prepare SA template to store filter variables */
174  /**********************************************************************/
175  sa1Params = __gen_SA_TEMPLATE_v1();
176 
177  sa1Params.ICNT0 = icnt1Param;
178  sa1Params.ICNT1 = numStages * 2;
179  sa1Params.DIM1 = (int32_t) filterVarPitch;
180  sa1Params.ICNT2 = icnt2Param;
181  sa1Params.DIM2 = eleCount;
182  sa1Params.DECDIM1_WIDTH = numChannels;
183  sa1Params.DECDIM1 = __SA_DECDIM_DIM2;
184  sa1Params.VECLEN = SA_VECLEN;
185  sa1Params.DIMFMT = __SA_DIMFMT_3D;
186 
187  *(__SE_TEMPLATE_v1 *) ((uint8_t *) pBlock + SE_SE1_PARAM_OFFSET) = se1Params;
188  *(__SA_TEMPLATE_v1 *) ((uint8_t *) pBlock + SE_SA0_PARAM_OFFSET) = sa0Params;
189  *(__SA_TEMPLATE_v1 *) ((uint8_t *) pBlock + SE_SA1_PARAM_OFFSET) = sa1Params;
190  *(__SA_TEMPLATE_v1 *) ((uint8_t *) pBlock + SE_SA2_PARAM_OFFSET) = sa2Params;
191  *(__SA_TEMPLATE_v1 *) ((uint8_t *) pBlock + SE_SA3_PARAM_OFFSET) = sa3Params;
192 
193  return status;
194 }
195 
197  const DSPLIB_bufParams2D_t *bufParamsIn,
198  const DSPLIB_bufParams1D_t *bufParamsFilterCoeff,
199  const DSPLIB_bufParams2D_t *bufParamsFilterVar,
200  const DSPLIB_bufParams2D_t *bufParamsOut,
201  const DSPLIB_cascadeBiquad_InitArgs *pKerInitArgs);
202 /*******************************************************************************
203  *
204  * EXECUTION FUNCTIONS
205  *
206  ******************************************************************************/
207 
208 template <typename dataType>
210  void *restrict pIn,
211  void *restrict pFilterCoeff,
212  void *restrict pFilterVar,
213  void *restrict pOut)
214 {
215  __SE_TEMPLATE_v1 se0Params;
216  __SA_TEMPLATE_v1 sa0Params;
217  __SA_TEMPLATE_v1 sa1Params;
218  __SA_TEMPLATE_v1 sa2Params;
219  __SA_TEMPLATE_v1 sa3Params;
220 
222  uint8_t *pBlock = pKerPrivArgs->bufPblock;
223  uint32_t dataSize = pKerPrivArgs->initArgs.dataSize;
224  // uint32_t batchSize = pKerPrivArgs->initArgs.batchSize;
225  uint32_t numStages = pKerPrivArgs->initArgs.numStages;
226  uint32_t numChannels = pKerPrivArgs->initArgs.numChannels;
227 
228  dataType *pInLocal = (dataType *) pIn;
229  dataType *pFilterCoeffLocal = (dataType *) pFilterCoeff;
230  dataType *pFilterVarLocal = (dataType *) pFilterVar;
231  dataType *pOutLocal = (dataType *) pOut;
232 // dataType outGain = pKerPrivArgs->outGain;
233 #if DSPLIB_DEBUGPRINT
234  printf("Enter DSPLIB_cascadeBiquad7Stage_exec_ci\n");
235 #endif
236 
237  typedef typename c7x::make_full_vector<dataType>::type vec;
238  // typedef vec* vec_ptr;
239  int eleCount = c7x::element_count_of<vec>::value;
240 
241  vec input;
242  vec filter;
243  vec outGain = (vec) (pKerPrivArgs->outGain);
244 
245 #if DSPLIB_DEBUGPRINT
246  printf("Enter pFilterCoeffLocal %p pFilterVarLocal %p\n", pFilterCoeffLocal, pFilterVarLocal);
247 #endif
248 
249  // Filter coefficients
250  se0Params = *(__SE_TEMPLATE_v1 *) ((uint8_t *) pBlock + SE_SE1_PARAM_OFFSET);
251  __SE1_OPEN(pFilterCoeffLocal, se0Params);
252  int32_t offset = ((numStages * 5 + eleCount) / eleCount) * eleCount;
253  __SE0_OPEN(pFilterCoeffLocal + offset, se0Params);
254 
255  // Output samples
256  sa0Params = *(__SA_TEMPLATE_v1 *) ((uint8_t *) pBlock + SE_SA0_PARAM_OFFSET);
257  __SA0_OPEN(sa0Params);
258 
259  // Filter variables write
260  sa1Params = *(__SA_TEMPLATE_v1 *) ((uint8_t *) pBlock + SE_SA1_PARAM_OFFSET);
261  __SA1_OPEN(sa1Params);
262 
263  // Input samples
264  sa2Params = *(__SA_TEMPLATE_v1 *) ((uint8_t *) pBlock + SE_SA2_PARAM_OFFSET);
265  __SA2_OPEN(sa2Params);
266 
267  // Filter variables read
268  sa3Params = *(__SA_TEMPLATE_v1 *) ((uint8_t *) pBlock + SE_SA3_PARAM_OFFSET);
269  __SA3_OPEN(sa3Params);
270 
271 #if DSPLIB_DEBUGPRINT
272  printf("DSPLIB_DEBUGPRINT dataSize %d numChannels %d numStages %d pFilterVarLocal %p\n", dataSize, numChannels,
273  numStages, pFilterVarLocal);
274 #endif
275 
276  vec output1, output2, output3;
277  vec output4, output5, output6, output7, output8, output9;
278  vec temp1_mul_1, temp0_mul_1, d0_temp_1, d1_mul_1;
279  vec temp1_mul_2, temp0_mul_2, d0_temp_2, d1_mul_2;
280  vec temp1_mul_3, temp0_mul_3, d0_temp_3, d1_mul_3;
281  vec temp1_mul_4, temp0_mul_4, d0_temp_4, d1_mul_4;
282  vec temp1_mul_5, temp0_mul_5, d0_temp_5, d1_mul_5;
283  vec temp1_mul_6, temp0_mul_6, d0_temp_6, d1_mul_6;
284  vec temp1_mul_7, temp0_mul_7, d0_temp_7, d1_mul_7;
285  vec temp1_mul_8, temp0_mul_8, d0_temp_8, d1_mul_8;
286  vec temp1_mul_9, temp0_mul_9, d0_temp_9, d1_mul_9;
287  vec temp1_add_1, temp1_add_2, temp1_add_3;
288  vec temp1_add_4, temp1_add_5, temp1_add_6, temp1_add_7, temp1_add_8, temp1_add_9;
289 
290  vec b11_a11, b21_a21, b31_a31, b41_a41, b51_a51, b61_a61, b71_a71, b81_a81, b91_a91;
291  vec b12_a12, b22_a22, b32_a32, b42_a42, b52_a52, b62_a62, b72_a72, b82_a82, b92_a92;
292  vec a11, a12, a22, a21, a31, a32, a41, a42, a51, a52, a61, a62, a71, a72, a81, a82, a91, a92;
293 
294 #if DSPLIB_DEBUGPRINT
295 // DSPLIB_debugPrintVector(b10);
296 // DSPLIB_debugPrintVector(b11);
297 // DSPLIB_debugPrintVector(b12);
298 // DSPLIB_debugPrintVector(b20);
299 // DSPLIB_debugPrintVector(b21);
300 // DSPLIB_debugPrintVector(b22);
301 // DSPLIB_debugPrintVector(b30);
302 // DSPLIB_debugPrintVector(b31);
303 // DSPLIB_debugPrintVector(b32);
304 #endif
305 
306  for (uint32_t chCount = 0; chCount < numChannels; chCount += eleCount) {
307  // Read filter variables
308  __vpred filtVars = c7x::strm_agen<3, c7x::float_vec>::get_vpred();
309  vec *VB4 = c7x::strm_agen<3, c7x::float_vec>::get_adv(pFilterVarLocal);
310  vec filtVars_d0_1 = __vload_pred(filtVars, VB4);
311  filtVars = c7x::strm_agen<3, c7x::float_vec>::get_vpred();
312  VB4 = c7x::strm_agen<3, c7x::float_vec>::get_adv(pFilterVarLocal);
313  vec filtVars_d1_1 = __vload_pred(filtVars, VB4);
314 
315  filtVars = c7x::strm_agen<3, c7x::float_vec>::get_vpred();
316  VB4 = c7x::strm_agen<3, c7x::float_vec>::get_adv(pFilterVarLocal);
317  vec filtVars_d0_2 = __vload_pred(filtVars, VB4);
318  filtVars = c7x::strm_agen<3, c7x::float_vec>::get_vpred();
319  VB4 = c7x::strm_agen<3, c7x::float_vec>::get_adv(pFilterVarLocal);
320  vec filtVars_d1_2 = __vload_pred(filtVars, VB4);
321 
322  filtVars = c7x::strm_agen<3, c7x::float_vec>::get_vpred();
323  VB4 = c7x::strm_agen<3, c7x::float_vec>::get_adv(pFilterVarLocal);
324  vec filtVars_d0_3 = __vload_pred(filtVars, VB4);
325  filtVars = c7x::strm_agen<3, c7x::float_vec>::get_vpred();
326  VB4 = c7x::strm_agen<3, c7x::float_vec>::get_adv(pFilterVarLocal);
327  vec filtVars_d1_3 = __vload_pred(filtVars, VB4);
328 
329  filtVars = c7x::strm_agen<3, c7x::float_vec>::get_vpred();
330  VB4 = c7x::strm_agen<3, c7x::float_vec>::get_adv(pFilterVarLocal);
331  vec filtVars_d0_4 = __vload_pred(filtVars, VB4);
332  filtVars = c7x::strm_agen<3, c7x::float_vec>::get_vpred();
333  VB4 = c7x::strm_agen<3, c7x::float_vec>::get_adv(pFilterVarLocal);
334  vec filtVars_d1_4 = __vload_pred(filtVars, VB4);
335 
336  filtVars = c7x::strm_agen<3, c7x::float_vec>::get_vpred();
337  VB4 = c7x::strm_agen<3, c7x::float_vec>::get_adv(pFilterVarLocal);
338  vec filtVars_d0_5 = __vload_pred(filtVars, VB4);
339  filtVars = c7x::strm_agen<3, c7x::float_vec>::get_vpred();
340  VB4 = c7x::strm_agen<3, c7x::float_vec>::get_adv(pFilterVarLocal);
341  vec filtVars_d1_5 = __vload_pred(filtVars, VB4);
342 
343  filtVars = c7x::strm_agen<3, c7x::float_vec>::get_vpred();
344  VB4 = c7x::strm_agen<3, c7x::float_vec>::get_adv(pFilterVarLocal);
345  vec filtVars_d0_6 = __vload_pred(filtVars, VB4);
346  filtVars = c7x::strm_agen<3, c7x::float_vec>::get_vpred();
347  VB4 = c7x::strm_agen<3, c7x::float_vec>::get_adv(pFilterVarLocal);
348  vec filtVars_d1_6 = __vload_pred(filtVars, VB4);
349 
350  filtVars = c7x::strm_agen<3, c7x::float_vec>::get_vpred();
351  VB4 = c7x::strm_agen<3, c7x::float_vec>::get_adv(pFilterVarLocal);
352  vec filtVars_d0_7 = __vload_pred(filtVars, VB4);
353  filtVars = c7x::strm_agen<3, c7x::float_vec>::get_vpred();
354  VB4 = c7x::strm_agen<3, c7x::float_vec>::get_adv(pFilterVarLocal);
355  vec filtVars_d1_7 = __vload_pred(filtVars, VB4);
356 
357 #if DSPLIB_DEBUGPRINT
358  DSPLIB_debugPrintVector(filtVars_d0_1);
359  DSPLIB_debugPrintVector(filtVars_d1_1);
360  DSPLIB_debugPrintVector(filtVars_d0_2);
361  DSPLIB_debugPrintVector(filtVars_d1_2);
362  DSPLIB_debugPrintVector(filtVars_d0_3);
363  DSPLIB_debugPrintVector(filtVars_d1_3);
364  DSPLIB_debugPrintVector(filtVars_d0_4);
365  DSPLIB_debugPrintVector(filtVars_d1_4);
366  DSPLIB_debugPrintVector(filtVars_d0_5);
367  DSPLIB_debugPrintVector(filtVars_d1_5);
368  DSPLIB_debugPrintVector(filtVars_d0_6);
369  DSPLIB_debugPrintVector(filtVars_d1_6);
370  DSPLIB_debugPrintVector(filtVars_d0_7);
371  DSPLIB_debugPrintVector(filtVars_d1_7);
372 #endif
373  for (uint32_t samp = 0; samp < dataSize; samp++) {
374  // vec tmp1 = c7x::strm_eng<1, vec>::get();
375  __vpred tmpld = c7x::strm_agen<2, c7x::float_vec>::get_vpred();
376  c7x::float_vec *VB3 = c7x::strm_agen<2, c7x::float_vec>::get_adv(pInLocal);
377  c7x::float_vec tmp2 = __vload_pred(tmpld, VB3);
378 
379  output1 = tmp2 + filtVars_d0_1; // output01 = input1 + vd00;
380  b11_a11 = c7x::strm_eng<1, vec>::get_adv();
381 
382  temp1_mul_1 = tmp2 * b11_a11; // t1 = (((b11 + a11) * input1) + vd01) ;
383  temp1_add_1 = temp1_mul_1 + filtVars_d1_1;
384  a12 = c7x::strm_eng<0, vec>::get_adv();
385  temp0_mul_1 = a12 * filtVars_d0_1; // t0 = (a12 * vd00);
386  a11 = c7x::strm_eng<0, vec>::get_adv();
387  d0_temp_1 = a11 * filtVars_d0_1; // vd00 = ((a11 * vd00) + t1) ;
388  filtVars_d0_1 = d0_temp_1 + temp1_add_1;
389  b12_a12 = c7x::strm_eng<1, vec>::get_adv();
390  d1_mul_1 = b12_a12 * tmp2; // vd01 = (((b12 + a12) * input1) + t0) ;
391  filtVars_d1_1 = d1_mul_1 + temp0_mul_1;
392 
393 #if DSPLIB_DEBUGPRINT
394  if (samp < 5) {
395  DSPLIB_debugPrintVector(tmp2);
396  DSPLIB_debugPrintVector(b11_a11);
397  DSPLIB_debugPrintVector(b12_a12);
398  DSPLIB_debugPrintVector(a12);
399  DSPLIB_debugPrintVector(a11);
400  DSPLIB_debugPrintVector(temp1_add_1);
401  DSPLIB_debugPrintVector(temp0_mul_1);
402  DSPLIB_debugPrintVector(filtVars_d0_1);
403  DSPLIB_debugPrintVector(filtVars_d1_1);
404  }
405 #endif
406  // second stage
407  output2 = output1 + filtVars_d0_2; // output02 = (output01 + vd02);
408  b21_a21 = c7x::strm_eng<1, vec>::get_adv();
409  temp1_mul_2 = b21_a21 * output1; // t3 = (((b21 + a21) * output01) + vd03);
410  temp1_add_2 = temp1_mul_2 + filtVars_d1_2;
411  a22 = c7x::strm_eng<0, vec>::get_adv();
412  temp0_mul_2 = a22 * filtVars_d0_2; // t2 = (a22 * vd02);
413  a21 = c7x::strm_eng<0, vec>::get_adv();
414  d0_temp_2 = a21 * filtVars_d0_2; // vd02 = ((a21 * vd02) + t3) ;
415  filtVars_d0_2 = d0_temp_2 + temp1_add_2;
416  b22_a22 = c7x::strm_eng<1, vec>::get_adv();
417  d1_mul_2 = b22_a22 * output1; // vd03 = (((b22 + a22) * output01) + t2) ;
418  filtVars_d1_2 = d1_mul_2 + temp0_mul_2;
419 
420  // third stage
421  output3 = output2 + filtVars_d0_3; // output03 = (output02 + vd04);
422  b31_a31 = c7x::strm_eng<1, vec>::get_adv();
423  temp1_mul_3 = b31_a31 * output2;
424  temp1_add_3 = temp1_mul_3 + filtVars_d1_3; // t5 = (((b31 + a31) * output02) + vd05) ;
425  a32 = c7x::strm_eng<0, vec>::get_adv();
426  temp0_mul_3 = a32 * filtVars_d0_3; // t4 = (a32 * vd04);
427  a31 = c7x::strm_eng<0, vec>::get_adv();
428  d0_temp_3 = a31 * filtVars_d0_3; // vd04 = ((a31 * vd04) + t5) ;
429  filtVars_d0_3 = d0_temp_3 + temp1_add_3;
430  b32_a32 = c7x::strm_eng<1, vec>::get_adv();
431  d1_mul_3 = b32_a32 * output2; // vd05 = (((b32 + a32) * output02) + t4) ;
432  filtVars_d1_3 = d1_mul_3 + temp0_mul_3;
433 
434  // fourth stage
435  output4 = output3 + filtVars_d0_4; // output03 = (output02 + vd04);
436  b41_a41 = c7x::strm_eng<1, vec>::get_adv();
437  temp1_mul_4 = b41_a41 * output3;
438  temp1_add_4 = temp1_mul_4 + filtVars_d1_4; // t5 = (((b31 + a31) * output02) + vd05) ;
439  a42 = c7x::strm_eng<0, vec>::get_adv();
440  temp0_mul_4 = a42 * filtVars_d0_4; // t4 = (a32 * vd04);
441  a41 = c7x::strm_eng<0, vec>::get_adv();
442  d0_temp_4 = a41 * filtVars_d0_4; // vd04 = ((a31 * vd04) + t5) ;
443  filtVars_d0_4 = d0_temp_4 + temp1_add_4;
444  b42_a42 = c7x::strm_eng<1, vec>::get_adv();
445  d1_mul_4 = b42_a42 * output3; // vd05 = (((b32 + a32) * output02) + t4) ;
446  filtVars_d1_4 = d1_mul_4 + temp0_mul_4;
447 
448  // five stage
449  output5 = output4 + filtVars_d0_5; // output03 = (output02 + vd04);
450  b51_a51 = c7x::strm_eng<1, vec>::get_adv();
451  temp1_mul_5 = b51_a51 * output4;
452  temp1_add_5 = temp1_mul_5 + filtVars_d1_5; // t5 = (((b31 + a31) * output02) + vd05) ;
453  a52 = c7x::strm_eng<0, vec>::get_adv();
454  temp0_mul_5 = a52 * filtVars_d0_5; // t4 = (a32 * vd04);
455  a51 = c7x::strm_eng<0, vec>::get_adv();
456  d0_temp_5 = a51 * filtVars_d0_5; // vd04 = ((a31 * vd04) + t5) ;
457  filtVars_d0_5 = d0_temp_5 + temp1_add_5;
458  b52_a52 = c7x::strm_eng<1, vec>::get_adv();
459  d1_mul_5 = b52_a52 * output4; // vd05 = (((b32 + a32) * output02) + t4) ;
460  filtVars_d1_5 = d1_mul_5 + temp0_mul_5;
461 
462  // six stage
463  output6 = output5 + filtVars_d0_6; // output03 = (output02 + vd04);
464  b61_a61 = c7x::strm_eng<1, vec>::get_adv();
465  temp1_mul_6 = b61_a61 * output5;
466  temp1_add_6 = temp1_mul_6 + filtVars_d1_6; // t5 = (((b31 + a31) * output02) + vd05) ;
467  a62 = c7x::strm_eng<0, vec>::get_adv();
468  temp0_mul_6 = a62 * filtVars_d0_6; // t4 = (a32 * vd04);
469  a61 = c7x::strm_eng<0, vec>::get_adv();
470  d0_temp_6 = a61 * filtVars_d0_6; // vd04 = ((a31 * vd04) + t5) ;
471  filtVars_d0_6 = d0_temp_6 + temp1_add_6;
472  b62_a62 = c7x::strm_eng<1, vec>::get_adv();
473  d1_mul_6 = b62_a62 * output5; // vd05 = (((b32 + a32) * output02) + t4) ;
474  filtVars_d1_6 = d1_mul_6 + temp0_mul_6;
475 
476  // seven stage
477  output7 = output6 + filtVars_d0_7; // output03 = (output02 + vd04);
478  b71_a71 = c7x::strm_eng<1, vec>::get_adv();
479  temp1_mul_7 = b71_a71 * output6;
480  temp1_add_7 = temp1_mul_7 + filtVars_d1_7; // t5 = (((b31 + a31) * output02) + vd05) ;
481  a72 = c7x::strm_eng<0, vec>::get_adv();
482  temp0_mul_7 = a72 * filtVars_d0_7; // t4 = (a32 * vd04);
483  a71 = c7x::strm_eng<0, vec>::get_adv();
484  d0_temp_7 = a71 * filtVars_d0_7; // vd04 = ((a31 * vd04) + t5) ;
485  filtVars_d0_7 = d0_temp_7 + temp1_add_7;
486  b72_a72 = c7x::strm_eng<1, vec>::get_adv();
487  d1_mul_7 = b72_a72 * output6; // vd05 = (((b32 + a32) * output02) + t4) ;
488  filtVars_d1_7 = d1_mul_7 + temp0_mul_7;
489 
490  vec output = output7 * outGain;
491  __vpred tmp = c7x::strm_agen<0, vec>::get_vpred();
492  vec *VB1 = c7x::strm_agen<0, vec>::get_adv(pOutLocal);
493  __vstore_pred(tmp, VB1, output);
494 #if DSPLIB_DEBUGPRINT
495  if (samp < 5) {
496  DSPLIB_debugPrintVector(tmp2);
497  DSPLIB_debugPrintVector(output1);
498  DSPLIB_debugPrintVector(output2);
499  DSPLIB_debugPrintVector(output3);
500  DSPLIB_debugPrintVector(output7);
501  // DSPLIB_debugPrintVector(outGain);
502  // DSPLIB_debugPrintVector(output);
503  // DSPLIB_debugPrintVector(outGain);
504  // DSPLIB_debugPrintVector(output3);
505  }
506 #endif
507  }
508 
509  __vpred tmp1 = c7x::strm_agen<1, vec>::get_vpred();
510  vec *VB2 = c7x::strm_agen<1, vec>::get_adv(pFilterVarLocal);
511  __vstore_pred(tmp1, VB2, filtVars_d0_1);
512 
513  tmp1 = c7x::strm_agen<1, vec>::get_vpred();
514  VB2 = c7x::strm_agen<1, vec>::get_adv(pFilterVarLocal);
515  __vstore_pred(tmp1, VB2, filtVars_d1_1);
516 
517  tmp1 = c7x::strm_agen<1, vec>::get_vpred();
518  VB2 = c7x::strm_agen<1, vec>::get_adv(pFilterVarLocal);
519  __vstore_pred(tmp1, VB2, filtVars_d0_2);
520 
521  tmp1 = c7x::strm_agen<1, vec>::get_vpred();
522  VB2 = c7x::strm_agen<1, vec>::get_adv(pFilterVarLocal);
523  __vstore_pred(tmp1, VB2, filtVars_d1_2);
524 
525  tmp1 = c7x::strm_agen<1, vec>::get_vpred();
526  VB2 = c7x::strm_agen<1, vec>::get_adv(pFilterVarLocal);
527  __vstore_pred(tmp1, VB2, filtVars_d0_3);
528 
529  tmp1 = c7x::strm_agen<1, vec>::get_vpred();
530  VB2 = c7x::strm_agen<1, vec>::get_adv(pFilterVarLocal);
531  __vstore_pred(tmp1, VB2, filtVars_d1_3);
532 
533  tmp1 = c7x::strm_agen<1, vec>::get_vpred();
534  VB2 = c7x::strm_agen<1, vec>::get_adv(pFilterVarLocal);
535  __vstore_pred(tmp1, VB2, filtVars_d0_4);
536 
537  tmp1 = c7x::strm_agen<1, vec>::get_vpred();
538  VB2 = c7x::strm_agen<1, vec>::get_adv(pFilterVarLocal);
539  __vstore_pred(tmp1, VB2, filtVars_d1_4);
540 
541  tmp1 = c7x::strm_agen<1, vec>::get_vpred();
542  VB2 = c7x::strm_agen<1, vec>::get_adv(pFilterVarLocal);
543  __vstore_pred(tmp1, VB2, filtVars_d0_5);
544 
545  tmp1 = c7x::strm_agen<1, vec>::get_vpred();
546  VB2 = c7x::strm_agen<1, vec>::get_adv(pFilterVarLocal);
547  __vstore_pred(tmp1, VB2, filtVars_d1_5);
548 
549  tmp1 = c7x::strm_agen<1, vec>::get_vpred();
550  VB2 = c7x::strm_agen<1, vec>::get_adv(pFilterVarLocal);
551  __vstore_pred(tmp1, VB2, filtVars_d0_6);
552 
553  tmp1 = c7x::strm_agen<1, vec>::get_vpred();
554  VB2 = c7x::strm_agen<1, vec>::get_adv(pFilterVarLocal);
555  __vstore_pred(tmp1, VB2, filtVars_d1_6);
556 
557  tmp1 = c7x::strm_agen<1, vec>::get_vpred();
558  VB2 = c7x::strm_agen<1, vec>::get_adv(pFilterVarLocal);
559  __vstore_pred(tmp1, VB2, filtVars_d0_7);
560 
561  tmp1 = c7x::strm_agen<1, vec>::get_vpred();
562  VB2 = c7x::strm_agen<1, vec>::get_adv(pFilterVarLocal);
563  __vstore_pred(tmp1, VB2, filtVars_d1_7);
564  }
565  __SE0_CLOSE();
566  __SE1_CLOSE();
567  __SA0_CLOSE();
568  __SA1_CLOSE();
569  __SA2_CLOSE();
570  return DSPLIB_SUCCESS;
571 }
572 
574  void *restrict pIn,
575  void *restrict pFilterCoeff,
576  void *restrict pFilterVar,
577  void *restrict pOut);
#define SE_SA0_PARAM_OFFSET
#define SE_SE1_PARAM_OFFSET
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)
DSPLIB_STATUS DSPLIB_cascadeBiquad7Stage_exec_ci(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pFilterCoeff, void *restrict pFilterVar, void *restrict pOut)
This function is the main execution function for the C7x implementation of the kernel....
template DSPLIB_STATUS DSPLIB_cascadeBiquad7Stage_exec_ci< float >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pFilterCoeff, void *restrict pFilterVar, void *restrict pOut)
DSPLIB_STATUS DSPLIB_cascadeBiquad7Stage_init_ci(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 is the initialization function for the C7x implementation of the kernel....
Header file for kernel's internal use. For the kernel's interface, please see DSPLIB_cascadeBiquad.
#define SE_SA2_PARAM_OFFSET
#define SE_SA3_PARAM_OFFSET
#define SE_SA1_PARAM_OFFSET
DSPLIB_STATUS_NAME
The enumeration of all status codes.
Definition: DSPLIB_types.h:151
void * DSPLIB_kernelHandle
Handle type for DSPLIB operations.
Definition: DSPLIB_types.h:172
@ DSPLIB_SUCCESS
Definition: DSPLIB_types.h:152
A structure for a 1 dimensional buffer descriptor.
A structure for a 2 dimensional buffer descriptor.
Structure containing the parameters to initialize the kernel.
uint32_t dataSize
Size of input data
uint32_t numChannels
number of channels
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.
uint8_t bufPblock[DSPLIB_CASCADEBIQUAD_PBLOCK_SIZE]
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