AnsweredAssumed Answered

How to Use "for loop" to do the assignment for two dimension array?

Question asked by QGingerZ on Jul 15, 2018
Latest reply on Jul 15, 2018 by UweS

Today I am working on my project for assigning the IIR coefficients to a two dimensions array, and I encounter the bug shown as the figure[1] and [2]. As the error is "error: expression must be a pointer to a complete object type", I change "int32_t coe[][]" into "int32_t *coe[][]". However, the problems remain there. Can you help me to debug it?

 

======================================================================code[1]

 

/* Coefficients calculation for peak or notch biquad filter */
static void coeffcalculator(int32_t centrefreq[], int32_t gain[], int32_t qfactor[], int32_t coe[][])
{
int64_t temp64;
int32_t A;
int32_t alpha;
int32_t a0;
for(int i = 0; i<NUM_BAND; i++)
{
/* A */
temp64 = (int64_t) 10^((gain[i])/40);
A = (int32_t) temp64;
/* alpha */
temp64 = (int64_t) sin((2*pi*centrefreq[i])/(2*qfactor[i]));
alpha = (int32_t) temp64;
/* a0 */
temp64 = (int64_t) 1 + alpha/A;
a0 = (int32_t) temp64;
/* b0 */
temp64 = (int64_t) (1 + (alpha*A))/a0 ;
coe[i][0] = (int32_t) (temp64 << 30);
/* b1 */
temp64 = (int64_t) (-2*cos(2*pi*centrefreq[i]/fs))/a0;
coe[i][1] = (int32_t) (temp64 << 30);
/* b2 */
temp64 = (int64_t) (1 - (alpha*A))/a0;
coe[i][2] = (int32_t) (temp64 << 30);
/* -a1 */
temp64 = (int64_t) (2*cos(2*pi*centrefreq[i]/fs))/a0;
coe[i][3] = (int32_t) (temp64 << 30);
/* -a2 */
temp64 = (int64_t) ((alpha/A)-1)/a0;
coe[i][4] = (int32_t) (temp64 << 30);
}

}

 

===========================================================================================

Figure[1] Code preview in CCES 2.8.0

Figure[2] Console preview in CCES 2.8.0

 

Jithul_Janardhanan UweS

Attachments

Outcomes