32 int hop, i, j, k, nSH, nGrid, rand_idx, dropouts;
36 float measNoiseSD_deg, noiseSpecDen_deg, scale, rand01;
37 float est_dirs_deg[2][2], est_dirs_xyz[2][3];
39 float** insigs, **inputSH, **inputSH_noise, **inputSH_hop, **Y, **Cx, **V, **Vn;
40 float_complex** Vn_cmplx;
42 float *target_dirs_xyz, *target_var_xyz;
45 const float acceptedTolerance = 0.005f;
47 const float fs = 48e3;
48 const int hopsize = 128;
49 const int sigLen = (int)fs*5;
50 const int nSources = 2;
51 const float src_dirs_deg[2][2] = { {-35.0f, 30.0f}, {120.0f, 0.0f} };
65 measNoiseSD_deg = 20.0f;
69 noiseSpecDen_deg = 1.0f;
79 tpars.
dt = 1.0f/(fs/(float)hopsize);
89 tpars.
M0[0] = 1.0f; tpars.
M0[1] = 0.0f; tpars.
M0[2] = 0.0f;
91 tpars.
M0[3] = 0.0f; tpars.
M0[4] = 0.0f; tpars.
M0[5] = 0.0f;
94 const float Vazi_deg = 3.0f;
95 const float Vele_deg = 3.0f;
96 memset(tpars.
P0, 0, 6*6*
sizeof(
float));
100 tpars.
P0[0][0] = 4.0f; tpars.
P0[1][1] = 4.0f; tpars.
P0[2][2] = 4.0f;
102 tpars.
P0[3][3] = 1.0f-cosf(Vazi_deg*
SAF_PI/180.0f);
103 tpars.
P0[4][4] = tpars.
P0[3][3];
104 tpars.
P0[5][5] = 1.0f-cosf(Vele_deg*
SAF_PI/180.0f);
113 insigs = (
float**)
malloc2d(nSources, sigLen,
sizeof(
float));
116 Y = (
float**)
malloc2d(nSH, nSources,
sizeof(
float));
118 scale = 1.0f/(float)nSources;
120 inputSH = (
float**)
malloc2d(nSH, sigLen,
sizeof(
float));
121 cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, nSH, sigLen, nSources, 1.0f,
127 inputSH_noise = (
float**)
malloc2d(nSH, sigLen,
sizeof(
float));
139 inputSH_hop = (
float**)
malloc2d(nSH, hopsize,
sizeof(
float));
140 Cx = (
float**)
malloc2d(nSH, nSH,
sizeof(
float));
141 V = (
float**)
malloc2d(nSH, nSH,
sizeof(
float));
142 Vn = (
float**)
malloc2d(nSH, (nSH-nSources),
sizeof(float));
143 Vn_cmplx = (float_complex**)
malloc2d(nSH, (nSH-nSources),
sizeof(float_complex));
144 target_dirs_xyz = NULL;
145 target_var_xyz = NULL;
150 for(hop=0; hop<(int)((
float)sigLen/(float)hopsize); hop++){
153 memcpy(inputSH_hop[i], &inputSH[i][hop*hopsize], hopsize*
sizeof(
float));
157 cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasTrans, nSH, nSH, hopsize, 1.0f,
163 for(j=0, k=nSources; j<nSH-nSources; j++, k++)
166 for(j=0; j<nSH-nSources; j++)
167 Vn_cmplx[i][j] = cmplxf(Vn[i][j], 0.0f);
171 est_dirs_deg[0][0] = grid_dirs_deg[inds[0]*2+0];
172 est_dirs_deg[0][1] = grid_dirs_deg[inds[0]*2+1];
173 est_dirs_deg[1][0] = grid_dirs_deg[inds[1]*2+0];
174 est_dirs_deg[1][1] = grid_dirs_deg[inds[1]*2+1];
175 unitSph2cart((
float*)est_dirs_deg, nSources, 1, (
float*)est_dirs_xyz);
179 rand_idx = (int)(rand01*(
float)nSources);
182 tracker3d_step(hT3d, (
float*)&est_dirs_xyz[rand_idx], 1, &target_dirs_xyz, &target_var_xyz, &target_IDs, &nTargets);
186 if(nTargets==nSources){
187 TEST_ASSERT_TRUE( fabsf(est_dirs_xyz[0][0] - target_dirs_xyz[0*3+0]) <= acceptedTolerance ||
188 fabsf(est_dirs_xyz[0][0] - target_dirs_xyz[1*3+0]) <= acceptedTolerance);
189 TEST_ASSERT_TRUE( fabsf(est_dirs_xyz[0][1] - target_dirs_xyz[0*3+1]) <= acceptedTolerance ||
190 fabsf(est_dirs_xyz[0][1] - target_dirs_xyz[1*3+1]) <= acceptedTolerance);
191 TEST_ASSERT_TRUE( fabsf(est_dirs_xyz[0][2] - target_dirs_xyz[0*3+2]) <= acceptedTolerance ||
192 fabsf(est_dirs_xyz[0][2] - target_dirs_xyz[1*3+2]) <= acceptedTolerance);
193 TEST_ASSERT_TRUE( fabsf(est_dirs_xyz[1][0] - target_dirs_xyz[0*3+0]) <= acceptedTolerance ||
194 fabsf(est_dirs_xyz[1][0] - target_dirs_xyz[1*3+0]) <= acceptedTolerance);
195 TEST_ASSERT_TRUE( fabsf(est_dirs_xyz[1][1] - target_dirs_xyz[0*3+1]) <= acceptedTolerance ||
196 fabsf(est_dirs_xyz[1][1] - target_dirs_xyz[1*3+1]) <= acceptedTolerance);
197 TEST_ASSERT_TRUE( fabsf(est_dirs_xyz[1][2] - target_dirs_xyz[0*3+2]) <= acceptedTolerance ||
198 fabsf(est_dirs_xyz[1][2] - target_dirs_xyz[1*3+2]) <= acceptedTolerance);
204 TEST_ASSERT_TRUE(dropouts<12);
209 free(target_dirs_xyz);
210 free(target_var_xyz);