10.4. SOURCE CODE INTEGRATION 147
Figure 10.4: C source generation.
10.4 SOURCE CODE INTEGRATION
e final step to implement a signal processing algorithm written in MATLAB on smartphones
is to deploy the generated C code on a suitable target device. For this step, an application shell
is provided here in which the generated C source code needs to be placed. is shell operates
in the same manner as the test bench script stated earlier; that is audio signal samples may be
read from a file or recorded using the target microphone, then data samples are passed to the
processing code in frames and are returned in frames. Figure 10.5 shows how the generated C
code is integrated into the Android shell provided and Figure 10.6 shows how the generated C
code is integrated into the iOS shell provided.
e MATLAB Coder produces C codes with the necessary include statements and func-
tion calls for using them. One minor modification of a generated C code that may be required
is to ensure having the correct input and output variable data types. In the case of array inputs,
the generated code is specified using static array sizes and thus needs to be modified to access
array pointers.
10.5 SUMMARY
MATLAB is extensively used to implement signal processing algorithms. e most important
consideration when transiting a MATLAB function to smartphones is awareness of input and
output data types. A persistent variable storage needs to be established by declaring a persistent
variable and performing a one-time initialization. After this declaration and initialization, any
data may be retained between calls to the function. With the approach presented, practically any
signal processing algorithm written in MATLAB can be compiled to run on Android or iOS
smartphones.
148 10. IMPLEMENTATION VIA MATLAB CODER
Figure 10.5: C source integration Android.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.200.136