TMC Compiler Support - QA

For any questions please e-mail to author: csafonov@gmail.com

Q:
I tried to compile an example of image filter our_RF from
 https://www.mathworks.com/matlabcentral/mlc-downloads/downloads/submissions/54944/versions/3/previews/getKernel_orig2blurred/Fortunato_Oliveira_FD_Script_our_method_only/our_method/our_RF.m/index.html
but the compiler generated syntax errors. How can I modify the source files in order to get the project compiled ?

A:
You may use an example AppEx template. The following should be done:
  1. Put the functions in separate files
  2. Comments should not be placed before 'function' definition
  3. Avoid  'end' at the end of a function
  4. Replace 'i' (by default is imagine one = sqrt(-1)) by i_
  5. Add an implementation to conv2() function
If the function is implemented in C (or MEX):
Add a  signature
           conv2,3,1,i;
to  Stubs\external_fnc.sym.dat
and C-style definition
void tmcconv2(int nargout, int nargin,tmsMatrix *mC, tmsMatrix *mA,tmsMatrix *mB,tmsMatrix *mShape);
to Stubs\External_func.h
If the function is implemented in MATLAB:
 Put your conv2.m file to the sources file directory

6. Avoid usage of classes since they are not directly supported
7. 3-D matrixes support yet not tested at this stage of the support library development.
The simplest solution is to replace 3-D matrix by cell arrays.
In this example matrix im_in of sizes [R C CH] should be replaced by a cell array
im_in of length CH of 2D matrixes of size [R C]. E.g.

[R C CH] = size(im_in);

is replaced by

CH  = length(im_in); [R, C] = size(im_in{1});

Code like
F(:,i,ch) = F(:,i,ch) + V(:,i) .* ( F(:,i - 1,ch) - F(:,i,ch) );
should be replaced by
F{ch}(:,i_) = F{ch}(:,i_) + V(:,i_) .* ( F{ch}(:,i_ - 1) - F{ch}(:,i_) );



 

No comments: