File: targbm.c1 /* 2 * targbm.c 3 * 4 * Code generation for function 'targbm' 5 * 6 */ 7 8 /* Include files */ 9 #include "rt_nonfinite.h" 10 #include "gjbf.h" 11 #include "targbm.h" 12 #include "mclms.h" 13 #include "indexShapeCheck.h" 14 #include "gjbf_mexutil.h" 15 #include "gjbf_data.h" 16 #include "blas.h" 17 18 /* Variable Definitions */ 19 static emlrtRSInfo vc_emlrtRSI = { 15, "targbm", 20 "E:\\micro array project\\Microphone Array\\beamform test\\targbm.m" }; 21 22 static emlrtRSInfo wc_emlrtRSI = { 12, "targbm", 23 "E:\\micro array project\\Microphone Array\\beamform test\\targbm.m" }; 24 25 static emlrtRSInfo xc_emlrtRSI = { 5, "targbm", 26 "E:\\micro array project\\Microphone Array\\beamform test\\targbm.m" }; 27 28 static emlrtBCInfo h_emlrtBCI = { -1, -1, 5, 17, "bp", "targbm", 29 "E:\\micro array project\\Microphone Array\\beamform test\\targbm.m", 0 }; 30 31 static emlrtBCInfo i_emlrtBCI = { 1, 882, 7, 18, "b", "targbm", 32 "E:\\micro array project\\Microphone Array\\beamform test\\targbm.m", 0 }; 33 34 /* Function Definitions */ 35 void targbm(const emlrtStack *sp, const real_T bp_data[], const int32_T bp_size 36 [1], const real_T b[882], const real_T x[14112], real_T n, real_T 37 order, const real_T w[320], real_T z[14112], real_T bWin_data[], 38 int32_T bWin_size[1]) 39 { 40 real_T d2; 41 int32_T k; 42 int32_T i35; 43 int32_T iv56[2]; 44 int32_T loop_ub; 45 int32_T i36; 46 real_T a[320]; 47 real_T y[16]; 48 boolean_T bv19[16]; 49 boolean_T bv20[16]; 50 boolean_T b_y; 51 boolean_T exitg1; 52 const mxArray *c_y; 53 char_T u[19]; 54 static const char_T varargin_1[19] = { 'O', 'u', 't', 'p', 'u', 't', ' ', 'h', 55 'a', 's', ' ', 'b', 'l', 'o', 'w', 'n', ' ', 'u', 'p' }; 56 57 const mxArray *m28; 58 static const int32_T iv57[2] = { 1, 19 }; 59 60 emlrtStack st; 61 emlrtStack b_st; 62 st.prev = sp; 63 st.tls = sp->tls; 64 b_st.prev = &st; 65 b_st.tls = st.tls; 66 covrtLogFcn(&emlrtCoverageInstance, 4U, 0); 67 68 /* Select the data window (column vector) and ouput adapf */ 69 if (covrtLogIf(&emlrtCoverageInstance, 4U, 0U, 0, n <= order)) { 70 covrtLogBasicBlock(&emlrtCoverageInstance, 4U, 0); 71 72 /* feed in supplied past values ahead of b */ 73 d2 = (((real_T)bp_size[0] - order) + n) + 1.0; 74 if (d2 > bp_size[0]) { 75 k = 1; 76 i35 = 1; 77 } else { 78 k = (int32_T)d2; 79 if (!((k >= 1) && (k <= bp_size[0]))) { 80 emlrtDynamicBoundsCheckR2012b(k, 1, bp_size[0], &h_emlrtBCI, sp); 81 } 82 83 if (!(bp_size[0] >= 1)) { 84 emlrtDynamicBoundsCheckR2012b(bp_size[0], 1, bp_size[0], &h_emlrtBCI, sp); 85 } 86 87 i35 = bp_size[0] + 1; 88 } 89 90 iv56[0] = 1; 91 iv56[1] = i35 - k; 92 st.site = &xc_emlrtRSI; 93 indexShapeCheck(&st, bp_size[0], iv56); 94 bWin_size[0] = (i35 - k) + (int32_T)n; 95 loop_ub = i35 - k; 96 for (i36 = 0; i36 < loop_ub; i36++) { 97 bWin_data[i36] = bp_data[(k + i36) - 1]; 98 } 99 100 loop_ub = (int32_T)n; 101 for (i36 = 0; i36 < loop_ub; i36++) { 102 bWin_data[(i36 + i35) - k] = b[i36]; 103 } 104 } else { 105 covrtLogBasicBlock(&emlrtCoverageInstance, 4U, 1); 106 107 /* need only data from given b */ 108 d2 = (n - order) + 1.0; 109 if (d2 > n) { 110 k = 0; 111 i35 = 0; 112 } else { 113 k = (int32_T)d2; 114 if (!((k >= 1) && (k <= 882))) { 115 emlrtDynamicBoundsCheckR2012b(k, 1, 882, &i_emlrtBCI, sp); 116 } 117 118 k--; 119 i35 = (int32_T)n; 120 } 121 122 bWin_size[0] = i35 - k; 123 loop_ub = i35 - k; 124 for (i35 = 0; i35 < loop_ub; i35++) { 125 bWin_data[i35] = b[k + i35]; 126 } 127 } 128 129 covrtLogBasicBlock(&emlrtCoverageInstance, 4U, 2); 130 131 /* initial w ,and calculate output y */ 132 st.site = &wc_emlrtRSI; 133 for (k = 0; k < 20; k++) { 134 for (i35 = 0; i35 < 16; i35++) { 135 a[i35 + (k << 4)] = w[k + 20 * i35]; 136 } 137 } 138 139 b_st.site = &bd_emlrtRSI; 140 if (!(20 == bWin_size[0])) { 141 if (bWin_size[0] == 1) { 142 emlrtErrorWithMessageIdR2012b(&b_st, &x_emlrtRTEI, 143 "Coder:toolbox:mtimes_noDynamicScalarExpansion", 0); 144 } else { 145 emlrtErrorWithMessageIdR2012b(&b_st, &y_emlrtRTEI, "Coder:MATLAB:innerdim", 146 0); 147 } 148 } 149 150 b_st.site = &ad_emlrtRSI; 151 for (k = 0; k < 16; k++) { 152 y[k] = 0.0; 153 for (i35 = 0; i35 < 20; i35++) { 154 y[k] += a[k + (i35 << 4)] * bWin_data[i35]; 155 } 156 } 157 158 /* Subtract filtered b */ 159 /* check y inf or not */ 160 for (k = 0; k < 16; k++) { 161 z[((int32_T)n + 882 * k) - 1] = x[((int32_T)n + 882 * k) - 1] - y[k]; 162 bv19[k] = !muDoubleScalarIsInf(z[((int32_T)n + 882 * k) - 1]); 163 bv20[k] = !muDoubleScalarIsNaN(z[((int32_T)n + 882 * k) - 1]); 164 } 165 166 b_y = false; 167 k = 0; 168 exitg1 = false; 169 while ((!exitg1) && (k < 16)) { 170 if (!!!(bv19[k] && bv20[k])) { 171 b_y = true; 172 exitg1 = true; 173 } else { 174 k++; 175 } 176 } 177 178 if (covrtLogIf(&emlrtCoverageInstance, 4U, 0U, 1, b_y)) { 179 st.site = &vc_emlrtRSI; 180 for (k = 0; k < 19; k++) { 181 u[k] = varargin_1[k]; 182 } 183 184 c_y = NULL; 185 m28 = emlrtCreateCharArray(2, iv57); 186 emlrtInitCharArrayR2013a(&st, 19, m28, &u[0]); 187 emlrtAssign(&c_y, m28); 188 b_st.site = &af_emlrtRSI; 189 ab_error(&b_st, c_y, &emlrtMCI); 190 } 191 192 covrtLogBasicBlock(&emlrtCoverageInstance, 4U, 3); 193 } 194 195 /* End of code generation (targbm.c) */ 196 |