void makeHistFutTablewithRearrange_api(const mxArray * const prhs[4], const mxArray *plhs[1]) { emxArray_uint8_T *testm; emxArray_real_T *rmat; emxArray_real_T *y; real_T range; real_T dims; emlrtStack st = { NULL, NULL, NULL }; st.tls = emlrtRootTLSGlobal; emlrtHeapReferenceStackEnterFcnR2012b(&st); emxInit_uint8_T(&st, &testm, 2, &h_emlrtRTEI, true); emxInit_real_T1(&st, &rmat, 1, &h_emlrtRTEI, true); emxInit_real_T(&st, &y, 2, &h_emlrtRTEI, true); /* Marshall function inputs */ emlrt_marshallIn(&st, emlrtAlias((const mxArray *)prhs[0]), "testm", testm); range = c_emlrt_marshallIn(&st, emlrtAliasP((const mxArray *)prhs[1]), "range"); dims = c_emlrt_marshallIn(&st, emlrtAliasP((const mxArray *)prhs[2]), "dims"); e_emlrt_marshallIn(&st, emlrtAlias((const mxArray *)prhs[3]), "rmat", rmat); /* Invoke the target function */ makeHistFutTablewithRearrange(&st, testm, range, dims, rmat, y); /* Marshall function outputs */ plhs[0] = emlrt_marshallOut(y); y->canFreeData = false; emxFree_real_T(&y); rmat->canFreeData = false; emxFree_real_T(&rmat); testm->canFreeData = false; emxFree_uint8_T(&testm); emlrtHeapReferenceStackLeaveFcnR2012b(&st); }
/* Function Definitions */ void imshift(uint8_T I[270000], const real_T disparity[2]) { real_T xStart2; real_T yStart2; real_T xEnd2; real_T yEnd2; int32_T i2; int32_T i3; int32_T i4; int32_T i5; int32_T tmp_size_idx_0; int32_T loop_ub; int32_T i6; int32_T tmp_data[225]; int32_T b_tmp_size_idx_0; int32_T b_tmp_data[400]; emxArray_uint8_T *b_I; int32_T iv3[3]; int32_T i7; int32_T b_loop_ub; int32_T i8; int32_T c_I[3]; int32_T c_tmp_data[400]; int32_T d_tmp_data[225]; emxArray_uint8_T *d_I; emlrtHeapReferenceStackEnterFcnR2012b(emlrtRootTLSGlobal); xStart2 = muDoubleScalarMax(1.0, 1.0 + disparity[0]); yStart2 = muDoubleScalarMax(1.0, 1.0 + disparity[1]); xEnd2 = muDoubleScalarMin(225.0, 225.0 + disparity[0]); yEnd2 = muDoubleScalarMin(400.0, 400.0 + disparity[1]); i2 = (int32_T)muDoubleScalarMax(1.0, 1.0 - disparity[0]) - 1; i3 = (int32_T)muDoubleScalarMin(225.0, 225.0 - disparity[0]); i4 = (int32_T)muDoubleScalarMax(1.0, 1.0 - disparity[1]) - 1; i5 = (int32_T)muDoubleScalarMin(400.0, 400.0 - disparity[1]); tmp_size_idx_0 = ((int32_T)xEnd2 - (int32_T)xStart2) + 1; loop_ub = (int32_T)xEnd2 - (int32_T)xStart2; for (i6 = 0; i6 <= loop_ub; i6++) { tmp_data[i6] = ((int32_T)xStart2 + i6) - 1; } b_tmp_size_idx_0 = ((int32_T)yEnd2 - (int32_T)yStart2) + 1; loop_ub = (int32_T)yEnd2 - (int32_T)yStart2; for (i6 = 0; i6 <= loop_ub; i6++) { b_tmp_data[i6] = ((int32_T)yStart2 + i6) - 1; } emxInit_uint8_T(&b_I, 3, &emlrtRTEI, TRUE); iv3[0] = tmp_size_idx_0; iv3[1] = b_tmp_size_idx_0; iv3[2] = 3; i6 = b_I->size[0] * b_I->size[1] * b_I->size[2]; b_I->size[0] = i3 - i2; b_I->size[1] = i5 - i4; b_I->size[2] = 3; emxEnsureCapacity((emxArray__common *)b_I, i6, (int32_T)sizeof(uint8_T), &emlrtRTEI); for (i6 = 0; i6 < 3; i6++) { loop_ub = i5 - i4; for (i7 = 0; i7 < loop_ub; i7++) { b_loop_ub = i3 - i2; for (i8 = 0; i8 < b_loop_ub; i8++) { b_I->data[(i8 + b_I->size[0] * i7) + b_I->size[0] * b_I->size[1] * i6] = I[((i2 + i8) + 225 * (i4 + i7)) + 90000 * i6]; } } } for (i6 = 0; i6 < 3; i6++) { c_I[i6] = b_I->size[i6]; } emxFree_uint8_T(&b_I); emlrtSubAssignSizeCheckR2012b(iv3, 3, c_I, 3, &emlrtECI, emlrtRootTLSGlobal); for (i6 = 0; i6 < b_tmp_size_idx_0; i6++) { c_tmp_data[i6] = b_tmp_data[i6]; } for (i6 = 0; i6 < tmp_size_idx_0; i6++) { d_tmp_data[i6] = tmp_data[i6]; } emxInit_uint8_T(&d_I, 3, &emlrtRTEI, TRUE); i6 = d_I->size[0] * d_I->size[1] * d_I->size[2]; d_I->size[0] = i3 - i2; d_I->size[1] = i5 - i4; d_I->size[2] = 3; emxEnsureCapacity((emxArray__common *)d_I, i6, (int32_T)sizeof(uint8_T), &emlrtRTEI); for (i6 = 0; i6 < 3; i6++) { loop_ub = i5 - i4; for (i7 = 0; i7 < loop_ub; i7++) { b_loop_ub = i3 - i2; for (i8 = 0; i8 < b_loop_ub; i8++) { d_I->data[(i8 + d_I->size[0] * i7) + d_I->size[0] * d_I->size[1] * i6] = I[((i2 + i8) + 225 * (i4 + i7)) + 90000 * i6]; } } } for (i2 = 0; i2 < 3; i2++) { loop_ub = d_I->size[1]; for (i3 = 0; i3 < loop_ub; i3++) { b_loop_ub = d_I->size[0]; for (i4 = 0; i4 < b_loop_ub; i4++) { I[(d_tmp_data[i4] + 225 * c_tmp_data[i3]) + 90000 * i2] = d_I->data[(i4 + d_I->size[0] * i3) + d_I->size[0] * d_I->size[1] * i2]; } } } emxFree_uint8_T(&d_I); if (xStart2 == 1.0) { if (xEnd2 + 1.0 > 225.0) { i2 = 0; i3 = 0; } else { i2 = (int32_T)(xEnd2 + 1.0); i2 = emlrtDynamicBoundsCheckFastR2012b(i2, 1, 225, &b_emlrtBCI, emlrtRootTLSGlobal) - 1; i3 = 225; } tmp_size_idx_0 = i3 - i2; for (i3 = 0; i3 < 3; i3++) { for (i4 = 0; i4 < 400; i4++) { for (i5 = 0; i5 < tmp_size_idx_0; i5++) { I[((i2 + i5) + 225 * i4) + 90000 * i3] = 0; } } } } else { for (i2 = 0; i2 < 3; i2++) { for (i3 = 0; i3 < 400; i3++) { loop_ub = (int32_T)(xStart2 - 1.0); for (i4 = 0; i4 < loop_ub; i4++) { I[(i4 + 225 * i3) + 90000 * i2] = 0; } } } } if (yStart2 == 1.0) { if (yEnd2 + 1.0 > 400.0) { i2 = 0; i3 = 0; } else { i2 = (int32_T)(yEnd2 + 1.0); i2 = emlrtDynamicBoundsCheckFastR2012b(i2, 1, 400, &emlrtBCI, emlrtRootTLSGlobal) - 1; i3 = 400; } tmp_size_idx_0 = i3 - i2; for (i3 = 0; i3 < 3; i3++) { for (i4 = 0; i4 < tmp_size_idx_0; i4++) { for (i5 = 0; i5 < 225; i5++) { I[(i5 + 225 * (i2 + i4)) + 90000 * i3] = 0; } } } } else { for (i2 = 0; i2 < 3; i2++) { loop_ub = (int32_T)(yStart2 - 1.0); for (i3 = 0; i3 < loop_ub; i3++) { for (i4 = 0; i4 < 225; i4++) { I[(i4 + 225 * i3) + 90000 * i2] = 0; } } } } emlrtHeapReferenceStackLeaveFcnR2012b(emlrtRootTLSGlobal); }
// // Arguments : const emxArray_boolean_T *I // emxArray_boolean_T *I2 // Return Type : void // void f_fillimg(const emxArray_boolean_T *I, emxArray_boolean_T *I2) { emxArray_uint8_T *mask; int i36; int loop_ub; double sizeB[2]; emxArray_uint8_T *b_mask; int c_mask; emxArray_uint8_T *marker; emxArray_uint8_T *b_I2; emxArray_real_T *I3; b_emxInit_uint8_T(&mask, 2); i36 = mask->size[0] * mask->size[1]; mask->size[0] = I->size[0]; mask->size[1] = I->size[1]; emxEnsureCapacity((emxArray__common *)mask, i36, (int)sizeof(unsigned char)); loop_ub = I->size[0] * I->size[1]; for (i36 = 0; i36 < loop_ub; i36++) { mask->data[i36] = I->data[i36]; } if ((mask->size[0] == 0) || (mask->size[1] == 0)) { for (i36 = 0; i36 < 2; i36++) { sizeB[i36] = (double)mask->size[i36] + 2.0; } i36 = mask->size[0] * mask->size[1]; mask->size[0] = (int)sizeB[0]; emxEnsureCapacity((emxArray__common *)mask, i36, (int)sizeof(unsigned char)); i36 = mask->size[0] * mask->size[1]; mask->size[1] = (int)sizeB[1]; emxEnsureCapacity((emxArray__common *)mask, i36, (int)sizeof(unsigned char)); loop_ub = (int)sizeB[0] * (int)sizeB[1]; for (i36 = 0; i36 < loop_ub; i36++) { mask->data[i36] = 0; } } else { b_emxInit_uint8_T(&b_mask, 2); i36 = b_mask->size[0] * b_mask->size[1]; b_mask->size[0] = mask->size[0]; b_mask->size[1] = mask->size[1]; emxEnsureCapacity((emxArray__common *)b_mask, i36, (int)sizeof(unsigned char)); loop_ub = mask->size[0] * mask->size[1]; for (i36 = 0; i36 < loop_ub; i36++) { b_mask->data[i36] = mask->data[i36]; } b_ConstantPad(b_mask, 7, mask); emxFree_uint8_T(&b_mask); } i36 = mask->size[0] * mask->size[1]; emxEnsureCapacity((emxArray__common *)mask, i36, (int)sizeof(unsigned char)); loop_ub = mask->size[0]; c_mask = mask->size[1]; loop_ub *= c_mask; for (i36 = 0; i36 < loop_ub; i36++) { mask->data[i36] = (unsigned char)(255U - mask->data[i36]); } b_emxInit_uint8_T(&marker, 2); i36 = marker->size[0] * marker->size[1]; marker->size[0] = mask->size[0]; marker->size[1] = mask->size[1]; emxEnsureCapacity((emxArray__common *)marker, i36, (int)sizeof(unsigned char)); loop_ub = mask->size[0] * mask->size[1]; for (i36 = 0; i36 < loop_ub; i36++) { marker->data[i36] = mask->data[i36]; } for (loop_ub = 0; loop_ub <= mask->size[0] - 3; loop_ub++) { i36 = marker->size[1]; for (c_mask = 0; c_mask <= i36 - 3; c_mask++) { marker->data[(loop_ub + marker->size[0] * (c_mask + 1)) + 1] = 0; } } for (i36 = 0; i36 < 2; i36++) { sizeB[i36] = marker->size[i36]; } b_emxInit_uint8_T(&b_I2, 2); i36 = b_I2->size[0] * b_I2->size[1]; b_I2->size[0] = marker->size[0]; b_I2->size[1] = marker->size[1]; emxEnsureCapacity((emxArray__common *)b_I2, i36, (int)sizeof(unsigned char)); loop_ub = marker->size[0] * marker->size[1]; for (i36 = 0; i36 < loop_ub; i36++) { b_I2->data[i36] = marker->data[i36]; } //ippreconstruct_uint8(&b_I2->data[0], &mask->data[0], sizeB, 2.0, 2.0); i36 = b_I2->size[0] * b_I2->size[1]; emxEnsureCapacity((emxArray__common *)b_I2, i36, (int)sizeof(unsigned char)); loop_ub = b_I2->size[0]; c_mask = b_I2->size[1]; loop_ub *= c_mask; emxFree_uint8_T(&mask); for (i36 = 0; i36 < loop_ub; i36++) { b_I2->data[i36] = (unsigned char)(255U - b_I2->data[i36]); } b_emxInit_real_T(&I3, 2); loop_ub = marker->size[0] - 2; i36 = I3->size[0] * I3->size[1]; I3->size[0] = loop_ub; emxEnsureCapacity((emxArray__common *)I3, i36, (int)sizeof(double)); loop_ub = marker->size[1] - 2; i36 = I3->size[0] * I3->size[1]; I3->size[1] = loop_ub; emxEnsureCapacity((emxArray__common *)I3, i36, (int)sizeof(double)); loop_ub = (marker->size[0] - 2) * (marker->size[1] - 2); for (i36 = 0; i36 < loop_ub; i36++) { I3->data[i36] = 0.0; } for (loop_ub = 0; loop_ub <= marker->size[0] - 3; loop_ub++) { for (c_mask = 0; c_mask <= marker->size[1] - 3; c_mask++) { I3->data[loop_ub + I3->size[0] * c_mask] = b_I2->data[(loop_ub + b_I2->size[0] * (c_mask + 1)) + 1]; } } emxFree_uint8_T(&b_I2); emxFree_uint8_T(&marker); i36 = I2->size[0] * I2->size[1]; I2->size[0] = I3->size[0]; I2->size[1] = I3->size[1]; emxEnsureCapacity((emxArray__common *)I2, i36, (int)sizeof(boolean_T)); loop_ub = I3->size[0] * I3->size[1]; for (i36 = 0; i36 < loop_ub; i36++) { I2->data[i36] = (I3->data[i36] != 0.0); } emxFree_real_T(&I3); }
// Main function int main (void) { // Local variable definations emxArray_uint8_T *xaxis; emxArray_uint8_T *yaxis; emxArray_uint8_T *norm_xaxis_filt; emxArray_uint8_T *norm_yaxis_filt; uint16_T count; uint8_T xaxis2,yaxis2; long j = 0; int again = 1; char letter; char letterstr[10]; int i=0; letterstr[i] = '\0'; // Variable Initialisation for(j=0;j<MAX_VALUE;j++) { xdata[j] = 0; ydata[j] = 0; } // Function Initialisation PINSEL2 &= ~((1<<2)|(1<<3)); GLCD_Initalize(); //Initialize the LCD Init_UART(); InitADC(); // Welcome message GLCD_ClearScreen(); GLCD_GoTo(10,4); GLCD_WriteString("Intelligent e-book"); // for(j=0;j<999999;j++); delay_ms(2000); // Calibration //Left bottom GLCD_ClearScreen(); GLCD_GoTo(10,0); GLCD_WriteString("Calibration"); GLCD_GoTo(10,4); GLCD_WriteString("Touch the point"); GLCD_GoTo(0,7); GLCD_WriteString("o"); do { xaxis1 = Read_xaxis(); yaxis1 = Read_yaxis(); if(xaxis1<10) xaxis1 = 0; if(yaxis1<10) yaxis1 = 0; }while(xaxis1==0 && yaxis1==0); for(j=0;j<25;j++) capture(); x1 = xaxis1; y1 = yaxis1; GLCD_GoTo(10,5); GLCD_WriteString("Stored"); delay_ms(1000); //Right top GLCD_ClearScreen(); GLCD_GoTo(10,0); GLCD_WriteString("Calibration"); GLCD_GoTo(10,4); GLCD_WriteString("Touch the point"); GLCD_GoTo(120,0); GLCD_WriteString("o"); do { xaxis1 = Read_xaxis(); yaxis1 = Read_yaxis(); if(xaxis1<10) xaxis1 = 0; if(yaxis1<10) yaxis1 = 0; }while(xaxis1==0 && yaxis1==0); for(j=0;j<25;j++) capture(); x2 = xaxis1; y2 = yaxis1; GLCD_GoTo(10,5); GLCD_WriteString("Stored"); delay_ms(1000); while(again==1) { again = 0; // Capturing xaxis and yaxis GLCD_ClearScreen(); GLCD_GoTo(10,0); GLCD_WriteString("Intelligent e-book"); GLCD_GoTo(12,4); GLCD_WriteString("Waiting for input"); do { xaxis1 = Read_xaxis(); yaxis1 = Read_yaxis(); if(xaxis1<10) xaxis1 = 0; if(yaxis1<10) yaxis1 = 0; }while(xaxis1==0 && yaxis1==0); xyelem = 0; count = 0; GLCD_ClearScreen(); GLCD_GoTo(0,0); // Eliminate first 25 samples for(j=0;j<25;j++) capture(); while(count!=250) { capture(); if(xaxis1!=0 && yaxis1!=0 && count==0) { // xaxis2 = (uint8_T)(((xaxis1-80)*255)/730); // yaxis2 = (uint8_T)(((yaxis1-100)*255)/650); xaxis2 = (uint8_T)(((xaxis1-x1)*255)/(x2-x1)); yaxis2 = (uint8_T)(((yaxis1-y1)*255)/(y2-y1)); count = 0; xdata[xyelem] = xaxis2; ydata[xyelem] = yaxis2; xyelem = xyelem + 1; GLCD_SetPixel(xaxis2/2,255-(yaxis2/4),1); if(xyelem>MAX_VALUE - 1) { GLCD_ClearScreen(); GLCD_GoTo(10,0); GLCD_WriteString("Intelligent e-book"); GLCD_GoTo(10,4); GLCD_WriteString("Overflow!!!"); while(1); } } else if(xaxis1!=0 && yaxis1!=0) { xyelem = xyelem - 2; // Eliminate first 25 samples for(j=0;j<25;j++) capture(); count = 0; } else { count = count + 1; } // delay(1000); } GLCD_ClearScreen(); GLCD_GoTo(10,0); GLCD_WriteString("Intelligent e-book"); GLCD_GoTo(0,1); GLCD_WriteString(letterstr); //GLCD_GoTo(10,4); //GLCD_WriteString("Scanning ended"); //delay_ms(500); // Transmitting data to PC // transmit(); // Remove noise remove_noise(); // Allocating space for pointers xaxis = emxCreateWrapper_uint8_T(xdata,1,xyelem); //xdata1 yaxis = emxCreateWrapper_uint8_T(ydata,1,xyelem); //ydata1 emxInit_uint8_T(&norm_xaxis_filt, 2); emxInit_uint8_T(&norm_yaxis_filt, 2); /* GLCD_ClearScreen(); GLCD_GoTo(10,0); GLCD_WriteString("Intelligent e-book"); GLCD_GoTo(0,2); GLCD_WriteString("Step1"); GLCD_GoTo(37,2); GLCD_WriteString("In"); */ // for(j=0;j<999999;j++); step1(xaxis, yaxis, norm_xaxis_filt, norm_yaxis_filt); // GLCD_ClearScreen(); // GLCD_GoTo(10,0); // GLCD_WriteString("Intelligent e-book"); // GLCD_GoTo(54,2); // GLCD_WriteString("Out"); // for(j=0;j<999999;j++); emxDestroyArray_uint8_T(xaxis); emxDestroyArray_uint8_T(yaxis); // GLCD_ClearScreen(); // GLCD_GoTo(10,0); // GLCD_WriteString("Intelligent e-book"); // GLCD_GoTo(0,3); // GLCD_WriteString("Step2"); // GLCD_GoTo(37,3); // GLCD_WriteString("In"); // for(j=0;j<999999;j++); // char_bin is stored in column first fashion... each column vector are concatenated step2(norm_xaxis_filt, norm_yaxis_filt, char_bin); // GLCD_ClearScreen(); // GLCD_GoTo(10,0); // GLCD_WriteString("Intelligent e-book"); // GLCD_GoTo(54,3); // GLCD_WriteString("Out"); // for(j=0;j<999999;j++); emxFree_uint8_T(&norm_xaxis_filt); emxFree_uint8_T(&norm_yaxis_filt); // GLCD_ClearScreen(); // GLCD_GoTo(10,0); // GLCD_WriteString("Intelligent e-book"); // GLCD_GoTo(0,4); // GLCD_WriteString("Step3"); // GLCD_GoTo(37,4); // GLCD_WriteString("In"); // for(j=0;j<999999;j++); for(j=0;j<10;j++) char_vec[j] = 1; step3(char_bin, char_vec); // GLCD_ClearScreen(); // GLCD_GoTo(10,0); // GLCD_WriteString("Intelligent e-book"); // GLCD_GoTo(54,4); // GLCD_WriteString("Out"); // for(j=0;j<999999;j++); for(j=0;j<26;j++) char_vec1[j] = char_vec[j]; // Feeding char_vec to trained neural network char_recog_nn(char_vec1,Y); letter = character(); letterstr[i] = letter; letterstr[i+1] = '\0'; // GLCD_ClearScreen(); // GLCD_GoTo(10,0); // GLCD_WriteString("Intelligent e-book"); // GLCD_GoTo(0,6); // GLCD_WriteString("Letter is: "); GLCD_GoTo(0,1); GLCD_WriteString(letterstr); GLCD_GoTo(0,7); GLCD_WriteString("Continue"); do { xaxis1 = Read_xaxis(); yaxis1 = Read_yaxis(); if(xaxis1<10) xaxis1 = 0; if(yaxis1<10) yaxis1 = 0; }while(xaxis1==0 && yaxis1==0); again = 1; i = i + 1; /* GLCD_ClearScreen(); GLCD_GoTo(10,0); GLCD_WriteString("Intelligent e-book"); GLCD_GoTo(20,4); GLCD_WriteString("Restarting."); delay_ms(200); GLCD_WriteString("."); delay_ms(200); GLCD_WriteString("."); delay_ms(200); GLCD_WriteString("."); */ delay_ms(400); } while(1); }
// // Arguments : const emxArray_uint8_T *a // signed char direction // emxArray_uint8_T *b // Return Type : void // void b_ConstantPad(const emxArray_uint8_T *a, signed char direction, emxArray_uint8_T *b) { int sizeB[2]; int cdiff; int i37; emxArray_uint8_T *r14; int b_sizeB[2]; int absb; int ndbl; emxArray_real_T *y; emxArray_real_T *b_y; int apnd; for (cdiff = 0; cdiff < 2; cdiff++) { if (direction == 5) { i37 = a->size[cdiff] + 1; sizeB[cdiff] = i37; } else if (direction == 6) { i37 = a->size[cdiff] + 1; sizeB[cdiff] = i37; } else { i37 = a->size[cdiff]; sizeB[cdiff] = (int)((double)i37 + 2.0); } } b_emxInit_uint8_T(&r14, 2); b_sizeB[0] = sizeB[0]; b_sizeB[1] = sizeB[1]; b_repmat(b_sizeB, r14); for (i37 = 0; i37 < 2; i37++) { absb = b->size[0] * b->size[1]; b->size[i37] = r14->size[i37]; emxEnsureCapacity((emxArray__common *)b, absb, (int)sizeof(unsigned char)); } if (direction == 5) { for (cdiff = 0; cdiff < r14->size[0]; cdiff++) { b->data[cdiff] = 0; } i37 = b->size[1]; for (ndbl = 2; ndbl <= i37; ndbl++) { b->data[b->size[0] * (ndbl - 1)] = 0; } } else if (direction == 7) { for (cdiff = 0; cdiff < r14->size[0]; cdiff++) { b->data[cdiff] = 0; } i37 = b->size[1]; for (ndbl = a->size[1] + 1; ndbl + 1 <= i37; ndbl++) { absb = b->size[0]; for (cdiff = 0; cdiff < absb; cdiff++) { b->data[cdiff + b->size[0] * ndbl] = 0; } } for (ndbl = 2; ndbl <= a->size[1] + 1; ndbl++) { b->data[b->size[0] * (ndbl - 1)] = 0; } for (ndbl = 2; ndbl <= a->size[1] + 1; ndbl++) { i37 = b->size[0]; for (cdiff = a->size[0] + 1; cdiff + 1 <= i37; cdiff++) { b->data[cdiff + b->size[0] * (ndbl - 1)] = 0; } } } else { for (ndbl = a->size[1]; ndbl + 1 <= r14->size[1]; ndbl++) { i37 = b->size[0]; for (cdiff = 0; cdiff < i37; cdiff++) { b->data[cdiff + b->size[0] * ndbl] = 0; } } for (ndbl = 0; ndbl < a->size[1]; ndbl++) { i37 = b->size[0]; for (cdiff = a->size[0]; cdiff + 1 <= i37; cdiff++) { b->data[cdiff + b->size[0] * ndbl] = 0; } } } emxFree_uint8_T(&r14); b_emxInit_real_T(&y, 2); b_emxInit_real_T(&b_y, 2); if ((direction == 5) || (direction == 7)) { if (a->size[0] < 1) { absb = -1; apnd = 0; } else { ndbl = (int)floor(((double)a->size[0] - 1.0) + 0.5); apnd = ndbl + 1; cdiff = (ndbl - a->size[0]) + 1; absb = a->size[0]; if (fabs((double)cdiff) < 4.4408920985006262E-16 * (double)absb) { ndbl++; apnd = a->size[0]; } else if (cdiff > 0) { apnd = ndbl; } else { ndbl++; } absb = ndbl - 1; } i37 = y->size[0] * y->size[1]; y->size[0] = 1; y->size[1] = absb + 1; emxEnsureCapacity((emxArray__common *)y, i37, (int)sizeof(double)); if (absb + 1 > 0) { y->data[0] = 1.0; if (absb + 1 > 1) { y->data[absb] = apnd; ndbl = absb / 2; for (cdiff = 1; cdiff < ndbl; cdiff++) { y->data[cdiff] = 1.0 + (double)cdiff; y->data[absb - cdiff] = apnd - cdiff; } if (ndbl << 1 == absb) { y->data[ndbl] = (1.0 + (double)apnd) / 2.0; } else { y->data[ndbl] = 1.0 + (double)ndbl; y->data[ndbl + 1] = apnd - ndbl; } } } if (a->size[1] < 1) { absb = -1; apnd = 0; } else { ndbl = (int)floor(((double)a->size[1] - 1.0) + 0.5); apnd = ndbl + 1; cdiff = (ndbl - a->size[1]) + 1; absb = a->size[1]; if (fabs((double)cdiff) < 4.4408920985006262E-16 * (double)absb) { ndbl++; apnd = a->size[1]; } else if (cdiff > 0) { apnd = ndbl; } else { ndbl++; } absb = ndbl - 1; } i37 = b_y->size[0] * b_y->size[1]; b_y->size[0] = 1; b_y->size[1] = absb + 1; emxEnsureCapacity((emxArray__common *)b_y, i37, (int)sizeof(double)); if (absb + 1 > 0) { b_y->data[0] = 1.0; if (absb + 1 > 1) { b_y->data[absb] = apnd; ndbl = absb / 2; for (cdiff = 1; cdiff < ndbl; cdiff++) { b_y->data[cdiff] = 1.0 + (double)cdiff; b_y->data[absb - cdiff] = apnd - cdiff; } if (ndbl << 1 == absb) { b_y->data[ndbl] = (1.0 + (double)apnd) / 2.0; } else { b_y->data[ndbl] = 1.0 + (double)ndbl; b_y->data[ndbl + 1] = apnd - ndbl; } } } ndbl = a->size[1]; for (i37 = 0; i37 < ndbl; i37++) { cdiff = a->size[0]; for (absb = 0; absb < cdiff; absb++) { b->data[(int)y->data[y->size[0] * absb] + b->size[0] * (int)b_y-> data[b_y->size[0] * i37]] = a->data[absb + a->size[0] * i37]; } } } else { ndbl = a->size[1]; for (i37 = 0; i37 < ndbl; i37++) { cdiff = a->size[0]; for (absb = 0; absb < cdiff; absb++) { b->data[absb + b->size[0] * i37] = a->data[absb + a->size[0] * i37]; } } } emxFree_real_T(&b_y); emxFree_real_T(&y); }
// // Arguments : emxArray_uint8_T *emxArray // Return Type : void // void emxDestroyArray_uint8_T(emxArray_uint8_T *emxArray) { emxFree_uint8_T(&emxArray); }