#### File: _coder_MLS_applyDeform_api.c
        1   /*
        2    * _coder_MLS_applyDeform_api.c
        3    *
        4    * Code generation for function '_coder_MLS_applyDeform_api'
        5    *
        6    */
        7
        8   /* Include files */
        9   #include "rt_nonfinite.h"
       10   #include "MLS_applyDeform.h"
       11   #include "_coder_MLS_applyDeform_api.h"
       12   #include "MLS_applyDeform_data.h"
       13
       14   /* Variable Definitions */
       15   static const int32_T iv0[3] = { 360, 640, 3 };
       16
       17   /* Function Declarations */
       18   static uint8_T (*b_emlrt_marshallIn(const emlrtStack *sp, const mxArray *u,
       19     const emlrtMsgIdentifier *parentId))[691200];
       20   static const mxArray *b_emlrt_marshallOut(const real_T u);
       21   static real_T (*c_emlrt_marshallIn(const emlrtStack *sp, const mxArray *f, const
       22     char_T *identifier))[460800];
       23   static real_T (*d_emlrt_marshallIn(const emlrtStack *sp, const mxArray *u, const
       24     emlrtMsgIdentifier *parentId))[460800];
       25   static void e_emlrt_marshallIn(const emlrtStack *sp, const mxArray *v, const
       26     char_T *identifier, real_T **y_data, int32_T y_size[2]);
       27   static uint8_T (*emlrt_marshallIn(const emlrtStack *sp, const mxArray *oldImg,
       28     const char_T *identifier))[691200];
       29   static const mxArray *emlrt_marshallOut(const uint8_T u[691200]);
       30   static void f_emlrt_marshallIn(const emlrtStack *sp, const mxArray *u, const
       31     emlrtMsgIdentifier *parentId, real_T **y_data, int32_T y_size[2]);
       32   static real_T (*g_emlrt_marshallIn(const emlrtStack *sp, const mxArray
       33     *grid_size, const char_T *identifier))[2];
       34   static real_T (*h_emlrt_marshallIn(const emlrtStack *sp, const mxArray *u, const
       35     emlrtMsgIdentifier *parentId))[2];
       36   static uint8_T (*i_emlrt_marshallIn(const emlrtStack *sp, const mxArray *src,
       37     const emlrtMsgIdentifier *msgId))[691200];
       38   static real_T (*j_emlrt_marshallIn(const emlrtStack *sp, const mxArray *src,
       39     const emlrtMsgIdentifier *msgId))[460800];
       40   static void k_emlrt_marshallIn(const emlrtStack *sp, const mxArray *src, const
       41     emlrtMsgIdentifier *msgId, real_T **ret_data, int32_T ret_size[2]);
       42   static real_T (*l_emlrt_marshallIn(const emlrtStack *sp, const mxArray *src,
       43     const emlrtMsgIdentifier *msgId))[2];
       44
       45   /* Function Definitions */
       46   static uint8_T (*b_emlrt_marshallIn(const emlrtStack *sp, const mxArray *u,
       47     const emlrtMsgIdentifier *parentId))[691200]
       48   {
       49     uint8_T (*y)[691200];
       50     y = i_emlrt_marshallIn(sp, emlrtAlias(u), parentId);
       51     emlrtDestroyArray(&u);
       52     return y;
       53   }
       54     static const mxArray *b_emlrt_marshallOut(const real_T u)
       55   {
       56     const mxArray *y;
       57     const mxArray *m1;
       58     y = NULL;
       59     m1 = emlrtCreateDoubleScalar(u);
       60     emlrtAssign(&y, m1);
       61     return y;
       62   }
       63
       64   static real_T (*c_emlrt_marshallIn(const emlrtStack *sp, const mxArray *f, const
       65     char_T *identifier))[460800]
       66   {
       67     real_T (*y)[460800];
       68     emlrtMsgIdentifier thisId;
       69     thisId.fIdentifier = (const char *)identifier;
       70     thisId.fParent = NULL;
       71     thisId.bParentIsCell = false;
       72     y = d_emlrt_marshallIn(sp, emlrtAlias(f), &thisId);
       73     emlrtDestroyArray(&f);
       74     return y;
       75   }
       76     static real_T (*d_emlrt_marshallIn(const emlrtStack *sp, const mxArray *u,
       77     const emlrtMsgIdentifier *parentId))[460800]
       78   {
       79     real_T (*y)[460800];
       80     y = j_emlrt_marshallIn(sp, emlrtAlias(u), parentId);
       81     emlrtDestroyArray(&u);
       82     return y;
       83   }
       84
       85   static void e_emlrt_marshallIn(const emlrtStack *sp, const mxArray *v, const
       86     char_T *identifier, real_T **y_data, int32_T y_size[2])
       87   {
       88     emlrtMsgIdentifier thisId;
       89     real_T *r0;
       90     thisId.fIdentifier = (const char *)identifier;
       91     thisId.fParent = NULL;
       92     thisId.bParentIsCell = false;
       93     f_emlrt_marshallIn(sp, emlrtAlias(v), &thisId, &r0, y_size);
       94     *y_data = r0;
       95     emlrtDestroyArray(&v);
       96   }
       97
       98   static uint8_T (*emlrt_marshallIn(const emlrtStack *sp, const mxArray *oldImg,
       99     const char_T *identifier))[691200]
      100   {
      101     uint8_T (*y)[691200];
      102     emlrtMsgIdentifier thisId;
      103     thisId.fIdentifier = (const char *)identifier;
      104     thisId.fParent = NULL;
      105     thisId.bParentIsCell = false;
      106     y = b_emlrt_marshallIn(sp, emlrtAlias(oldImg), &thisId);
      107     emlrtDestroyArray(&oldImg);
      108     return y;
      109   }
      110     static const mxArray *emlrt_marshallOut(const uint8_T u[691200])
      111   {
      112     const mxArray *y;
      113     const mxArray *m0;
      114     static const int32_T iv1[3] = { 0, 0, 0 };
      115
      116     y = NULL;
      117     m0 = emlrtCreateNumericArray(3, iv1, mxUINT8_CLASS, mxREAL);
      118     emlrtMxSetData((mxArray *)m0, (void *)&u[0]);
      119     emlrtSetDimensions((mxArray *)m0, iv0, 3);
      120     emlrtAssign(&y, m0);
      121     return y;
      122   }
      123
      124   static void f_emlrt_marshallIn(const emlrtStack *sp, const mxArray *u, const
      125     emlrtMsgIdentifier *parentId, real_T **y_data, int32_T y_size[2])
      126   {
      127     real_T *r1;
      128     k_emlrt_marshallIn(sp, emlrtAlias(u), parentId, &r1, y_size);
      129     *y_data = r1;
      130     emlrtDestroyArray(&u);
      131   }
      132
      133   static real_T (*g_emlrt_marshallIn(const emlrtStack *sp, const mxArray
      134     *grid_size, const char_T *identifier))[2]
      135   {
      136     real_T (*y)[2];
      137     emlrtMsgIdentifier thisId;
      138     thisId.fIdentifier = (const char *)identifier;
      139     thisId.fParent = NULL;
      140     thisId.bParentIsCell = false;
      141     y = h_emlrt_marshallIn(sp, emlrtAlias(grid_size), &thisId);
      142     emlrtDestroyArray(&grid_size);
      143     return y;
      144   }
      145     static real_T (*h_emlrt_marshallIn(const emlrtStack *sp, const mxArray *u,
      146     const emlrtMsgIdentifier *parentId))[2]
      147   {
      148     real_T (*y)[2];
      149     y = l_emlrt_marshallIn(sp, emlrtAlias(u), parentId);
      150     emlrtDestroyArray(&u);
      151     return y;
      152   }
      153
      154   static uint8_T (*i_emlrt_marshallIn(const emlrtStack *sp, const mxArray *src,
      155     const emlrtMsgIdentifier *msgId))[691200]
      156   {
      157     uint8_T (*ret)[691200];
      158     emlrtCheckBuiltInR2012b(sp, msgId, src, "uint8", false, 3U, iv0);
      159     ret = (uint8_T (*)[691200])emlrtMxGetData(src);
      160     emlrtDestroyArray(&src);
      161     return ret;
      162   }
      163     static real_T (*j_emlrt_marshallIn(const emlrtStack *sp, const mxArray *src,
      164     const emlrtMsgIdentifier *msgId))[460800]
      165   {
      166     real_T (*ret)[460800];
      167     static const int32_T dims[3] = { 360, 640, 2 };
      168
      169     emlrtCheckBuiltInR2012b(sp, msgId, src, "double", false, 3U, dims);
      170     ret = (real_T (*)[460800])emlrtMxGetData(src);
      171     emlrtDestroyArray(&src);
      172     return ret;
      173   }
      174
      175   static void k_emlrt_marshallIn(const emlrtStack *sp, const mxArray *src, const
      176     emlrtMsgIdentifier *msgId, real_T **ret_data, int32_T ret_size[2])
      177   {
      178     static const int32_T dims[2] = { 2405, 2 };
      179
      180     const boolean_T bv0[2] = { true, true };
      181
      182     int32_T iv2[2];
      183     emlrtCheckVsBuiltInR2012b(sp, msgId, src, "double", false, 2U, dims, &bv0[0],
      184       iv2);
      185     ret_size[0] = iv2[0];
      186     ret_size[1] = iv2[1];
      187     *ret_data = (real_T *)emlrtMxGetData(src);
      188     emlrtDestroyArray(&src);
      189   }
      190
      191   static real_T (*l_emlrt_marshallIn(const emlrtStack *sp, const mxArray *src,
      192     const emlrtMsgIdentifier *msgId))[2]
      193   {
      194     real_T (*ret)[2];
      195     static const int32_T dims[2] = { 1, 2 };
      196
      197     emlrtCheckBuiltInR2012b(sp, msgId, src, "double", false, 2U, dims);
      198     ret = (real_T (*)[2])emlrtMxGetData(src);
      199     emlrtDestroyArray(&src);
      200     return ret;
      201   }
      202     void MLS_applyDeform_api(const mxArray * const prhs[4], const mxArray *plhs[2])
      203   {
      204     uint8_T (*newImg)[691200];
      205     uint8_T (*oldImg)[691200];
      206     real_T (*f)[460800];
      207     real_T (*v_data)[4810];
      208     int32_T v_size[2];
      209     real_T (*grid_size)[2];
      210     real_T finterp;
      211     emlrtStack st = { NULL,              /* site */
      212       NULL,                              /* tls */
      213       NULL                               /* prev */
      214     };
      215
      216     st.tls = emlrtRootTLSGlobal;
      217     newImg = (uint8_T (*)[691200])mxMalloc(sizeof(uint8_T [691200]));
      218
      219     /* Marshall function inputs */
      220     oldImg = emlrt_marshallIn(&st, emlrtAlias(prhs[0]), "oldImg");
      221     f = c_emlrt_marshallIn(&st, emlrtAlias(prhs[1]), "f");
      222     e_emlrt_marshallIn(&st, emlrtAlias(prhs[2]), "v", (real_T **)&v_data, v_size);
      223     grid_size = g_emlrt_marshallIn(&st, emlrtAlias(prhs[3]), "grid_size");
      224
      225     /* Invoke the target function */
      226     MLS_applyDeform(&st, *oldImg, *f, *v_data, v_size, *grid_size, *newImg,
      227                     &finterp);
      228
      229     /* Marshall function outputs */
      230     plhs[0] = emlrt_marshallOut(*newImg);
      231     plhs[1] = b_emlrt_marshallOut(finterp);
      232   }
      233
      234   /* End of code generation (_coder_MLS_applyDeform_api.c) */
      235