File: gjbf.c1 /* 2 * gjbf.c 3 * 4 * Code generation for function 'gjbf' 5 * 6 */ 7 8 /* Include files */ 9 #include "rt_nonfinite.h" 10 #include "gjbf.h" 11 #include "gjbf_emxutil.h" 12 #include "mclms.h" 13 #include "indexShapeCheck.h" 14 #include "bmlms.h" 15 #include "sum.h" 16 #include "delaytracking.h" 17 #include "error.h" 18 #include "isfinite.h" 19 #include "all.h" 20 #include "mod.h" 21 #include "gjbf_data.h" 22 #include "blas.h" 23 24 /* Variable Definitions */ 25 static emlrtRSInfo emlrtRSI = { 84, "gjbf", 26 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 27 28 static emlrtRSInfo b_emlrtRSI = { 85, "gjbf", 29 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 30 31 static emlrtRSInfo c_emlrtRSI = { 88, "gjbf", 32 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 33 34 static emlrtRSInfo d_emlrtRSI = { 91, "gjbf", 35 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 36 37 static emlrtRSInfo e_emlrtRSI = { 92, "gjbf", 38 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 39 40 static emlrtRSInfo f_emlrtRSI = { 93, "gjbf", 41 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 42 43 static emlrtRSInfo g_emlrtRSI = { 95, "gjbf", 44 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 45 46 static emlrtRSInfo h_emlrtRSI = { 98, "gjbf", 47 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 48 49 static emlrtRSInfo i_emlrtRSI = { 101, "gjbf", 50 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 51 52 static emlrtRSInfo j_emlrtRSI = { 104, "gjbf", 53 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 54 55 static emlrtRSInfo k_emlrtRSI = { 108, "gjbf", 56 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 57 58 static emlrtRSInfo l_emlrtRSI = { 111, "gjbf", 59 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 60 61 static emlrtRSInfo m_emlrtRSI = { 113, "gjbf", 62 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 63 64 static emlrtRSInfo n_emlrtRSI = { 114, "gjbf", 65 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 66 67 static emlrtRSInfo o_emlrtRSI = { 116, "gjbf", 68 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 69 70 static emlrtRSInfo p_emlrtRSI = { 117, "gjbf", 71 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 72 73 static emlrtRSInfo q_emlrtRSI = { 122, "gjbf", 74 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 75 76 static emlrtRSInfo r_emlrtRSI = { 123, "gjbf", 77 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 78 79 static emlrtRSInfo s_emlrtRSI = { 124, "gjbf", 80 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 81 82 static emlrtRSInfo t_emlrtRSI = { 125, "gjbf", 83 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 84 85 static emlrtRSInfo u_emlrtRSI = { 126, "gjbf", 86 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 87 88 static emlrtRSInfo v_emlrtRSI = { 127, "gjbf", 89 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 90 91 static emlrtRSInfo w_emlrtRSI = { 128, "gjbf", 92 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 93 94 static emlrtRSInfo x_emlrtRSI = { 130, "gjbf", 95 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 96 97 static emlrtRSInfo y_emlrtRSI = { 131, "gjbf", 98 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 99 100 static emlrtRSInfo ab_emlrtRSI = { 133, "gjbf", 101 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 102 103 static emlrtRSInfo bb_emlrtRSI = { 134, "gjbf", 104 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 105 106 static emlrtRSInfo cb_emlrtRSI = { 138, "gjbf", 107 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 108 109 static emlrtRSInfo db_emlrtRSI = { 142, "gjbf", 110 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 111 112 static emlrtRSInfo eb_emlrtRSI = { 159, "gjbf", 113 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 114 115 static emlrtRSInfo fb_emlrtRSI = { 175, "gjbf", 116 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 117 118 static emlrtRSInfo gb_emlrtRSI = { 183, "gjbf", 119 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 120 121 static emlrtRSInfo hb_emlrtRSI = { 185, "gjbf", 122 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 123 124 static emlrtRTEInfo emlrtRTEI = { 76, 5, "gjbf", 125 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 126 127 static emlrtDCInfo emlrtDCI = { 171, 35, "gjbf", 128 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m", 1 }; 129 130 static emlrtBCInfo emlrtBCI = { -1, -1, 171, 35, "xPrev", "gjbf", 131 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m", 0 }; 132 133 static emlrtDCInfo b_emlrtDCI = { 172, 12, "gjbf", 134 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m", 1 }; 135 136 static emlrtBCInfo b_emlrtBCI = { 1, 882, 172, 12, "x", "gjbf", 137 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m", 0 }; 138 139 static emlrtECInfo emlrtECI = { -1, 171, 5, "gjbf", 140 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m" }; 141 142 static emlrtDCInfo c_emlrtDCI = { 183, 6, "gjbf", 143 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m", 1 }; 144 145 static emlrtBCInfo c_emlrtBCI = { -1, -1, 183, 6, "bp", "gjbf", 146 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m", 0 }; 147 148 static emlrtDCInfo d_emlrtDCI = { 183, 23, "gjbf", 149 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m", 1 }; 150 151 static emlrtBCInfo d_emlrtBCI = { 1, 882, 183, 23, "b", "gjbf", 152 "E:\\micro array project\\Microphone Array\\beamform test\\gjbf.m", 0 }; 153 154 /* Function Definitions */ 155 void gjbf(gjbfStackData *SD, const emlrtStack *sp, const real_T x[14112], real_T 156 fs, const real_T spos[3], const real_T mpos[48], real_T c, real_T p, 157 real_T q, real_T mu, real_T order, real_T beta, const real_T phi[320], 158 const real_T psi[320], real_T K, const emxArray_real_T *xPrev, const 159 real_T bp_data[], const int32_T bp_size[1], const emxArray_real_T *zp, 160 const real_T bw1[320], const real_T mw1[320], real_T snrThresh, real_T 161 snrRate, const real_T snr1[16], real_T iw, real_T y_data[], int32_T 162 y_size[1], emxArray_real_T *bmw, emxArray_real_T *mcWall, real_T 163 snrAll[14112], real_T b_data[], int32_T b_size[1], real_T z[14112], 164 real_T mcAdapt[14112]) 165 { 166 boolean_T b0; 167 boolean_T bv0[14112]; 168 boolean_T bv1[16]; 169 boolean_T bv2[3]; 170 real_T wghts[16]; 171 real_T b[882]; 172 boolean_T bv3[48]; 173 int32_T k; 174 real_T d0; 175 int32_T i0; 176 int32_T i1; 177 int32_T loop_ub; 178 real_T xPrev_data[1764]; 179 int32_T i2; 180 int32_T xPrev_size_idx_0; 181 int32_T iv0[2]; 182 int32_T b_loop_ub; 183 int32_T tmp_size[1]; 184 real_T tmp_data[1764]; 185 int32_T iv1[1]; 186 emxArray_real_T *b_zp; 187 boolean_T bv4[320]; 188 boolean_T bv5[320]; 189 boolean_T guard1 = false; 190 boolean_T guard2 = false; 191 boolean_T b_tmp_data[14112]; 192 int32_T b_tmp_size[2]; 193 boolean_T c_tmp_data[1764]; 194 int32_T c_tmp_size[1]; 195 boolean_T bv6[320]; 196 boolean_T bv7[320]; 197 emlrtStack st; 198 st.prev = sp; 199 st.tls = sp->tls; 200 emlrtHeapReferenceStackEnterFcnR2012b(sp); 201 b0 = false; 202 covrtLogFcn(&emlrtCoverageInstance, 0U, 0); 203 204 /* % Griffiths-Jim Beamformer */ 205 /* *Required Inputs* */ 206 /* * x-Matrix of raw audio data, each column a mic array track */ 207 /* * fs-sampling rate (Hertz) */ 208 /* * spos-3x1 source location point (meters) */ 209 /* * mpos-column matrix of 3D mic positions (meters) */ 210 /* * c- speed of sound (meters per second) */ 211 /* * p-Constant delay placed on all tracks entering the BM */ 212 /* * q-Constant delay placed on DSB output just before final summer */ 213 /* * xPrev-Matrix of audio data from a previous window. */ 214 /* * iw-(optional) if set to 1, the dsb will apply an inverse distance */ 215 /* weighting on the microphones, useful for near-field/immersive */ 216 /* applications. Any other value or its absense will result in */ 217 /* the uniform weight dbs. */ 218 /* *INPUT TO BMLMS* */ 219 /* * mu-step size of the LMS filters in [0, 2] */ 220 /* * order-order of the LMS filters */ 221 /* * beta-forgetting factor of the LMS filters in [0, 1] */ 222 /* * phi and psi-Upper and lower bounds for a CCAF blocking matrix */ 223 /* * bPrev-Vector of DSB output from a previous audio window to the BM LMS filters */ 224 /* * bmWinit-initial tap weights for the BM LMS filters. Set to [] if not needed */ 225 /* */ 226 /* * bmWForce and mcWForce-Cubic matrices of tap weights to force */ 227 /* the BM and MC LMS filters to use. Useful for recreating a */ 228 /* previous GJBF run where taps have already been determined. */ 229 /* */ 230 /* * |snrThresh| and |snrRate| - Parameters for selective adaptation. */ 231 /* |snrRate| times the SNR for each track is estimated as the */ 232 /* 10*log10 ratio of the power of the fixed beamformer to each of */ 233 /* the blocking matrix output tracks. If these estimated SNR's */ 234 /* exceed |snrThresh| then only the BM LMS coefficients are allowed */ 235 /* to adapt while the taps of the MC are kept constant; otherwise */ 236 /* the BM taps are locked and the MC coefficients adapt. Must */ 237 /* specify both |snrThresh| and |snrRate| or neither. */ 238 /* * |snrInit| - Assume this vector of SNR values at the start */ 239 /* OPTION FOR MCLMS */ 240 /* * |K| - Apply a norm constraint to the multiple-input canceller (MC) */ 241 /* LMS filters. Leave blank for no constaint. */ 242 /* * |zPrev| - Matrix of BM output for a previous audio window. Used */ 243 /* as initial input to the MC LMS filters. Supply zeros if no */ 244 /* previous data is available. */ 245 /* * |mcWinit| - Matrix of initial tap weights for the MC LMS */ 246 /* filters. Set to [] if not needed. */ 247 /* OUTPUT */ 248 /* * |b| - Vector of DSB output */ 249 /* *BMLMS Outputs* */ 250 /* * |z| - Matrix of output tracks from the blocking matrix.approximate the noise */ 251 /* in the simulation as closely as possible. This can be checked */ 252 /* to see how much target signal leakage occurs in the beamformer. */ 253 /* */ 254 /* * |bmWall| - Cubic matrix of taps saved from the blocking matrix. */ 255 /* Each matrix (1st and 2nd dims) of the cube will be |order| tall */ 256 /* and |M| wide such that each column is the taps for an adaptive */ 257 /* filter for an individual channel. The 3rd dimension specifies */ 258 /* the iteration of the taps. This matrix can be fed into another */ 259 /* run as |bmWForce|. */ 260 /* mcAdapt - Binary matrix instructing the corresponding filters in */ 261 /* the MC to adapt. */ 262 /* * |snrAll| - Matrix of estimated SNR's at every iteration in dB */ 263 /* (matrix of size NxM) */ 264 /* *MCLMS Outputs* */ 265 /* * |y| - Beamformed output audio track. */ 266 /* * |mcWall| - Cubic matrix of taps saved from the multiple-input */ 267 /* canceller, referenced in the same mammer as |bmWall| and */ 268 /* applicable in subsequent runs as |mcWForce|. */ 269 /* % Function Declaration */ 270 /* % Argument Error Checking */ 271 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 0, false); 272 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 0, false); 273 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 1, true); 274 b_isfinite(x, bv0); 275 st.site = &emlrtRSI; 276 all(&st, bv0, bv1); 277 if (!covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 2, b_all(bv1))) { 278 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 0, true); 279 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 1, true); 280 st.site = &b_emlrtRSI; 281 error(&st); 282 } else { 283 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 0, false); 284 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 1, false); 285 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 3, false); 286 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 4, true); 287 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 5, true); 288 if ((!covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 6, c_isfinite(fs))) || 289 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 7, fs <= 0.0)) { 290 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 1, true); 291 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 2, true); 292 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 1); 293 st.site = &c_emlrtRSI; 294 b_error(&st); 295 } else { 296 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 1, false); 297 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 2, false); 298 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 8, true); 299 d_isfinite(spos, bv2); 300 if (!covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 9, c_all(bv2))) { 301 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 2, true); 302 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 3, true); 303 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 2); 304 st.site = &d_emlrtRSI; 305 c_error(&st); 306 } else { 307 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 10, false); 308 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 11, false); 309 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 12, false); 310 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 2, false); 311 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 3, false); 312 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 13, true); 313 e_isfinite(mpos, bv3); 314 st.site = &e_emlrtRSI; 315 d_all(&st, bv3, bv1); 316 if (!covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 14, b_all(bv1))) { 317 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 3, true); 318 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 4, true); 319 st.site = &f_emlrtRSI; 320 d_error(&st); 321 } else { 322 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 15, false); 323 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 3, false); 324 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 4, false); 325 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 16, true); 326 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 17, true); 327 if ((!covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 18, c_isfinite(c))) 328 || covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 19, c <= 0.0)) { 329 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 4, true); 330 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 5, true); 331 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 3); 332 st.site = &g_emlrtRSI; 333 e_error(&st); 334 } else { 335 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 4, false); 336 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 5, false); 337 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 20, false); 338 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 21, true); 339 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 22, true); 340 if ((!covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 23, c_isfinite(p))) 341 || covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 24, p < 0.0) || 342 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 25, 343 muDoubleScalarAbs(b_mod(p, muDoubleScalarFloor(p))) 344 > 0.0)) { 345 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 5, true); 346 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 6, true); 347 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 4); 348 st.site = &h_emlrtRSI; 349 f_error(&st); 350 } else { 351 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 5, false); 352 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 6, false); 353 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 26, false); 354 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 27, true); 355 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 28, true); 356 if ((!covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 29, c_isfinite 357 (q))) || covrtLogCond(&emlrtCoverageInstance, 358 0U, 0U, 30, q < 0.0) || covrtLogCond(&emlrtCoverageInstance, 359 0U, 0U, 31, muDoubleScalarAbs(b_mod(q, muDoubleScalarFloor(q))) 360 > 0.0)) { 361 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 6, true); 362 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 7, true); 363 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 5); 364 st.site = &i_emlrtRSI; 365 g_error(&st); 366 } else { 367 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 6, false); 368 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 7, false); 369 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 32, false); 370 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 33, true); 371 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 34, true); 372 if (!covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 35, c_isfinite 373 (mu))) { 374 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 7, true); 375 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 8, true); 376 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 6); 377 st.site = &j_emlrtRSI; 378 h_error(&st); 379 } else { 380 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 7, false); 381 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 8, false); 382 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 36, false); 383 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 37, true); 384 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 38, true); 385 if ((!covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 39, 386 c_isfinite(order))) || covrtLogCond 387 (&emlrtCoverageInstance, 0U, 0U, 40, order < 0.0) || 388 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 41, 389 muDoubleScalarAbs(b_mod(order, 390 muDoubleScalarFloor(order))) > 0.0)) { 391 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 8, true); 392 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 9, true); 393 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 7); 394 st.site = &k_emlrtRSI; 395 i_error(&st); 396 } else { 397 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 8, false); 398 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 9, false); 399 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 42, false); 400 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 43, true); 401 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 44, true); 402 if ((!covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 45, 403 c_isfinite(beta))) || covrtLogCond 404 (&emlrtCoverageInstance, 0U, 0U, 46, beta < 0.0) || 405 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 47, beta > 406 1.0)) { 407 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 9, true); 408 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 10, true); 409 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 8); 410 st.site = &l_emlrtRSI; 411 j_error(&st); 412 } else { 413 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 9, false); 414 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 10, false); 415 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 48, false); 416 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 49, false); 417 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 50, true); 418 f_isfinite(phi, bv4); 419 st.site = &m_emlrtRSI; 420 e_all(&st, bv4, bv1); 421 if (!covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 51, 422 b_all(bv1))) { 423 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 10, true); 424 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 11, true); 425 st.site = &n_emlrtRSI; 426 k_error(&st); 427 } else { 428 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 10, false); 429 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 11, false); 430 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 52, false); 431 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 53, false); 432 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 54, true); 433 f_isfinite(psi, bv5); 434 st.site = &o_emlrtRSI; 435 e_all(&st, bv5, bv1); 436 if (!covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 55, 437 b_all(bv1))) { 438 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 11, true); 439 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 12, true); 440 st.site = &p_emlrtRSI; 441 l_error(&st); 442 } else { 443 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 11, false); 444 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 12, false); 445 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 13, false); 446 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 56, false); 447 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 57, true); 448 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 58, true); 449 if ((!covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 59, 450 c_isfinite(K))) || covrtLogCond 451 (&emlrtCoverageInstance, 0U, 0U, 60, K < 0.0)) { 452 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 12, 453 true); 454 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 14, true); 455 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 9); 456 st.site = &q_emlrtRSI; 457 m_error(&st); 458 } else { 459 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 12, 460 false); 461 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 14, false); 462 guard1 = false; 463 guard2 = false; 464 if (covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 61, 465 xPrev->size[0] == 0)) { 466 guard2 = true; 467 } else { 468 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 62, 469 true); 470 g_isfinite(xPrev, b_tmp_data, b_tmp_size); 471 st.site = &r_emlrtRSI; 472 f_all(&st, b_tmp_data, b_tmp_size, bv1); 473 if (!covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 474 63, b_all(bv1))) { 475 guard2 = true; 476 } else { 477 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 13, 478 false); 479 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 15, 480 false); 481 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 64, 482 true); 483 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 65, 484 true); 485 h_isfinite(bp_data, bp_size, c_tmp_data, 486 c_tmp_size); 487 st.site = &t_emlrtRSI; 488 if (!covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 489 66, g_all(&st, c_tmp_data, 490 c_tmp_size))) { 491 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 492 14, true); 493 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 16, 494 true); 495 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 496 10); 497 st.site = &u_emlrtRSI; 498 o_error(&st); 499 } else { 500 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 501 14, false); 502 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 16, 503 false); 504 if (covrtLogCond(&emlrtCoverageInstance, 0U, 505 0U, 67, zp->size[0] == 0)) { 506 guard1 = true; 507 } else { 508 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 509 68, true); 510 g_isfinite(zp, b_tmp_data, b_tmp_size); 511 st.site = &v_emlrtRSI; 512 f_all(&st, b_tmp_data, b_tmp_size, bv1); 513 if (!covrtLogCond(&emlrtCoverageInstance, 0U, 514 0U, 69, b_all(bv1))) { 515 guard1 = true; 516 } else { 517 covrtLogMcdc(&emlrtCoverageInstance, 0U, 518 0U, 15, false); 519 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 520 17, false); 521 covrtLogCond(&emlrtCoverageInstance, 0U, 522 0U, 70, false); 523 covrtLogCond(&emlrtCoverageInstance, 0U, 524 0U, 71, true); 525 f_isfinite(bw1, bv6); 526 st.site = &x_emlrtRSI; 527 e_all(&st, bv6, bv1); 528 if (!covrtLogCond(&emlrtCoverageInstance, 529 0U, 0U, 72, b_all(bv1))) 530 { 531 covrtLogMcdc(&emlrtCoverageInstance, 0U, 532 0U, 16, true); 533 covrtLogIf(&emlrtCoverageInstance, 0U, 534 0U, 18, true); 535 st.site = &y_emlrtRSI; 536 q_error(&st); 537 } else { 538 covrtLogMcdc(&emlrtCoverageInstance, 0U, 539 0U, 16, false); 540 covrtLogIf(&emlrtCoverageInstance, 0U, 541 0U, 18, false); 542 covrtLogCond(&emlrtCoverageInstance, 0U, 543 0U, 73, false); 544 covrtLogCond(&emlrtCoverageInstance, 0U, 545 0U, 74, true); 546 f_isfinite(mw1, bv7); 547 st.site = &ab_emlrtRSI; 548 e_all(&st, bv7, bv1); 549 if (!covrtLogCond(&emlrtCoverageInstance, 550 0U, 0U, 75, b_all(bv1))) 551 { 552 covrtLogMcdc(&emlrtCoverageInstance, 553 0U, 0U, 17, true); 554 covrtLogIf(&emlrtCoverageInstance, 0U, 555 0U, 19, true); 556 st.site = &bb_emlrtRSI; 557 r_error(&st); 558 } else { 559 covrtLogMcdc(&emlrtCoverageInstance, 560 0U, 0U, 17, false); 561 covrtLogIf(&emlrtCoverageInstance, 0U, 562 0U, 19, false); 563 covrtLogCond(&emlrtCoverageInstance, 564 0U, 0U, 76, false); 565 covrtLogCond(&emlrtCoverageInstance, 566 0U, 0U, 77, true); 567 covrtLogCond(&emlrtCoverageInstance, 568 0U, 0U, 78, true); 569 if (!covrtLogCond 570 (&emlrtCoverageInstance, 0U, 0U, 571 79, c_isfinite(snrThresh))) { 572 covrtLogMcdc(&emlrtCoverageInstance, 573 0U, 0U, 18, true); 574 covrtLogIf(&emlrtCoverageInstance, 575 0U, 0U, 20, true); 576 st.site = &cb_emlrtRSI; 577 s_error(&st); 578 } else { 579 covrtLogMcdc(&emlrtCoverageInstance, 580 0U, 0U, 18, false); 581 covrtLogIf(&emlrtCoverageInstance, 582 0U, 0U, 20, false); 583 covrtLogCond(&emlrtCoverageInstance, 584 0U, 0U, 80, false); 585 covrtLogCond(&emlrtCoverageInstance, 586 0U, 0U, 81, true); 587 covrtLogCond(&emlrtCoverageInstance, 588 0U, 0U, 82, true); 589 if ((!covrtLogCond 590 (&emlrtCoverageInstance, 0U, 0U, 591 83, c_isfinite(snrRate))) || 592 covrtLogCond 593 (&emlrtCoverageInstance, 0U, 0U, 594 84, snrRate <= 0.0)) { 595 covrtLogMcdc 596 (&emlrtCoverageInstance, 0U, 0U, 597 19, true); 598 covrtLogIf(&emlrtCoverageInstance, 599 0U, 0U, 21, true); 600 st.site = &db_emlrtRSI; 601 t_error(&st); 602 } else { 603 covrtLogMcdc 604 (&emlrtCoverageInstance, 0U, 0U, 605 19, false); 606 covrtLogIf(&emlrtCoverageInstance, 607 0U, 0U, 21, false); 608 covrtLogIf(&emlrtCoverageInstance, 609 0U, 0U, 22, false); 610 } 611 } 612 } 613 } 614 } 615 } 616 } 617 } 618 } 619 620 if (guard2) { 621 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 13, 622 true); 623 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 15, 624 true); 625 st.site = &s_emlrtRSI; 626 n_error(&st); 627 } 628 629 if (guard1) { 630 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 15, 631 true); 632 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 17, 633 true); 634 st.site = &w_emlrtRSI; 635 p_error(&st); 636 } 637 } 638 } 639 } 640 } 641 } 642 } 643 } 644 } 645 } 646 } 647 } 648 } 649 } 650 651 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 11); 652 653 /* % Setup */ 654 /* number of samples in track, mics in array */ 655 /* SNR parameters */ 656 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 23, false); 657 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 13); 658 659 /* apply SNR thresholds */ 660 /* all estimated SNRs mat */ 661 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 14); 662 663 /* % Fixed Beamformer (FBF) */ 664 /* Find the distances of each mic to the source, calculate the */ 665 /* time-difference of arrival, and then add shifted waveforms. */ 666 st.site = &eb_emlrtRSI; 667 delaytracking(&st, x, xPrev, fs, spos, mpos, c, iw, SD->f0.xShift, wghts); 668 b_sum(SD->f0.xShift, b); 669 670 /* add data across columns */ 671 /* % Blocking Matrix (BM) */ 672 covrtLogCond(&emlrtCoverageInstance, 0U, 0U, 85, false); 673 covrtLogMcdc(&emlrtCoverageInstance, 0U, 0U, 20, false); 674 covrtLogIf(&emlrtCoverageInstance, 0U, 0U, 24, false); 675 676 /* call function for adaptive BM */ 677 /* Apply p delays to each xShift column */ 678 k = 0; 679 while (k < 16) { 680 covrtLogFor(&emlrtCoverageInstance, 0U, 0U, 0, 1); 681 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 16); 682 d0 = ((real_T)xPrev->size[0] - p) + 1.0; 683 if (d0 > xPrev->size[0]) { 684 i0 = 1; 685 i1 = 1; 686 } else { 687 if (d0 != (int32_T)muDoubleScalarFloor(d0)) { 688 emlrtIntegerCheckR2012b(d0, &emlrtDCI, sp); 689 } 690 691 i1 = xPrev->size[0]; 692 i0 = (int32_T)d0; 693 if (!((i0 >= 1) && (i0 <= i1))) { 694 emlrtDynamicBoundsCheckR2012b(i0, 1, i1, &emlrtBCI, sp); 695 } 696 697 i1 = xPrev->size[0]; 698 i2 = xPrev->size[0]; 699 if (!((i2 >= 1) && (i2 <= i1))) { 700 emlrtDynamicBoundsCheckR2012b(i2, 1, i1, &emlrtBCI, sp); 701 } 702 703 i1 = i2 + 1; 704 } 705 706 if (1.0 > 882.0 - p) { 707 loop_ub = 0; 708 } else { 709 d0 = 882.0 - p; 710 if (d0 != (int32_T)muDoubleScalarFloor(d0)) { 711 emlrtIntegerCheckR2012b(d0, &b_emlrtDCI, sp); 712 } 713 714 loop_ub = (int32_T)d0; 715 if (!((loop_ub >= 1) && (loop_ub <= 882))) { 716 emlrtDynamicBoundsCheckR2012b(loop_ub, 1, 882, &b_emlrtBCI, sp); 717 } 718 } 719 720 xPrev_size_idx_0 = (i1 - i0) + loop_ub; 721 b_loop_ub = i1 - i0; 722 for (i2 = 0; i2 < b_loop_ub; i2++) { 723 xPrev_data[i2] = xPrev->data[((i0 + i2) + xPrev->size[0] * k) - 1]; 724 } 725 726 for (i2 = 0; i2 < loop_ub; i2++) { 727 xPrev_data[(i2 + i1) - i0] = x[i2 + 882 * k]; 728 } 729 730 tmp_size[0] = xPrev_size_idx_0; 731 for (i1 = 0; i1 < xPrev_size_idx_0; i1++) { 732 tmp_data[i1] = wghts[k] * xPrev_data[i1]; 733 } 734 735 if (!b0) { 736 iv1[0] = 882; 737 b0 = true; 738 } 739 740 emlrtSubAssignSizeCheckR2012b(iv1, 1, tmp_size, 1, &emlrtECI, sp); 741 memcpy(&SD->f0.xShift[k * 882], &tmp_data[0], 882U * sizeof(real_T)); 742 k++; 743 if (*emlrtBreakCheckR2012bFlagVar != 0) { 744 emlrtBreakCheckR2012b(sp); 745 } 746 } 747 748 covrtLogFor(&emlrtCoverageInstance, 0U, 0U, 0, 0); 749 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 17); 750 751 /* Call external function to handle BM calculations */ 752 st.site = &fb_emlrtRSI; 753 bmlms(&st, SD->f0.xShift, b, mu, order, beta, phi, psi, bp_data, bp_size, bw1, 754 snrThresh, snrRate, snr1, z, bmw, mcAdapt, snrAll); 755 covrtLogBasicBlock(&emlrtCoverageInstance, 0U, 18); 756 757 /* % Multiple Input Canceller (MC) */ 758 /* Apply q delay to the DSB vector before running the MC */ 759 d0 = ((real_T)bp_size[0] - q) + 1.0; 760 if (d0 > bp_size[0]) { 761 i1 = 1; 762 i0 = 1; 763 } else { 764 if (d0 != (int32_T)muDoubleScalarFloor(d0)) { 765 emlrtIntegerCheckR2012b(d0, &c_emlrtDCI, sp); 766 } 767 768 i1 = (int32_T)d0; 769 if (!((i1 >= 1) && (i1 <= bp_size[0]))) { 770 emlrtDynamicBoundsCheckR2012b(i1, 1, bp_size[0], &c_emlrtBCI, sp); 771 } 772 773 if (!(bp_size[0] >= 1)) { 774 emlrtDynamicBoundsCheckR2012b(bp_size[0], 1, bp_size[0], &c_emlrtBCI, sp); 775 } 776 777 i0 = bp_size[0] + 1; 778 } 779 780 iv0[0] = 1; 781 iv0[1] = i0 - i1; 782 st.site = &gb_emlrtRSI; 783 indexShapeCheck(&st, bp_size[0], iv0); 784 if (1.0 > 882.0 - q) { 785 loop_ub = 0; 786 } else { 787 d0 = 882.0 - q; 788 if (d0 != (int32_T)muDoubleScalarFloor(d0)) { 789 emlrtIntegerCheckR2012b(d0, &d_emlrtDCI, sp); 790 } 791 792 loop_ub = (int32_T)d0; 793 if (!((loop_ub >= 1) && (loop_ub <= 882))) { 794 emlrtDynamicBoundsCheckR2012b(loop_ub, 1, 882, &d_emlrtBCI, sp); 795 } 796 } 797 798 b_size[0] = (i0 - i1) + loop_ub; 799 b_loop_ub = i0 - i1; 800 for (i2 = 0; i2 < b_loop_ub; i2++) { 801 b_data[i2] = bp_data[(i1 + i2) - 1]; 802 } 803 804 for (i2 = 0; i2 < loop_ub; i2++) { 805 b_data[(i2 + i0) - i1] = b[i2]; 806 } 807 808 emxInit_real_T(sp, &b_zp, 2, &emlrtRTEI, true); 809 810 /* Call external function for calculations */ 811 i1 = b_zp->size[0] * b_zp->size[1]; 812 b_zp->size[0] = zp->size[0]; 813 b_zp->size[1] = 16; 814 emxEnsureCapacity(sp, (emxArray__common *)b_zp, i1, (int32_T)sizeof(real_T), 815 &emlrtRTEI); 816 loop_ub = zp->size[0] * zp->size[1]; 817 for (i1 = 0; i1 < loop_ub; i1++) { 818 b_zp->data[i1] = zp->data[i1]; 819 } 820 821 st.site = &hb_emlrtRSI; 822 mclms(&st, z, b_data, b_size, mu, order, beta, b_zp, mw1, mcAdapt, K, y_data, 823 y_size, mcWall); 824 825 /* function gjbf */ 826 emxFree_real_T(&b_zp); 827 emlrtHeapReferenceStackLeaveFcnR2012b(sp); 828 } 829 830 /* End of code generation (gjbf.c) */ 831 |