blob: 0fde8d4844f7f8192bce005fcbcfc5da6973217d [file] [log] [blame]
Anthony Barbierdbdab852017-06-23 15:42:00 +01001<!-- HTML header for doxygen 1.8.9.1-->
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml">
4<head>
5<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
6<meta http-equiv="X-UA-Compatible" content="IE=9"/>
7<meta name="generator" content="Doxygen 1.8.11"/>
8<meta name="robots" content="NOINDEX, NOFOLLOW" /> <!-- Prevent indexing by search engines -->
9<title>Compute Library: arm_compute::utils Namespace Reference</title>
10<link href="tabs.css" rel="stylesheet" type="text/css"/>
11<script type="text/javascript" src="jquery.js"></script>
12<script type="text/javascript" src="dynsections.js"></script>
13<link href="navtree.css" rel="stylesheet" type="text/css"/>
14<script type="text/javascript" src="resize.js"></script>
15<script type="text/javascript" src="navtreedata.js"></script>
16<script type="text/javascript" src="navtree.js"></script>
17<script type="text/javascript">
18 $(document).ready(initResizable);
19 $(window).load(resizeHeight);
20</script>
21<link href="search/search.css" rel="stylesheet" type="text/css"/>
22<script type="text/javascript" src="search/searchdata.js"></script>
23<script type="text/javascript" src="search/search.js"></script>
24<script type="text/javascript">
25 $(document).ready(function() { init_search(); });
26</script>
27<script type="text/x-mathjax-config">
28 MathJax.Hub.Config({
29 extensions: ["tex2jax.js"],
30 jax: ["input/TeX","output/HTML-CSS"],
31});
32</script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
33<link href="doxygen.css" rel="stylesheet" type="text/css" />
34</head>
35<body>
36<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
37<div id="titlearea">
38<table cellspacing="0" cellpadding="0">
39 <tbody>
40 <tr style="height: 56px;">
41 <td style="padding-left: 0.5em;">
42 <div id="projectname">Compute Library
43 &#160;<span id="projectnumber">v17.06</span>
44 </div>
45 </td>
46 </tr>
47 </tbody>
48</table>
49</div>
50<!-- end header part -->
51<!-- Generated by Doxygen 1.8.11 -->
52<script type="text/javascript">
53var searchBox = new SearchBox("searchBox", "search",false,'Search');
54</script>
55 <div id="navrow1" class="tabs">
56 <ul class="tablist">
57 <li><a href="index.xhtml"><span>Main&#160;Page</span></a></li>
58 <li><a href="pages.xhtml"><span>Related&#160;Pages</span></a></li>
59 <li class="current"><a href="namespaces.xhtml"><span>Namespaces</span></a></li>
60 <li><a href="annotated.xhtml"><span>Data&#160;Structures</span></a></li>
61 <li><a href="files.xhtml"><span>Files</span></a></li>
62 <li>
63 <div id="MSearchBox" class="MSearchBoxInactive">
64 <span class="left">
65 <img id="MSearchSelect" src="search/mag_sel.png"
66 onmouseover="return searchBox.OnSearchSelectShow()"
67 onmouseout="return searchBox.OnSearchSelectHide()"
68 alt=""/>
69 <input type="text" id="MSearchField" value="Search" accesskey="S"
70 onfocus="searchBox.OnSearchFieldFocus(true)"
71 onblur="searchBox.OnSearchFieldFocus(false)"
72 onkeyup="searchBox.OnSearchFieldChange(event)"/>
73 </span><span class="right">
74 <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
75 </span>
76 </div>
77 </li>
78 </ul>
79 </div>
80 <div id="navrow2" class="tabs2">
81 <ul class="tablist">
82 <li><a href="namespaces.xhtml"><span>Namespace&#160;List</span></a></li>
83 <li><a href="namespacemembers.xhtml"><span>Namespace&#160;Members</span></a></li>
84 </ul>
85 </div>
86</div><!-- top -->
87<div id="side-nav" class="ui-resizable side-nav-resizable">
88 <div id="nav-tree">
89 <div id="nav-tree-contents">
90 <div id="nav-sync" class="sync"></div>
91 </div>
92 </div>
93 <div id="splitbar" style="-moz-user-select:none;"
94 class="ui-resizable-handle">
95 </div>
96</div>
97<script type="text/javascript">
98$(document).ready(function(){initNavTree('namespacearm__compute_1_1utils.xhtml','');});
99</script>
100<div id="doc-content">
101<!-- window showing the filter options -->
102<div id="MSearchSelectWindow"
103 onmouseover="return searchBox.OnSearchSelectShow()"
104 onmouseout="return searchBox.OnSearchSelectHide()"
105 onkeydown="return searchBox.OnSearchSelectKey(event)">
106</div>
107
108<!-- iframe showing the search results (closed by default) -->
109<div id="MSearchResultsWindow">
110<iframe src="javascript:void(0)" frameborder="0"
111 name="MSearchResults" id="MSearchResults">
112</iframe>
113</div>
114
115<div class="header">
116 <div class="summary">
117<a href="#nested-classes">Data Structures</a> &#124;
118<a href="#typedef-members">Typedefs</a> &#124;
119<a href="#func-members">Functions</a> </div>
120 <div class="headertitle">
121<div class="title">arm_compute::utils Namespace Reference</div> </div>
122</div><!--header-->
123<div class="contents">
124<table class="memberdecls">
125<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
126Data Structures</h2></td></tr>
127<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml">PPMLoader</a></td></tr>
128<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Class to load the content of a PPM file into an <a class="el" href="struct_image.xhtml" title="Structure to hold Image information. ">Image</a>. <a href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml#details">More...</a><br /></td></tr>
129<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
130</table><table class="memberdecls">
131<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
132Typedefs</h2></td></tr>
133<tr class="memitem:a27e6364d61a5b27447d27337aa182cad"><td class="memItemLeft" align="right" valign="top">using&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacearm__compute_1_1utils.xhtml#a27e6364d61a5b27447d27337aa182cad">example</a> = void(int argc, const char **argv)</td></tr>
134<tr class="memdesc:a27e6364d61a5b27447d27337aa182cad"><td class="mdescLeft">&#160;</td><td class="mdescRight">Signature of an example to run. <a href="#a27e6364d61a5b27447d27337aa182cad">More...</a><br /></td></tr>
135<tr class="separator:a27e6364d61a5b27447d27337aa182cad"><td class="memSeparator" colspan="2">&#160;</td></tr>
136</table><table class="memberdecls">
137<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
138Functions</h2></td></tr>
139<tr class="memitem:a4c9395db2c8b8d0c336656a7b58fca3e"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacearm__compute_1_1utils.xhtml#a4c9395db2c8b8d0c336656a7b58fca3e">run_example</a> (int argc, const char **argv, <a class="el" href="namespacearm__compute_1_1utils.xhtml#a27e6364d61a5b27447d27337aa182cad">example</a> &amp;func)</td></tr>
140<tr class="memdesc:a4c9395db2c8b8d0c336656a7b58fca3e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Run an example and handle the potential exceptions it throws. <a href="#a4c9395db2c8b8d0c336656a7b58fca3e">More...</a><br /></td></tr>
141<tr class="separator:a4c9395db2c8b8d0c336656a7b58fca3e"><td class="memSeparator" colspan="2">&#160;</td></tr>
142<tr class="memitem:ad1b5373f466a3945e1f0ef1c9943c357"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacearm__compute_1_1utils.xhtml#ad1b5373f466a3945e1f0ef1c9943c357">draw_detection_rectangle</a> (<a class="el" href="classarm__compute_1_1_i_tensor.xhtml">arm_compute::ITensor</a> *tensor, const <a class="el" href="structarm__compute_1_1_detection_window.xhtml">arm_compute::DetectionWindow</a> &amp;rect, uint8_t r, uint8_t g, uint8_t b)</td></tr>
143<tr class="memdesc:ad1b5373f466a3945e1f0ef1c9943c357"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw a RGB rectangular window for the detected object. <a href="#ad1b5373f466a3945e1f0ef1c9943c357">More...</a><br /></td></tr>
144<tr class="separator:ad1b5373f466a3945e1f0ef1c9943c357"><td class="memSeparator" colspan="2">&#160;</td></tr>
145<tr class="memitem:a3aa8f5f1b94f88fdf5b43a53e29379cf"><td class="memItemLeft" align="right" valign="top">std::tuple&lt; unsigned int, unsigned int, int &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacearm__compute_1_1utils.xhtml#a3aa8f5f1b94f88fdf5b43a53e29379cf">parse_ppm_header</a> (std::ifstream &amp;fs)</td></tr>
146<tr class="memdesc:a3aa8f5f1b94f88fdf5b43a53e29379cf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Parse the ppm header from an input file stream. <a href="#a3aa8f5f1b94f88fdf5b43a53e29379cf">More...</a><br /></td></tr>
147<tr class="separator:a3aa8f5f1b94f88fdf5b43a53e29379cf"><td class="memSeparator" colspan="2">&#160;</td></tr>
148<tr class="memitem:a301d0b7bfd70f73fc1924f4281938d08"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
149<tr class="memitem:a301d0b7bfd70f73fc1924f4281938d08"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespacearm__compute_1_1utils.xhtml#a301d0b7bfd70f73fc1924f4281938d08">save_to_ppm</a> (T &amp;tensor, const std::string &amp;ppm_filename)</td></tr>
150<tr class="memdesc:a301d0b7bfd70f73fc1924f4281938d08"><td class="mdescLeft">&#160;</td><td class="mdescRight">Template helper function to save a tensor image to a PPM file. <a href="#a301d0b7bfd70f73fc1924f4281938d08">More...</a><br /></td></tr>
151<tr class="separator:a301d0b7bfd70f73fc1924f4281938d08"><td class="memSeparator" colspan="2">&#160;</td></tr>
152</table>
153<h2 class="groupheader">Typedef Documentation</h2>
154<a class="anchor" id="a27e6364d61a5b27447d27337aa182cad"></a>
155<div class="memitem">
156<div class="memproto">
157 <table class="memname">
158 <tr>
159 <td class="memname">using <a class="el" href="namespacearm__compute_1_1utils.xhtml#a27e6364d61a5b27447d27337aa182cad">example</a> = void(int argc, const char **argv)</td>
160 </tr>
161 </table>
162</div><div class="memdoc">
163
164<p>Signature of an example to run. </p>
165<dl class="params"><dt>Parameters</dt><dd>
166 <table class="params">
167 <tr><td class="paramdir">[in]</td><td class="paramname">argc</td><td>Number of command line arguments </td></tr>
168 <tr><td class="paramdir">[in]</td><td class="paramname">argv</td><td>Command line arguments </td></tr>
169 </table>
170 </dd>
171</dl>
172
173<p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00052">52</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
174
175</div>
176</div>
177<h2 class="groupheader">Function Documentation</h2>
178<a class="anchor" id="ad1b5373f466a3945e1f0ef1c9943c357"></a>
179<div class="memitem">
180<div class="memproto">
181 <table class="memname">
182 <tr>
183 <td class="memname">void draw_detection_rectangle </td>
184 <td>(</td>
185 <td class="paramtype"><a class="el" href="classarm__compute_1_1_i_tensor.xhtml">arm_compute::ITensor</a> *&#160;</td>
186 <td class="paramname"><em>tensor</em>, </td>
187 </tr>
188 <tr>
189 <td class="paramkey"></td>
190 <td></td>
191 <td class="paramtype">const <a class="el" href="structarm__compute_1_1_detection_window.xhtml">arm_compute::DetectionWindow</a> &amp;&#160;</td>
192 <td class="paramname"><em>rect</em>, </td>
193 </tr>
194 <tr>
195 <td class="paramkey"></td>
196 <td></td>
197 <td class="paramtype">uint8_t&#160;</td>
198 <td class="paramname"><em>r</em>, </td>
199 </tr>
200 <tr>
201 <td class="paramkey"></td>
202 <td></td>
203 <td class="paramtype">uint8_t&#160;</td>
204 <td class="paramname"><em>g</em>, </td>
205 </tr>
206 <tr>
207 <td class="paramkey"></td>
208 <td></td>
209 <td class="paramtype">uint8_t&#160;</td>
210 <td class="paramname"><em>b</em>&#160;</td>
211 </tr>
212 <tr>
213 <td></td>
214 <td>)</td>
215 <td></td><td></td>
216 </tr>
217 </table>
218</div><div class="memdoc">
219
220<p>Draw a RGB rectangular window for the detected object. </p>
221<dl class="params"><dt>Parameters</dt><dd>
222 <table class="params">
223 <tr><td class="paramdir">[in,out]</td><td class="paramname">tensor</td><td>Input tensor where the rectangle will be drawn on. Format supported: RGB888 </td></tr>
224 <tr><td class="paramdir">[in]</td><td class="paramname">rect</td><td>Geometry of the rectangular window </td></tr>
225 <tr><td class="paramdir">[in]</td><td class="paramname">r</td><td>Red colour to use </td></tr>
226 <tr><td class="paramdir">[in]</td><td class="paramname">g</td><td>Green colour to use </td></tr>
227 <tr><td class="paramdir">[in]</td><td class="paramname">b</td><td>Blue colour to use </td></tr>
228 </table>
229 </dd>
230</dl>
231
232<p>Definition at line <a class="el" href="utils_2_utils_8cpp_source.xhtml#l00103">103</a> of file <a class="el" href="utils_2_utils_8cpp_source.xhtml">Utils.cpp</a>.</p>
233
234<p>References <a class="el" href="_validate_8h_source.xhtml#l00359">ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN</a>, <a class="el" href="classarm__compute_1_1_i_tensor.xhtml#ab988210662dbd3bf32fd563c7dd1bdbf">ITensor::buffer()</a>, <a class="el" href="_window_8h_source.xhtml#l00045">Window::DimY</a>, <a class="el" href="arm__compute_2core_2_types_8h_source.xhtml#l00364">DetectionWindow::height</a>, <a class="el" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">ITensor::info()</a>, <a class="el" href="classarm__compute_1_1_i_tensor_info.xhtml#a8a5312c9a822d27a3b38dc238c1c7de3">ITensorInfo::offset_element_in_bytes()</a>, <a class="el" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a30ff380a3be74628024063a99fba10f0">arm_compute::RGB888</a>, <a class="el" href="classarm__compute_1_1_i_tensor_info.xhtml#a6b14f175bf5281f57b561e2d4e4b1f1f">ITensorInfo::strides_in_bytes()</a>, <a class="el" href="arm__compute_2core_2_types_8h_source.xhtml#l00363">DetectionWindow::width</a>, <a class="el" href="arm__compute_2core_2_types_8h_source.xhtml#l00361">DetectionWindow::x</a>, and <a class="el" href="arm__compute_2core_2_types_8h_source.xhtml#l00362">DetectionWindow::y</a>.</p>
235<div class="fragment"><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160;{</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; <a class="code" href="_validate_8h.xhtml#a0d34a8aa07600727e4e5034c7cdad47d">ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN</a>(tensor, Format::RGB888);</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160;</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; uint8_t *top = tensor-&gt;<a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>()-&gt;<a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml#a8a5312c9a822d27a3b38dc238c1c7de3">offset_element_in_bytes</a>(Coordinates(rect.<a class="code" href="struct_detection_window.xhtml#a0815db32ce16586f5e90a633735df930">x</a>, rect.<a class="code" href="struct_detection_window.xhtml#a45b45124e843a937c3e256edbce64eea">y</a>)) + tensor-&gt;<a class="code" href="classarm__compute_1_1_i_tensor.xhtml#ab988210662dbd3bf32fd563c7dd1bdbf">buffer</a>();</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; uint8_t *bottom = tensor-&gt;<a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>()-&gt;<a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml#a8a5312c9a822d27a3b38dc238c1c7de3">offset_element_in_bytes</a>(Coordinates(rect.<a class="code" href="struct_detection_window.xhtml#a0815db32ce16586f5e90a633735df930">x</a>, rect.<a class="code" href="struct_detection_window.xhtml#a45b45124e843a937c3e256edbce64eea">y</a> + rect.<a class="code" href="struct_detection_window.xhtml#aa0fb54e3dbe6f7446157eb3f3c1f77f3">height</a>)) + tensor-&gt;<a class="code" href="classarm__compute_1_1_i_tensor.xhtml#ab988210662dbd3bf32fd563c7dd1bdbf">buffer</a>();</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; uint8_t *left = top;</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; uint8_t *right = tensor-&gt;<a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>()-&gt;<a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml#a8a5312c9a822d27a3b38dc238c1c7de3">offset_element_in_bytes</a>(Coordinates(rect.<a class="code" href="struct_detection_window.xhtml#a0815db32ce16586f5e90a633735df930">x</a> + rect.<a class="code" href="struct_detection_window.xhtml#a67fe5ca4d6c3f95bf649ef48fe3d221b">width</a>, rect.<a class="code" href="struct_detection_window.xhtml#a45b45124e843a937c3e256edbce64eea">y</a>)) + tensor-&gt;<a class="code" href="classarm__compute_1_1_i_tensor.xhtml#ab988210662dbd3bf32fd563c7dd1bdbf">buffer</a>();</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160; <span class="keywordtype">size_t</span> stride = tensor-&gt;<a class="code" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">info</a>()-&gt;<a class="code" href="classarm__compute_1_1_i_tensor_info.xhtml#a6b14f175bf5281f57b561e2d4e4b1f1f">strides_in_bytes</a>()[Window::DimY];</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160;</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> x = 0; x &lt; rect.<a class="code" href="struct_detection_window.xhtml#a67fe5ca4d6c3f95bf649ef48fe3d221b">width</a>; ++x)</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; {</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; top[0] = r;</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; top[1] = g;</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; top[2] = b;</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160; bottom[0] = r;</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160; bottom[1] = g;</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; bottom[2] = b;</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160;</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; top += 3;</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160; bottom += 3;</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160; }</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160;</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> y = 0; y &lt; rect.<a class="code" href="struct_detection_window.xhtml#aa0fb54e3dbe6f7446157eb3f3c1f77f3">height</a>; ++y)</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160; {</div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160; left[0] = r;</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; left[1] = g;</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160; left[2] = b;</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160; right[0] = r;</div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160; right[1] = g;</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160; right[2] = b;</div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160;</div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160; left += stride;</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160; right += stride;</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span>&#160; }</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>&#160;}</div><div class="ttc" id="_validate_8h_xhtml_a0d34a8aa07600727e4e5034c7cdad47d"><div class="ttname"><a href="_validate_8h.xhtml#a0d34a8aa07600727e4e5034c7cdad47d">ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN</a></div><div class="ttdeci">#define ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN(t,...)</div><div class="ttdef"><b>Definition:</b> <a href="_validate_8h_source.xhtml#l00359">Validate.h:359</a></div></div>
236<div class="ttc" id="classarm__compute_1_1_i_tensor_info_xhtml_a8a5312c9a822d27a3b38dc238c1c7de3"><div class="ttname"><a href="classarm__compute_1_1_i_tensor_info.xhtml#a8a5312c9a822d27a3b38dc238c1c7de3">arm_compute::ITensorInfo::offset_element_in_bytes</a></div><div class="ttdeci">virtual size_t offset_element_in_bytes(const Coordinates &amp;pos) const =0</div><div class="ttdoc">The offset in bytes from the beginning of the memory allocation to access the element at position (x...</div></div>
237<div class="ttc" id="classarm__compute_1_1_i_tensor_xhtml_ab988210662dbd3bf32fd563c7dd1bdbf"><div class="ttname"><a href="classarm__compute_1_1_i_tensor.xhtml#ab988210662dbd3bf32fd563c7dd1bdbf">arm_compute::ITensor::buffer</a></div><div class="ttdeci">virtual uint8_t * buffer() const =0</div><div class="ttdoc">Interface to be implemented by the child class to return a pointer to CPU memory. ...</div></div>
238<div class="ttc" id="struct_detection_window_xhtml_a45b45124e843a937c3e256edbce64eea"><div class="ttname"><a href="struct_detection_window.xhtml#a45b45124e843a937c3e256edbce64eea">DetectionWindow::y</a></div><div class="ttdeci">ushort y</div><div class="ttdoc">Top-left y coordinate. </div><div class="ttdef"><b>Definition:</b> <a href="types_8h_source.xhtml#l00050">types.h:50</a></div></div>
239<div class="ttc" id="classarm__compute_1_1_i_tensor_xhtml_a0e95dc1e53c361348314873b168ae237"><div class="ttname"><a href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">arm_compute::ITensor::info</a></div><div class="ttdeci">virtual ITensorInfo * info() const =0</div><div class="ttdoc">Interface to be implemented by the child class to return the tensor&amp;#39;s metadata. </div></div>
240<div class="ttc" id="struct_detection_window_xhtml_aa0fb54e3dbe6f7446157eb3f3c1f77f3"><div class="ttname"><a href="struct_detection_window.xhtml#aa0fb54e3dbe6f7446157eb3f3c1f77f3">DetectionWindow::height</a></div><div class="ttdeci">ushort height</div><div class="ttdoc">Height of the detection window. </div><div class="ttdef"><b>Definition:</b> <a href="types_8h_source.xhtml#l00052">types.h:52</a></div></div>
241<div class="ttc" id="classarm__compute_1_1_i_tensor_info_xhtml_a6b14f175bf5281f57b561e2d4e4b1f1f"><div class="ttname"><a href="classarm__compute_1_1_i_tensor_info.xhtml#a6b14f175bf5281f57b561e2d4e4b1f1f">arm_compute::ITensorInfo::strides_in_bytes</a></div><div class="ttdeci">virtual const Strides &amp; strides_in_bytes() const =0</div><div class="ttdoc">The strides in bytes for accessing each dimension of the tensor. </div></div>
242<div class="ttc" id="struct_detection_window_xhtml_a0815db32ce16586f5e90a633735df930"><div class="ttname"><a href="struct_detection_window.xhtml#a0815db32ce16586f5e90a633735df930">DetectionWindow::x</a></div><div class="ttdeci">ushort x</div><div class="ttdoc">Top-left x coordinate. </div><div class="ttdef"><b>Definition:</b> <a href="types_8h_source.xhtml#l00049">types.h:49</a></div></div>
243<div class="ttc" id="struct_detection_window_xhtml_a67fe5ca4d6c3f95bf649ef48fe3d221b"><div class="ttname"><a href="struct_detection_window.xhtml#a67fe5ca4d6c3f95bf649ef48fe3d221b">DetectionWindow::width</a></div><div class="ttdeci">ushort width</div><div class="ttdoc">Width of the detection window. </div><div class="ttdef"><b>Definition:</b> <a href="types_8h_source.xhtml#l00051">types.h:51</a></div></div>
244</div><!-- fragment -->
245</div>
246</div>
247<a class="anchor" id="a3aa8f5f1b94f88fdf5b43a53e29379cf"></a>
248<div class="memitem">
249<div class="memproto">
250 <table class="memname">
251 <tr>
252 <td class="memname">std::tuple&lt; unsigned int, unsigned int, int &gt; parse_ppm_header </td>
253 <td>(</td>
254 <td class="paramtype">std::ifstream &amp;&#160;</td>
255 <td class="paramname"><em>fs</em></td><td>)</td>
256 <td></td>
257 </tr>
258 </table>
259</div><div class="memdoc">
260
261<p>Parse the ppm header from an input file stream. </p>
262<p>At the end of the execution, the file position pointer will be located at the first pixel stored in the ppm file</p>
263<dl class="params"><dt>Parameters</dt><dd>
264 <table class="params">
265 <tr><td class="paramdir">[in]</td><td class="paramname">fs</td><td>Input file stream to parse</td></tr>
266 </table>
267 </dd>
268</dl>
269<dl class="section return"><dt>Returns</dt><dd>The width, height and max value stored in the header of the PPM file </dd></dl>
270
271<p>Definition at line <a class="el" href="utils_2_utils_8cpp_source.xhtml#l00140">140</a> of file <a class="el" href="utils_2_utils_8cpp_source.xhtml">Utils.cpp</a>.</p>
272
273<p>References <a class="el" href="_error_8h_source.xhtml#l00115">ARM_COMPUTE_ERROR_ON_MSG</a>, and <a class="el" href="_error_8h_source.xhtml#l00049">ARM_COMPUTE_UNUSED</a>.</p>
274
275<p>Referenced by <a class="el" href="utils_2_utils_8h_source.xhtml#l00094">PPMLoader::open()</a>.</p>
276<div class="fragment"><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160;{</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; <span class="comment">// Check the PPM magic number is valid</span></div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; std::array&lt;char, 2&gt; magic_number{ { 0 } };</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160; fs &gt;&gt; magic_number[0] &gt;&gt; magic_number[1];</div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; <a class="code" href="_error_8h.xhtml#a5bbdcf574d3f5e412fa6a1117911e67b">ARM_COMPUTE_ERROR_ON_MSG</a>(magic_number[0] != <span class="charliteral">&#39;P&#39;</span> || magic_number[1] != <span class="charliteral">&#39;6&#39;</span>, <span class="stringliteral">&quot;Invalid file type&quot;</span>);</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; <a class="code" href="_error_8h.xhtml#a4103adbb45806b2f2002d44b91d0d206">ARM_COMPUTE_UNUSED</a>(magic_number);</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160;</div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160; discard_comments_and_spaces(fs);</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160;</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> width = 0;</div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160; fs &gt;&gt; width;</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160;</div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160; discard_comments_and_spaces(fs);</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160;</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160; <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> height = 0;</div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160; fs &gt;&gt; height;</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160;</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160; discard_comments_and_spaces(fs);</div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160;</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; <span class="keywordtype">int</span> max_val = 0;</div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160; fs &gt;&gt; max_val;</div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160;</div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160; discard_comments(fs);</div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160;</div><div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160; <a class="code" href="_error_8h.xhtml#a5bbdcf574d3f5e412fa6a1117911e67b">ARM_COMPUTE_ERROR_ON_MSG</a>(isspace(fs.peek()) == 0, <span class="stringliteral">&quot;Invalid PPM header&quot;</span>);</div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span>&#160; fs.ignore(1);</div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160;</div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160; <span class="keywordflow">return</span> std::make_tuple(width, height, max_val);</div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160;}</div><div class="ttc" id="_error_8h_xhtml_a4103adbb45806b2f2002d44b91d0d206"><div class="ttname"><a href="_error_8h.xhtml#a4103adbb45806b2f2002d44b91d0d206">ARM_COMPUTE_UNUSED</a></div><div class="ttdeci">#define ARM_COMPUTE_UNUSED(var)</div><div class="ttdoc">To avoid unused variables warnings. </div><div class="ttdef"><b>Definition:</b> <a href="_error_8h_source.xhtml#l00049">Error.h:49</a></div></div>
277<div class="ttc" id="_error_8h_xhtml_a5bbdcf574d3f5e412fa6a1117911e67b"><div class="ttname"><a href="_error_8h.xhtml#a5bbdcf574d3f5e412fa6a1117911e67b">ARM_COMPUTE_ERROR_ON_MSG</a></div><div class="ttdeci">#define ARM_COMPUTE_ERROR_ON_MSG(cond,...)</div><div class="ttdef"><b>Definition:</b> <a href="_error_8h_source.xhtml#l00115">Error.h:115</a></div></div>
278</div><!-- fragment -->
279</div>
280</div>
281<a class="anchor" id="a4c9395db2c8b8d0c336656a7b58fca3e"></a>
282<div class="memitem">
283<div class="memproto">
284 <table class="memname">
285 <tr>
286 <td class="memname">int run_example </td>
287 <td>(</td>
288 <td class="paramtype">int&#160;</td>
289 <td class="paramname"><em>argc</em>, </td>
290 </tr>
291 <tr>
292 <td class="paramkey"></td>
293 <td></td>
294 <td class="paramtype">const char **&#160;</td>
295 <td class="paramname"><em>argv</em>, </td>
296 </tr>
297 <tr>
298 <td class="paramkey"></td>
299 <td></td>
300 <td class="paramtype"><a class="el" href="namespacearm__compute_1_1utils.xhtml#a27e6364d61a5b27447d27337aa182cad">example</a> &amp;&#160;</td>
301 <td class="paramname"><em>func</em>&#160;</td>
302 </tr>
303 <tr>
304 <td></td>
305 <td>)</td>
306 <td></td><td></td>
307 </tr>
308 </table>
309</div><div class="memdoc">
310
311<p>Run an example and handle the potential exceptions it throws. </p>
312<dl class="params"><dt>Parameters</dt><dd>
313 <table class="params">
314 <tr><td class="paramdir">[in]</td><td class="paramname">argc</td><td>Number of command line arguments </td></tr>
315 <tr><td class="paramdir">[in]</td><td class="paramname">argv</td><td>Command line arguments </td></tr>
316 <tr><td class="paramdir">[in]</td><td class="paramname">func</td><td>Pointer to the function containing the code to run </td></tr>
317 </table>
318 </dd>
319</dl>
320
321<p>Definition at line <a class="el" href="utils_2_utils_8cpp_source.xhtml#l00069">69</a> of file <a class="el" href="utils_2_utils_8cpp_source.xhtml">Utils.cpp</a>.</p>
322
323<p>Referenced by <a class="el" href="cl__convolution_8cpp_source.xhtml#l00115">main()</a>.</p>
324<div class="fragment"><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;{</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; std::cout &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span></div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; &lt;&lt; argv[0] &lt;&lt; <span class="stringliteral">&quot;\n\n&quot;</span>;</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; <span class="keywordflow">try</span></div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; {</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; func(argc, argv);</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160;</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; std::cout &lt;&lt; <span class="stringliteral">&quot;\nTest passed\n&quot;</span>;</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; }</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160;<span class="preprocessor">#ifdef ARM_COMPUTE_CL</span></div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; <span class="keywordflow">catch</span>(cl::Error &amp;err)</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; {</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160; std::cerr &lt;&lt; <span class="stringliteral">&quot;!!!!!!!!!!!!!!!!!!!!!!!!!!!&quot;</span> &lt;&lt; std::endl;</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; std::cerr &lt;&lt; std::endl</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; &lt;&lt; <span class="stringliteral">&quot;ERROR &quot;</span> &lt;&lt; err.what() &lt;&lt; <span class="stringliteral">&quot;(&quot;</span> &lt;&lt; err.err() &lt;&lt; <span class="stringliteral">&quot;)&quot;</span> &lt;&lt; std::endl;</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; std::cerr &lt;&lt; <span class="stringliteral">&quot;!!!!!!!!!!!!!!!!!!!!!!!!!!!&quot;</span> &lt;&lt; std::endl;</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160; }</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* ARM_COMPUTE_CL */</span><span class="preprocessor"></span></div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; <span class="keywordflow">catch</span>(std::runtime_error &amp;err)</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; {</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160; std::cerr &lt;&lt; <span class="stringliteral">&quot;!!!!!!!!!!!!!!!!!!!!!!!!!!!&quot;</span> &lt;&lt; std::endl;</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160; std::cerr &lt;&lt; std::endl</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160; &lt;&lt; <span class="stringliteral">&quot;ERROR &quot;</span> &lt;&lt; err.what() &lt;&lt; <span class="stringliteral">&quot; &quot;</span> &lt;&lt; (errno ? strerror(errno) : <span class="stringliteral">&quot;&quot;</span>) &lt;&lt; std::endl;</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160; std::cerr &lt;&lt; <span class="stringliteral">&quot;!!!!!!!!!!!!!!!!!!!!!!!!!!!&quot;</span> &lt;&lt; std::endl;</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160; }</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160;</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160; std::cout &lt;&lt; <span class="stringliteral">&quot;\nTest FAILED\n&quot;</span>;</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160;</div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160;}</div></div><!-- fragment -->
325</div>
326</div>
327<a class="anchor" id="a301d0b7bfd70f73fc1924f4281938d08"></a>
328<div class="memitem">
329<div class="memproto">
330 <table class="memname">
331 <tr>
332 <td class="memname">void arm_compute::utils::save_to_ppm </td>
333 <td>(</td>
334 <td class="paramtype">T &amp;&#160;</td>
335 <td class="paramname"><em>tensor</em>, </td>
336 </tr>
337 <tr>
338 <td class="paramkey"></td>
339 <td></td>
340 <td class="paramtype">const std::string &amp;&#160;</td>
341 <td class="paramname"><em>ppm_filename</em>&#160;</td>
342 </tr>
343 <tr>
344 <td></td>
345 <td>)</td>
346 <td></td><td></td>
347 </tr>
348 </table>
349</div><div class="memdoc">
350
351<p>Template helper function to save a tensor image to a PPM file. </p>
352<dl class="section note"><dt>Note</dt><dd>Only U8 and RGB888 formats supported. </dd>
353<dd>
354Only works with 2D tensors. </dd>
355<dd>
356If the input tensor is a <a class="el" href="classarm__compute_1_1_c_l_tensor.xhtml" title="Basic implementation of the OpenCL tensor interface. ">CLTensor</a>, the function maps and unmaps the image</dd></dl>
357<dl class="params"><dt>Parameters</dt><dd>
358 <table class="params">
359 <tr><td class="paramdir">[in]</td><td class="paramname">tensor</td><td>The tensor to save as PPM file </td></tr>
360 <tr><td class="paramdir">[in]</td><td class="paramname">ppm_filename</td><td>Filename of the file to create. </td></tr>
361 </table>
362 </dd>
363</dl>
364
365<p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00245">245</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
366
367<p>References <a class="el" href="_error_8h_source.xhtml#l00031">ARM_COMPUTE_ERROR</a>, <a class="el" href="_error_8h_source.xhtml#l00124">ARM_COMPUTE_ERROR_ON</a>, <a class="el" href="_validate_8h_source.xhtml#l00359">ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN</a>, <a class="el" href="_window_8h_source.xhtml#l00043">Window::DimX</a>, <a class="el" href="_window_8h_source.xhtml#l00045">Window::DimY</a>, <a class="el" href="_helpers_8inl_source.xhtml#l00176">arm_compute::execute_window_loop()</a>, <a class="el" href="_helpers_8inl_source.xhtml#l00232">Iterator::ptr()</a>, <a class="el" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a30ff380a3be74628024063a99fba10f0">arm_compute::RGB888</a>, <a class="el" href="_window_8inl_source.xhtml#l00040">Window::set()</a>, and <a class="el" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6669348b484e3008dca2bfa8e85e40b5">arm_compute::U8</a>.</p>
368
369<p>Referenced by <a class="el" href="cl__convolution_8cpp_source.xhtml#l00053">main_cl_convolution()</a>, <a class="el" href="cl__events_8cpp_source.xhtml#l00033">main_cl_events()</a>, <a class="el" href="neon__convolution_8cpp_source.xhtml#l00052">main_neon_convolution()</a>, <a class="el" href="neon__scale_8cpp_source.xhtml#l00032">main_neon_scale()</a>, and <a class="el" href="neoncl__scale__median__gaussian_8cpp_source.xhtml#l00039">main_neoncl_scale_median_gaussian()</a>.</p>
370<div class="fragment"><div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160;{</div><div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160; <a class="code" href="_validate_8h.xhtml#a0d34a8aa07600727e4e5034c7cdad47d">ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN</a>(&amp;tensor, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a30ff380a3be74628024063a99fba10f0">arm_compute::Format::RGB888</a>, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6669348b484e3008dca2bfa8e85e40b5">arm_compute::Format::U8</a>);</div><div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160; <a class="code" href="_error_8h.xhtml#a54a6080c9f4df1f908e57a9bbb46f5da">ARM_COMPUTE_ERROR_ON</a>(tensor.info()-&gt;num_dimensions() &gt; 2);</div><div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160;</div><div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160; std::ofstream fs;</div><div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160;</div><div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160; <span class="keywordflow">try</span></div><div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160; {</div><div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160; fs.exceptions(std::ofstream::failbit | std::ofstream::badbit | std::ofstream::eofbit);</div><div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160; fs.open(ppm_filename, std::ios::out | std::ios::binary);</div><div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160;</div><div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160; <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> width = tensor.info()-&gt;tensor_shape()[0];</div><div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160; <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> height = tensor.info()-&gt;tensor_shape()[1];</div><div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160;</div><div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160; fs &lt;&lt; <span class="stringliteral">&quot;P6\n&quot;</span></div><div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160; &lt;&lt; width &lt;&lt; <span class="stringliteral">&quot; &quot;</span> &lt;&lt; height &lt;&lt; <span class="stringliteral">&quot; 255\n&quot;</span>;</div><div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160;</div><div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160;<span class="preprocessor">#ifdef ARM_COMPUTE_CL</span></div><div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160; <span class="comment">// Map buffer if creating a CLTensor</span></div><div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160; <span class="keywordflow">if</span>(std::is_same&lt;<span class="keyword">typename</span> std::decay&lt;T&gt;::type, <a class="code" href="classarm__compute_1_1_c_l_tensor.xhtml">arm_compute::CLTensor</a>&gt;::value)</div><div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160; {</div><div class="line"><a name="l00267"></a><span class="lineno"> 267</span>&#160; tensor.map();</div><div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160; }</div><div class="line"><a name="l00269"></a><span class="lineno"> 269</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160;</div><div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160; <span class="keywordflow">switch</span>(tensor.info()-&gt;format())</div><div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160; {</div><div class="line"><a name="l00273"></a><span class="lineno"> 273</span>&#160; <span class="keywordflow">case</span> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6669348b484e3008dca2bfa8e85e40b5">arm_compute::Format::U8</a>:</div><div class="line"><a name="l00274"></a><span class="lineno"> 274</span>&#160; {</div><div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160; <a class="code" href="classarm__compute_1_1_window.xhtml">arm_compute::Window</a> window;</div><div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160; window.<a class="code" href="classarm__compute_1_1_window.xhtml#acd3d2bba51cb84d34dd7656ad2375a6e">set</a>(<a class="code" href="classarm__compute_1_1_window.xhtml#aa96e81276ee4f87ab386cd05a5539a7d">arm_compute::Window::DimX</a>, <a class="code" href="classarm__compute_1_1_window_1_1_dimension.xhtml">arm_compute::Window::Dimension</a>(0, width, 1));</div><div class="line"><a name="l00277"></a><span class="lineno"> 277</span>&#160; window.<a class="code" href="classarm__compute_1_1_window.xhtml#acd3d2bba51cb84d34dd7656ad2375a6e">set</a>(<a class="code" href="classarm__compute_1_1_window.xhtml#ad2d402364fa822b0b7775081291eeca9">arm_compute::Window::DimY</a>, <a class="code" href="classarm__compute_1_1_window_1_1_dimension.xhtml">arm_compute::Window::Dimension</a>(0, height, 1));</div><div class="line"><a name="l00278"></a><span class="lineno"> 278</span>&#160;</div><div class="line"><a name="l00279"></a><span class="lineno"> 279</span>&#160; <a class="code" href="classarm__compute_1_1_iterator.xhtml">arm_compute::Iterator</a> in(&amp;tensor, window);</div><div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160;</div><div class="line"><a name="l00281"></a><span class="lineno"> 281</span>&#160; <a class="code" href="namespacearm__compute.xhtml#a6c0dcc38187027dcb89cd9724bc5a823">arm_compute::execute_window_loop</a>(window, [&amp;](<span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_coordinates.xhtml">arm_compute::Coordinates</a> &amp; <span class="keywordtype">id</span>)</div><div class="line"><a name="l00282"></a><span class="lineno"> 282</span>&#160; {</div><div class="line"><a name="l00283"></a><span class="lineno"> 283</span>&#160; <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> value = *in.ptr();</div><div class="line"><a name="l00284"></a><span class="lineno"> 284</span>&#160;</div><div class="line"><a name="l00285"></a><span class="lineno"> 285</span>&#160; fs &lt;&lt; value &lt;&lt; value &lt;&lt; value;</div><div class="line"><a name="l00286"></a><span class="lineno"> 286</span>&#160; },</div><div class="line"><a name="l00287"></a><span class="lineno"> 287</span>&#160; in);</div><div class="line"><a name="l00288"></a><span class="lineno"> 288</span>&#160;</div><div class="line"><a name="l00289"></a><span class="lineno"> 289</span>&#160; <span class="keywordflow">break</span>;</div><div class="line"><a name="l00290"></a><span class="lineno"> 290</span>&#160; }</div><div class="line"><a name="l00291"></a><span class="lineno"> 291</span>&#160; <span class="keywordflow">case</span> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a30ff380a3be74628024063a99fba10f0">arm_compute::Format::RGB888</a>:</div><div class="line"><a name="l00292"></a><span class="lineno"> 292</span>&#160; {</div><div class="line"><a name="l00293"></a><span class="lineno"> 293</span>&#160; <a class="code" href="classarm__compute_1_1_window.xhtml">arm_compute::Window</a> window;</div><div class="line"><a name="l00294"></a><span class="lineno"> 294</span>&#160; window.<a class="code" href="classarm__compute_1_1_window.xhtml#acd3d2bba51cb84d34dd7656ad2375a6e">set</a>(<a class="code" href="classarm__compute_1_1_window.xhtml#aa96e81276ee4f87ab386cd05a5539a7d">arm_compute::Window::DimX</a>, <a class="code" href="classarm__compute_1_1_window_1_1_dimension.xhtml">arm_compute::Window::Dimension</a>(0, width, width));</div><div class="line"><a name="l00295"></a><span class="lineno"> 295</span>&#160; window.<a class="code" href="classarm__compute_1_1_window.xhtml#acd3d2bba51cb84d34dd7656ad2375a6e">set</a>(<a class="code" href="classarm__compute_1_1_window.xhtml#ad2d402364fa822b0b7775081291eeca9">arm_compute::Window::DimY</a>, <a class="code" href="classarm__compute_1_1_window_1_1_dimension.xhtml">arm_compute::Window::Dimension</a>(0, height, 1));</div><div class="line"><a name="l00296"></a><span class="lineno"> 296</span>&#160;</div><div class="line"><a name="l00297"></a><span class="lineno"> 297</span>&#160; <a class="code" href="classarm__compute_1_1_iterator.xhtml">arm_compute::Iterator</a> in(&amp;tensor, window);</div><div class="line"><a name="l00298"></a><span class="lineno"> 298</span>&#160;</div><div class="line"><a name="l00299"></a><span class="lineno"> 299</span>&#160; <a class="code" href="namespacearm__compute.xhtml#a6c0dcc38187027dcb89cd9724bc5a823">arm_compute::execute_window_loop</a>(window, [&amp;](<span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_coordinates.xhtml">arm_compute::Coordinates</a> &amp; <span class="keywordtype">id</span>)</div><div class="line"><a name="l00300"></a><span class="lineno"> 300</span>&#160; {</div><div class="line"><a name="l00301"></a><span class="lineno"> 301</span>&#160; fs.write(reinterpret_cast&lt;std::fstream::char_type *&gt;(in.ptr()), width * tensor.info()-&gt;element_size());</div><div class="line"><a name="l00302"></a><span class="lineno"> 302</span>&#160; },</div><div class="line"><a name="l00303"></a><span class="lineno"> 303</span>&#160; in);</div><div class="line"><a name="l00304"></a><span class="lineno"> 304</span>&#160;</div><div class="line"><a name="l00305"></a><span class="lineno"> 305</span>&#160; <span class="keywordflow">break</span>;</div><div class="line"><a name="l00306"></a><span class="lineno"> 306</span>&#160; }</div><div class="line"><a name="l00307"></a><span class="lineno"> 307</span>&#160; <span class="keywordflow">default</span>:</div><div class="line"><a name="l00308"></a><span class="lineno"> 308</span>&#160; <a class="code" href="_error_8h.xhtml#a05b19c75afe9c24200a62b9724734bbd">ARM_COMPUTE_ERROR</a>(<span class="stringliteral">&quot;Unsupported format&quot;</span>);</div><div class="line"><a name="l00309"></a><span class="lineno"> 309</span>&#160; }</div><div class="line"><a name="l00310"></a><span class="lineno"> 310</span>&#160;<span class="preprocessor">#ifdef ARM_COMPUTE_CL</span></div><div class="line"><a name="l00311"></a><span class="lineno"> 311</span>&#160; <span class="comment">// Unmap buffer if creating a CLTensor</span></div><div class="line"><a name="l00312"></a><span class="lineno"> 312</span>&#160; <span class="keywordflow">if</span>(std::is_same&lt;<span class="keyword">typename</span> std::decay&lt;T&gt;::type, <a class="code" href="classarm__compute_1_1_c_l_tensor.xhtml">arm_compute::CLTensor</a>&gt;::value)</div><div class="line"><a name="l00313"></a><span class="lineno"> 313</span>&#160; {</div><div class="line"><a name="l00314"></a><span class="lineno"> 314</span>&#160; tensor.unmap();</div><div class="line"><a name="l00315"></a><span class="lineno"> 315</span>&#160; }</div><div class="line"><a name="l00316"></a><span class="lineno"> 316</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00317"></a><span class="lineno"> 317</span>&#160; }</div><div class="line"><a name="l00318"></a><span class="lineno"> 318</span>&#160; <span class="keywordflow">catch</span>(<span class="keyword">const</span> std::ofstream::failure &amp;e)</div><div class="line"><a name="l00319"></a><span class="lineno"> 319</span>&#160; {</div><div class="line"><a name="l00320"></a><span class="lineno"> 320</span>&#160; <a class="code" href="_error_8h.xhtml#a05b19c75afe9c24200a62b9724734bbd">ARM_COMPUTE_ERROR</a>(<span class="stringliteral">&quot;Writing %s: (%s)&quot;</span>, ppm_filename.c_str(), e.what());</div><div class="line"><a name="l00321"></a><span class="lineno"> 321</span>&#160; }</div><div class="line"><a name="l00322"></a><span class="lineno"> 322</span>&#160;}</div><div class="ttc" id="_error_8h_xhtml_a05b19c75afe9c24200a62b9724734bbd"><div class="ttname"><a href="_error_8h.xhtml#a05b19c75afe9c24200a62b9724734bbd">ARM_COMPUTE_ERROR</a></div><div class="ttdeci">#define ARM_COMPUTE_ERROR(...)</div><div class="ttdoc">Print the given message then throw an std::runtime_error. </div><div class="ttdef"><b>Definition:</b> <a href="_error_8h_source.xhtml#l00031">Error.h:31</a></div></div>
371<div class="ttc" id="namespacearm__compute_xhtml_ab4e88c89b3b7ea1735996cc4def22d58a6669348b484e3008dca2bfa8e85e40b5"><div class="ttname"><a href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6669348b484e3008dca2bfa8e85e40b5">arm_compute::Format::U8</a></div><div class="ttdoc">Unknown image format. </div></div>
372<div class="ttc" id="_validate_8h_xhtml_a0d34a8aa07600727e4e5034c7cdad47d"><div class="ttname"><a href="_validate_8h.xhtml#a0d34a8aa07600727e4e5034c7cdad47d">ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN</a></div><div class="ttdeci">#define ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN(t,...)</div><div class="ttdef"><b>Definition:</b> <a href="_validate_8h_source.xhtml#l00359">Validate.h:359</a></div></div>
373<div class="ttc" id="_error_8h_xhtml_a54a6080c9f4df1f908e57a9bbb46f5da"><div class="ttname"><a href="_error_8h.xhtml#a54a6080c9f4df1f908e57a9bbb46f5da">ARM_COMPUTE_ERROR_ON</a></div><div class="ttdeci">#define ARM_COMPUTE_ERROR_ON(cond)</div><div class="ttdoc">If the condition is true then an error message is printed and an exception thrown. </div><div class="ttdef"><b>Definition:</b> <a href="_error_8h_source.xhtml#l00124">Error.h:124</a></div></div>
374<div class="ttc" id="classarm__compute_1_1_window_1_1_dimension_xhtml"><div class="ttname"><a href="classarm__compute_1_1_window_1_1_dimension.xhtml">arm_compute::Window::Dimension</a></div><div class="ttdoc">Describe one of the image&amp;#39;s dimensions with a start, end and step. </div><div class="ttdef"><b>Definition:</b> <a href="_window_8h_source.xhtml#l00068">Window.h:68</a></div></div>
375<div class="ttc" id="namespacearm__compute_xhtml_ab4e88c89b3b7ea1735996cc4def22d58a30ff380a3be74628024063a99fba10f0"><div class="ttname"><a href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a30ff380a3be74628024063a99fba10f0">arm_compute::Format::RGB888</a></div><div class="ttdoc">2 channel, 1 U8 per channel </div></div>
376<div class="ttc" id="classarm__compute_1_1_window_xhtml_aa96e81276ee4f87ab386cd05a5539a7d"><div class="ttname"><a href="classarm__compute_1_1_window.xhtml#aa96e81276ee4f87ab386cd05a5539a7d">arm_compute::Window::DimX</a></div><div class="ttdeci">static constexpr size_t DimX</div><div class="ttdoc">Alias for dimension 0 also known as X dimension. </div><div class="ttdef"><b>Definition:</b> <a href="_window_8h_source.xhtml#l00043">Window.h:43</a></div></div>
377<div class="ttc" id="namespacearm__compute_xhtml_a6c0dcc38187027dcb89cd9724bc5a823"><div class="ttname"><a href="namespacearm__compute.xhtml#a6c0dcc38187027dcb89cd9724bc5a823">arm_compute::execute_window_loop</a></div><div class="ttdeci">void execute_window_loop(const Window &amp;w, L &amp;&amp;lambda_function, Ts &amp;&amp;...iterators)</div><div class="ttdoc">Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...</div><div class="ttdef"><b>Definition:</b> <a href="_helpers_8inl_source.xhtml#l00176">Helpers.inl:176</a></div></div>
378<div class="ttc" id="classarm__compute_1_1_coordinates_xhtml"><div class="ttname"><a href="classarm__compute_1_1_coordinates.xhtml">arm_compute::Coordinates</a></div><div class="ttdoc">Coordinates of an item. </div><div class="ttdef"><b>Definition:</b> <a href="_coordinates_8h_source.xhtml#l00037">Coordinates.h:37</a></div></div>
379<div class="ttc" id="classarm__compute_1_1_window_xhtml_acd3d2bba51cb84d34dd7656ad2375a6e"><div class="ttname"><a href="classarm__compute_1_1_window.xhtml#acd3d2bba51cb84d34dd7656ad2375a6e">arm_compute::Window::set</a></div><div class="ttdeci">void set(size_t dimension, const Dimension &amp;dim)</div><div class="ttdoc">Set the values of a given dimension. </div><div class="ttdef"><b>Definition:</b> <a href="_window_8inl_source.xhtml#l00040">Window.inl:40</a></div></div>
380<div class="ttc" id="classarm__compute_1_1_window_xhtml_ad2d402364fa822b0b7775081291eeca9"><div class="ttname"><a href="classarm__compute_1_1_window.xhtml#ad2d402364fa822b0b7775081291eeca9">arm_compute::Window::DimY</a></div><div class="ttdeci">static constexpr size_t DimY</div><div class="ttdoc">Alias for dimension 1 also known as Y dimension. </div><div class="ttdef"><b>Definition:</b> <a href="_window_8h_source.xhtml#l00045">Window.h:45</a></div></div>
381<div class="ttc" id="classarm__compute_1_1_iterator_xhtml"><div class="ttname"><a href="classarm__compute_1_1_iterator.xhtml">arm_compute::Iterator</a></div><div class="ttdoc">Iterator updated by execute_window_loop for each window element. </div><div class="ttdef"><b>Definition:</b> <a href="arm__compute_2core_2_helpers_8h_source.xhtml#l00251">Helpers.h:251</a></div></div>
382<div class="ttc" id="classarm__compute_1_1_window_xhtml"><div class="ttname"><a href="classarm__compute_1_1_window.xhtml">arm_compute::Window</a></div><div class="ttdoc">Describe a multidimensional execution window. </div><div class="ttdef"><b>Definition:</b> <a href="_window_8h_source.xhtml#l00039">Window.h:39</a></div></div>
383<div class="ttc" id="classarm__compute_1_1_c_l_tensor_xhtml"><div class="ttname"><a href="classarm__compute_1_1_c_l_tensor.xhtml">arm_compute::CLTensor</a></div><div class="ttdoc">Basic implementation of the OpenCL tensor interface. </div><div class="ttdef"><b>Definition:</b> <a href="_c_l_tensor_8h_source.xhtml#l00039">CLTensor.h:39</a></div></div>
384</div><!-- fragment -->
385</div>
386</div>
387</div><!-- contents -->
388</div><!-- doc-content -->
389<!-- start footer part -->
390<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
391 <ul>
392 <li class="navelem"><a class="el" href="namespacearm__compute.xhtml">arm_compute</a></li><li class="navelem"><a class="el" href="namespacearm__compute_1_1utils.xhtml">utils</a></li>
393 <li class="footer">Generated on Fri Jun 23 2017 15:44:36 for Compute Library by
394 <a href="http://www.doxygen.org/index.html">
395 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
396 </ul>
397</div>
398</body>
399</html>