1 <!-- 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">
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.6"/>
8 <meta name="robots" content="NOINDEX, NOFOLLOW" /> <!-- Prevent indexing by search engines -->
9 <title>Compute Library: PPMLoader Class 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="navtree.js"></script>
16 <script type="text/javascript">
17 $(document).ready(initResizable);
18 $(window).load(resizeHeight);
20 <link href="search/search.css" rel="stylesheet" type="text/css"/>
21 <script type="text/javascript" src="search/search.js"></script>
22 <script type="text/javascript">
23 $(document).ready(function() { searchBox.OnSelectItem(0); });
25 <script type="text/x-mathjax-config">
27 extensions: ["tex2jax.js"],
28 jax: ["input/TeX","output/HTML-CSS"],
30 </script><script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
31 <link href="doxygen.css" rel="stylesheet" type="text/css" />
34 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
36 <table cellspacing="0" cellpadding="0">
38 <tr style="height: 56px;">
39 <td style="padding-left: 0.5em;">
40 <div id="projectname">Compute Library
41  <span id="projectnumber">17.09</span>
48 <!-- end header part -->
49 <!-- Generated by Doxygen 1.8.6 -->
50 <script type="text/javascript">
51 var searchBox = new SearchBox("searchBox", "search",false,'Search');
53 <div id="navrow1" class="tabs">
55 <li><a href="index.xhtml"><span>Main Page</span></a></li>
56 <li><a href="pages.xhtml"><span>Related Pages</span></a></li>
57 <li><a href="namespaces.xhtml"><span>Namespaces</span></a></li>
58 <li class="current"><a href="annotated.xhtml"><span>Data Structures</span></a></li>
59 <li><a href="files.xhtml"><span>Files</span></a></li>
61 <div id="MSearchBox" class="MSearchBoxInactive">
63 <img id="MSearchSelect" src="search/mag_sel.png"
64 onmouseover="return searchBox.OnSearchSelectShow()"
65 onmouseout="return searchBox.OnSearchSelectHide()"
67 <input type="text" id="MSearchField" value="Search" accesskey="S"
68 onfocus="searchBox.OnSearchFieldFocus(true)"
69 onblur="searchBox.OnSearchFieldFocus(false)"
70 onkeyup="searchBox.OnSearchFieldChange(event)"/>
71 </span><span class="right">
72 <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
78 <div id="navrow2" class="tabs2">
80 <li><a href="annotated.xhtml"><span>Data Structures</span></a></li>
81 <li><a href="classes.xhtml"><span>Data Structure Index</span></a></li>
82 <li><a href="inherits.xhtml"><span>Class Hierarchy</span></a></li>
83 <li><a href="functions.xhtml"><span>Data Fields</span></a></li>
87 <div id="side-nav" class="ui-resizable side-nav-resizable">
89 <div id="nav-tree-contents">
90 <div id="nav-sync" class="sync"></div>
93 <div id="splitbar" style="-moz-user-select:none;"
94 class="ui-resizable-handle">
97 <script type="text/javascript">
98 $(document).ready(function(){initNavTree('classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml','');});
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 <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark"> </span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(11)"><span class="SelectionMark"> </span>Pages</a></div>
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">
116 <div class="summary">
117 <a href="#pub-methods">Public Member Functions</a> </div>
118 <div class="headertitle">
119 <div class="title">PPMLoader Class Reference</div> </div>
121 <div class="contents">
123 <p>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>.
124 <a href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml#details">More...</a></p>
126 <p><code>#include <<a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>></code></p>
127 <table class="memberdecls">
128 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
129 Public Member Functions</h2></td></tr>
130 <tr class="memitem:a49afa04c8a5fd9ead48e07440b37294c"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml#a49afa04c8a5fd9ead48e07440b37294c">PPMLoader</a> ()</td></tr>
131 <tr class="separator:a49afa04c8a5fd9ead48e07440b37294c"><td class="memSeparator" colspan="2"> </td></tr>
132 <tr class="memitem:a36e58f3e64f3851ebac7a9556b4704ed"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml#a36e58f3e64f3851ebac7a9556b4704ed">open</a> (const std::string &ppm_filename)</td></tr>
133 <tr class="memdesc:a36e58f3e64f3851ebac7a9556b4704ed"><td class="mdescLeft"> </td><td class="mdescRight">Open a PPM file and reads its metadata (Width, height) <a href="#a36e58f3e64f3851ebac7a9556b4704ed">More...</a><br/></td></tr>
134 <tr class="separator:a36e58f3e64f3851ebac7a9556b4704ed"><td class="memSeparator" colspan="2"> </td></tr>
135 <tr class="memitem:a2f57f54d8c03b615bb31eee091d8a88a"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml#a2f57f54d8c03b615bb31eee091d8a88a">is_open</a> ()</td></tr>
136 <tr class="memdesc:a2f57f54d8c03b615bb31eee091d8a88a"><td class="mdescLeft"> </td><td class="mdescRight">Return true if a PPM file is currently open. <a href="#a2f57f54d8c03b615bb31eee091d8a88a">More...</a><br/></td></tr>
137 <tr class="separator:a2f57f54d8c03b615bb31eee091d8a88a"><td class="memSeparator" colspan="2"> </td></tr>
138 <tr class="memitem:a69f2a0e263d4f77d1e166de9cd2746f7"><td class="memTemplParams" colspan="2">template<typename T > </td></tr>
139 <tr class="memitem:a69f2a0e263d4f77d1e166de9cd2746f7"><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml#a69f2a0e263d4f77d1e166de9cd2746f7">init_image</a> (T &image, <a class="el" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58">arm_compute::Format</a> format)</td></tr>
140 <tr class="memdesc:a69f2a0e263d4f77d1e166de9cd2746f7"><td class="mdescLeft"> </td><td class="mdescRight">Initialise an image's metadata with the dimensions of the PPM file currently open. <a href="#a69f2a0e263d4f77d1e166de9cd2746f7">More...</a><br/></td></tr>
141 <tr class="separator:a69f2a0e263d4f77d1e166de9cd2746f7"><td class="memSeparator" colspan="2"> </td></tr>
142 <tr class="memitem:a1672610b872bef30d0dc2333a0ffc402"><td class="memTemplParams" colspan="2">template<typename T > </td></tr>
143 <tr class="memitem:a1672610b872bef30d0dc2333a0ffc402"><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml#a1672610b872bef30d0dc2333a0ffc402">fill_image</a> (T &image)</td></tr>
144 <tr class="memdesc:a1672610b872bef30d0dc2333a0ffc402"><td class="mdescLeft"> </td><td class="mdescRight">Fill an image with the content of the currently open PPM file. <a href="#a1672610b872bef30d0dc2333a0ffc402">More...</a><br/></td></tr>
145 <tr class="separator:a1672610b872bef30d0dc2333a0ffc402"><td class="memSeparator" colspan="2"> </td></tr>
147 <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
148 <div class="textblock"><p>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>. </p>
150 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00128">128</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
151 </div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
152 <a class="anchor" id="a49afa04c8a5fd9ead48e07440b37294c"></a>
153 <div class="memitem">
154 <div class="memproto">
155 <table class="mlabels">
157 <td class="mlabels-left">
158 <table class="memname">
160 <td class="memname"><a class="el" href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml">PPMLoader</a> </td>
162 <td class="paramname"></td><td>)</td>
167 <td class="mlabels-right">
168 <span class="mlabels"><span class="mlabel">inline</span></span> </td>
171 </div><div class="memdoc">
173 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00131">131</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
174 <div class="fragment"><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  : _fs(), _width(0), _height(0)</div>
175 <div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  {</div>
176 <div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  }</div>
177 </div><!-- fragment -->
180 <h2 class="groupheader">Member Function Documentation</h2>
181 <a class="anchor" id="a1672610b872bef30d0dc2333a0ffc402"></a>
182 <div class="memitem">
183 <div class="memproto">
184 <table class="mlabels">
186 <td class="mlabels-left">
187 <table class="memname">
189 <td class="memname">void fill_image </td>
191 <td class="paramtype">T & </td>
192 <td class="paramname"><em>image</em></td><td>)</td>
197 <td class="mlabels-right">
198 <span class="mlabels"><span class="mlabel">inline</span></span> </td>
201 </div><div class="memdoc">
203 <p>Fill an image with the content of the currently open PPM file. </p>
204 <dl class="section note"><dt>Note</dt><dd>If the image is a CLImage, the function maps and unmaps the image</dd></dl>
205 <dl class="params"><dt>Parameters</dt><dd>
206 <table class="params">
207 <tr><td class="paramdir">[in,out]</td><td class="paramname">image</td><td><a class="el" href="struct_image.xhtml" title="Structure to hold Image information. ">Image</a> to fill (Must be allocated, and of matching dimensions with the opened PPM). </td></tr>
212 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00187">187</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
214 <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#l00375">ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN</a>, <a class="el" href="_error_8h_source.xhtml#l00115">ARM_COMPUTE_ERROR_ON_MSG</a>, <a class="el" href="_error_8h_source.xhtml#l00049">ARM_COMPUTE_UNUSED</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#l00127">arm_compute::execute_window_loop()</a>, <a class="el" href="utils_2_utils_8h_source.xhtml#l00159">PPMLoader::is_open()</a>, <a class="el" href="utils_2_utils_8h_source.xhtml#l00089">arm_compute::utils::map()</a>, <a class="el" href="_helpers_8inl_source.xhtml#l00183">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>, <a class="el" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6669348b484e3008dca2bfa8e85e40b5">arm_compute::U8</a>, and <a class="el" href="utils_2_utils_8h_source.xhtml#l00100">arm_compute::utils::unmap()</a>.</p>
216 <p>Referenced by <a class="el" href="cl__convolution_8cpp_source.xhtml#l00056">main_cl_convolution()</a>, <a class="el" href="cl__events_8cpp_source.xhtml#l00036">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#l00042">main_neoncl_scale_median_gaussian()</a>.</p>
217 <div class="fragment"><div class="line"><a name="l00188"></a><span class="lineno"> 188</span>  {</div>
218 <div class="line"><a name="l00189"></a><span class="lineno"> 189</span>  <a class="code" href="_error_8h.xhtml#a54a6080c9f4df1f908e57a9bbb46f5da">ARM_COMPUTE_ERROR_ON</a>(!<a class="code" href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml#a2f57f54d8c03b615bb31eee091d8a88a">is_open</a>());</div>
219 <div class="line"><a name="l00190"></a><span class="lineno"> 190</span>  <a class="code" href="_error_8h.xhtml#a54a6080c9f4df1f908e57a9bbb46f5da">ARM_COMPUTE_ERROR_ON</a>(image.info()->dimension(0) != _width || image.info()->dimension(1) != _height);</div>
220 <div class="line"><a name="l00191"></a><span class="lineno"> 191</span>  <a class="code" href="_validate_8h.xhtml#a0d34a8aa07600727e4e5034c7cdad47d">ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN</a>(&image, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6669348b484e3008dca2bfa8e85e40b5">arm_compute::Format::U8</a>, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a30ff380a3be74628024063a99fba10f0">arm_compute::Format::RGB888</a>);</div>
221 <div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  <span class="keywordflow">try</span></div>
222 <div class="line"><a name="l00193"></a><span class="lineno"> 193</span>  {</div>
223 <div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  <span class="comment">// Map buffer if creating a CLTensor</span></div>
224 <div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  <a class="code" href="namespacearm__compute_1_1utils.xhtml#a9c3303817ba653b5d1e78efb88d02bcf">map</a>(image, <span class="keyword">true</span>);</div>
225 <div class="line"><a name="l00196"></a><span class="lineno"> 196</span> </div>
226 <div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  <span class="comment">// Check if the file is large enough to fill the image</span></div>
227 <div class="line"><a name="l00198"></a><span class="lineno"> 198</span>  <span class="keyword">const</span> <span class="keywordtype">size_t</span> current_position = _fs.tellg();</div>
228 <div class="line"><a name="l00199"></a><span class="lineno"> 199</span>  _fs.seekg(0, std::ios_base::end);</div>
229 <div class="line"><a name="l00200"></a><span class="lineno"> 200</span>  <span class="keyword">const</span> <span class="keywordtype">size_t</span> end_position = _fs.tellg();</div>
230 <div class="line"><a name="l00201"></a><span class="lineno"> 201</span>  _fs.seekg(current_position, std::ios_base::beg);</div>
231 <div class="line"><a name="l00202"></a><span class="lineno"> 202</span> </div>
232 <div class="line"><a name="l00203"></a><span class="lineno"> 203</span>  <a class="code" href="_error_8h.xhtml#a5bbdcf574d3f5e412fa6a1117911e67b">ARM_COMPUTE_ERROR_ON_MSG</a>((end_position - current_position) < image.info()->tensor_shape().total_size() * image.info()->element_size(),</div>
233 <div class="line"><a name="l00204"></a><span class="lineno"> 204</span>  <span class="stringliteral">"Not enough data in file"</span>);</div>
234 <div class="line"><a name="l00205"></a><span class="lineno"> 205</span>  <a class="code" href="_error_8h.xhtml#a4103adbb45806b2f2002d44b91d0d206">ARM_COMPUTE_UNUSED</a>(end_position);</div>
235 <div class="line"><a name="l00206"></a><span class="lineno"> 206</span> </div>
236 <div class="line"><a name="l00207"></a><span class="lineno"> 207</span>  <span class="keywordflow">switch</span>(image.info()->format())</div>
237 <div class="line"><a name="l00208"></a><span class="lineno"> 208</span>  {</div>
238 <div class="line"><a name="l00209"></a><span class="lineno"> 209</span>  <span class="keywordflow">case</span> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6669348b484e3008dca2bfa8e85e40b5">arm_compute::Format::U8</a>:</div>
239 <div class="line"><a name="l00210"></a><span class="lineno"> 210</span>  {</div>
240 <div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  <span class="comment">// We need to convert the data from RGB to grayscale:</span></div>
241 <div class="line"><a name="l00212"></a><span class="lineno"> 212</span>  <span class="comment">// Iterate through every pixel of the image</span></div>
242 <div class="line"><a name="l00213"></a><span class="lineno"> 213</span>  <a class="code" href="classarm__compute_1_1_window.xhtml">arm_compute::Window</a> window;</div>
243 <div class="line"><a name="l00214"></a><span class="lineno"> 214</span>  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>
244 <div class="line"><a name="l00215"></a><span class="lineno"> 215</span>  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>
245 <div class="line"><a name="l00216"></a><span class="lineno"> 216</span> </div>
246 <div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  <a class="code" href="classarm__compute_1_1_iterator.xhtml">arm_compute::Iterator</a> out(&image, window);</div>
247 <div class="line"><a name="l00218"></a><span class="lineno"> 218</span> </div>
248 <div class="line"><a name="l00219"></a><span class="lineno"> 219</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> red = 0;</div>
249 <div class="line"><a name="l00220"></a><span class="lineno"> 220</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> green = 0;</div>
250 <div class="line"><a name="l00221"></a><span class="lineno"> 221</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> blue = 0;</div>
251 <div class="line"><a name="l00222"></a><span class="lineno"> 222</span> </div>
252 <div class="line"><a name="l00223"></a><span class="lineno"> 223</span>  <a class="code" href="namespacearm__compute.xhtml#a6c0dcc38187027dcb89cd9724bc5a823">arm_compute::execute_window_loop</a>(window, [&](<span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_coordinates.xhtml">arm_compute::Coordinates</a> & <span class="keywordtype">id</span>)</div>
253 <div class="line"><a name="l00224"></a><span class="lineno"> 224</span>  {</div>
254 <div class="line"><a name="l00225"></a><span class="lineno"> 225</span>  red = _fs.get();</div>
255 <div class="line"><a name="l00226"></a><span class="lineno"> 226</span>  green = _fs.get();</div>
256 <div class="line"><a name="l00227"></a><span class="lineno"> 227</span>  blue = _fs.get();</div>
257 <div class="line"><a name="l00228"></a><span class="lineno"> 228</span> </div>
258 <div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  *out.ptr() = 0.2126f * red + 0.7152f * green + 0.0722f * blue;</div>
259 <div class="line"><a name="l00230"></a><span class="lineno"> 230</span>  },</div>
260 <div class="line"><a name="l00231"></a><span class="lineno"> 231</span>  out);</div>
261 <div class="line"><a name="l00232"></a><span class="lineno"> 232</span> </div>
262 <div class="line"><a name="l00233"></a><span class="lineno"> 233</span>  <span class="keywordflow">break</span>;</div>
263 <div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  }</div>
264 <div class="line"><a name="l00235"></a><span class="lineno"> 235</span>  <span class="keywordflow">case</span> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a30ff380a3be74628024063a99fba10f0">arm_compute::Format::RGB888</a>:</div>
265 <div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  {</div>
266 <div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  <span class="comment">// There is no format conversion needed: we can simply copy the content of the input file to the image one row at the time.</span></div>
267 <div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  <span class="comment">// Create a vertical window to iterate through the image's rows:</span></div>
268 <div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  <a class="code" href="classarm__compute_1_1_window.xhtml">arm_compute::Window</a> window;</div>
269 <div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  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>
270 <div class="line"><a name="l00241"></a><span class="lineno"> 241</span> </div>
271 <div class="line"><a name="l00242"></a><span class="lineno"> 242</span>  <a class="code" href="classarm__compute_1_1_iterator.xhtml">arm_compute::Iterator</a> out(&image, window);</div>
272 <div class="line"><a name="l00243"></a><span class="lineno"> 243</span> </div>
273 <div class="line"><a name="l00244"></a><span class="lineno"> 244</span>  <a class="code" href="namespacearm__compute.xhtml#a6c0dcc38187027dcb89cd9724bc5a823">arm_compute::execute_window_loop</a>(window, [&](<span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_coordinates.xhtml">arm_compute::Coordinates</a> & <span class="keywordtype">id</span>)</div>
274 <div class="line"><a name="l00245"></a><span class="lineno"> 245</span>  {</div>
275 <div class="line"><a name="l00246"></a><span class="lineno"> 246</span>  <span class="comment">// Copy one row from the input file to the current row of the image:</span></div>
276 <div class="line"><a name="l00247"></a><span class="lineno"> 247</span>  _fs.read(reinterpret_cast<std::fstream::char_type *>(out.ptr()), _width * image.info()->element_size());</div>
277 <div class="line"><a name="l00248"></a><span class="lineno"> 248</span>  },</div>
278 <div class="line"><a name="l00249"></a><span class="lineno"> 249</span>  out);</div>
279 <div class="line"><a name="l00250"></a><span class="lineno"> 250</span> </div>
280 <div class="line"><a name="l00251"></a><span class="lineno"> 251</span>  <span class="keywordflow">break</span>;</div>
281 <div class="line"><a name="l00252"></a><span class="lineno"> 252</span>  }</div>
282 <div class="line"><a name="l00253"></a><span class="lineno"> 253</span>  <span class="keywordflow">default</span>:</div>
283 <div class="line"><a name="l00254"></a><span class="lineno"> 254</span>  <a class="code" href="_error_8h.xhtml#a05b19c75afe9c24200a62b9724734bbd">ARM_COMPUTE_ERROR</a>(<span class="stringliteral">"Unsupported format"</span>);</div>
284 <div class="line"><a name="l00255"></a><span class="lineno"> 255</span>  }</div>
285 <div class="line"><a name="l00256"></a><span class="lineno"> 256</span> </div>
286 <div class="line"><a name="l00257"></a><span class="lineno"> 257</span>  <span class="comment">// Unmap buffer if creating a CLTensor</span></div>
287 <div class="line"><a name="l00258"></a><span class="lineno"> 258</span>  <a class="code" href="namespacearm__compute_1_1utils.xhtml#a4ff2134cb88cb5a27120cddb98b59774">unmap</a>(image);</div>
288 <div class="line"><a name="l00259"></a><span class="lineno"> 259</span>  }</div>
289 <div class="line"><a name="l00260"></a><span class="lineno"> 260</span>  <span class="keywordflow">catch</span>(<span class="keyword">const</span> std::ifstream::failure &e)</div>
290 <div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  {</div>
291 <div class="line"><a name="l00262"></a><span class="lineno"> 262</span>  <a class="code" href="_error_8h.xhtml#a05b19c75afe9c24200a62b9724734bbd">ARM_COMPUTE_ERROR</a>(<span class="stringliteral">"Loading PPM file: %s"</span>, e.what());</div>
292 <div class="line"><a name="l00263"></a><span class="lineno"> 263</span>  }</div>
293 <div class="line"><a name="l00264"></a><span class="lineno"> 264</span>  }</div>
294 <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>
295 <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>
296 <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#l00375">Validate.h:375</a></div></div>
297 <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>
298 <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>
299 <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'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>
300 <div class="ttc" id="namespacearm__compute_1_1utils_xhtml_a4ff2134cb88cb5a27120cddb98b59774"><div class="ttname"><a href="namespacearm__compute_1_1utils.xhtml#a4ff2134cb88cb5a27120cddb98b59774">arm_compute::utils::unmap</a></div><div class="ttdeci">void unmap(T &tensor)</div><div class="ttdoc">Unmaps a tensor if needed. </div><div class="ttdef"><b>Definition:</b> <a href="utils_2_utils_8h_source.xhtml#l00100">Utils.h:100</a></div></div>
301 <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>
302 <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>
303 <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 &w, L &&lambda_function, Ts &&...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#l00127">Helpers.inl:127</a></div></div>
304 <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>
305 <div class="ttc" id="classarm__compute_1_1utils_1_1_p_p_m_loader_xhtml_a2f57f54d8c03b615bb31eee091d8a88a"><div class="ttname"><a href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml#a2f57f54d8c03b615bb31eee091d8a88a">arm_compute::utils::PPMLoader::is_open</a></div><div class="ttdeci">bool is_open()</div><div class="ttdoc">Return true if a PPM file is currently open. </div><div class="ttdef"><b>Definition:</b> <a href="utils_2_utils_8h_source.xhtml#l00159">Utils.h:159</a></div></div>
306 <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 &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>
307 <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>
308 <div class="ttc" id="namespacearm__compute_1_1utils_xhtml_a9c3303817ba653b5d1e78efb88d02bcf"><div class="ttname"><a href="namespacearm__compute_1_1utils.xhtml#a9c3303817ba653b5d1e78efb88d02bcf">arm_compute::utils::map</a></div><div class="ttdeci">void map(T &tensor, bool blocking)</div><div class="ttdoc">Maps a tensor if needed. </div><div class="ttdef"><b>Definition:</b> <a href="utils_2_utils_8h_source.xhtml#l00089">Utils.h:89</a></div></div>
309 <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#l00259">Helpers.h:259</a></div></div>
310 <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>
311 <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>
312 </div><!-- fragment -->
315 <a class="anchor" id="a69f2a0e263d4f77d1e166de9cd2746f7"></a>
316 <div class="memitem">
317 <div class="memproto">
318 <table class="mlabels">
320 <td class="mlabels-left">
321 <table class="memname">
323 <td class="memname">void init_image </td>
325 <td class="paramtype">T & </td>
326 <td class="paramname"><em>image</em>, </td>
329 <td class="paramkey"></td>
331 <td class="paramtype"><a class="el" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58">arm_compute::Format</a> </td>
332 <td class="paramname"><em>format</em> </td>
341 <td class="mlabels-right">
342 <span class="mlabels"><span class="mlabel">inline</span></span> </td>
345 </div><div class="memdoc">
347 <p>Initialise an image's metadata with the dimensions of the PPM file currently open. </p>
348 <dl class="params"><dt>Parameters</dt><dd>
349 <table class="params">
350 <tr><td class="paramdir">[out]</td><td class="paramname">image</td><td><a class="el" href="struct_image.xhtml" title="Structure to hold Image information. ">Image</a> to initialise </td></tr>
351 <tr><td class="paramdir">[in]</td><td class="paramname">format</td><td>Format to use for the image (Must be RGB888 or U8) </td></tr>
356 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00170">170</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
358 <p>References <a class="el" href="_error_8h_source.xhtml#l00124">ARM_COMPUTE_ERROR_ON</a>, <a class="el" href="utils_2_utils_8h_source.xhtml#l00159">PPMLoader::is_open()</a>, <a class="el" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a30ff380a3be74628024063a99fba10f0">arm_compute::RGB888</a>, and <a class="el" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6669348b484e3008dca2bfa8e85e40b5">arm_compute::U8</a>.</p>
360 <p>Referenced by <a class="el" href="cl__convolution_8cpp_source.xhtml#l00056">main_cl_convolution()</a>, <a class="el" href="cl__events_8cpp_source.xhtml#l00036">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#l00042">main_neoncl_scale_median_gaussian()</a>.</p>
361 <div class="fragment"><div class="line"><a name="l00171"></a><span class="lineno"> 171</span>  {</div>
362 <div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  <a class="code" href="_error_8h.xhtml#a54a6080c9f4df1f908e57a9bbb46f5da">ARM_COMPUTE_ERROR_ON</a>(!<a class="code" href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml#a2f57f54d8c03b615bb31eee091d8a88a">is_open</a>());</div>
363 <div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  <a class="code" href="_error_8h.xhtml#a54a6080c9f4df1f908e57a9bbb46f5da">ARM_COMPUTE_ERROR_ON</a>(format != <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a30ff380a3be74628024063a99fba10f0">arm_compute::Format::RGB888</a> && format != <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6669348b484e3008dca2bfa8e85e40b5">arm_compute::Format::U8</a>);</div>
364 <div class="line"><a name="l00174"></a><span class="lineno"> 174</span> </div>
365 <div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  <span class="comment">// Use the size of the input PPM image</span></div>
366 <div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  <a class="code" href="classarm__compute_1_1_tensor_info.xhtml">arm_compute::TensorInfo</a> image_info(_width, _height, format);</div>
367 <div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  image.allocator()->init(image_info);</div>
368 <div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  }</div>
369 <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>
370 <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>
371 <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>
372 <div class="ttc" id="classarm__compute_1_1utils_1_1_p_p_m_loader_xhtml_a2f57f54d8c03b615bb31eee091d8a88a"><div class="ttname"><a href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml#a2f57f54d8c03b615bb31eee091d8a88a">arm_compute::utils::PPMLoader::is_open</a></div><div class="ttdeci">bool is_open()</div><div class="ttdoc">Return true if a PPM file is currently open. </div><div class="ttdef"><b>Definition:</b> <a href="utils_2_utils_8h_source.xhtml#l00159">Utils.h:159</a></div></div>
373 <div class="ttc" id="classarm__compute_1_1_tensor_info_xhtml"><div class="ttname"><a href="classarm__compute_1_1_tensor_info.xhtml">arm_compute::TensorInfo</a></div><div class="ttdoc">Store the tensor's metadata. </div><div class="ttdef"><b>Definition:</b> <a href="_tensor_info_8h_source.xhtml#l00042">TensorInfo.h:42</a></div></div>
374 </div><!-- fragment -->
377 <a class="anchor" id="a2f57f54d8c03b615bb31eee091d8a88a"></a>
378 <div class="memitem">
379 <div class="memproto">
380 <table class="mlabels">
382 <td class="mlabels-left">
383 <table class="memname">
385 <td class="memname">bool is_open </td>
387 <td class="paramname"></td><td>)</td>
392 <td class="mlabels-right">
393 <span class="mlabels"><span class="mlabel">inline</span></span> </td>
396 </div><div class="memdoc">
398 <p>Return true if a PPM file is currently open. </p>
400 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00159">159</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
402 <p>Referenced by <a class="el" href="utils_2_utils_8h_source.xhtml#l00187">PPMLoader::fill_image()</a>, <a class="el" href="utils_2_utils_8h_source.xhtml#l00170">PPMLoader::init_image()</a>, <a class="el" href="cl__convolution_8cpp_source.xhtml#l00056">main_cl_convolution()</a>, <a class="el" href="cl__events_8cpp_source.xhtml#l00036">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>, <a class="el" href="neoncl__scale__median__gaussian_8cpp_source.xhtml#l00042">main_neoncl_scale_median_gaussian()</a>, and <a class="el" href="utils_2_utils_8h_source.xhtml#l00139">PPMLoader::open()</a>.</p>
403 <div class="fragment"><div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  {</div>
404 <div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  <span class="keywordflow">return</span> _fs.is_open();</div>
405 <div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  }</div>
406 </div><!-- fragment -->
409 <a class="anchor" id="a36e58f3e64f3851ebac7a9556b4704ed"></a>
410 <div class="memitem">
411 <div class="memproto">
412 <table class="mlabels">
414 <td class="mlabels-left">
415 <table class="memname">
417 <td class="memname">void open </td>
419 <td class="paramtype">const std::string & </td>
420 <td class="paramname"><em>ppm_filename</em></td><td>)</td>
425 <td class="mlabels-right">
426 <span class="mlabels"><span class="mlabel">inline</span></span> </td>
429 </div><div class="memdoc">
431 <p>Open a PPM file and reads its metadata (Width, height) </p>
432 <dl class="params"><dt>Parameters</dt><dd>
433 <table class="params">
434 <tr><td class="paramdir">[in]</td><td class="paramname">ppm_filename</td><td>File to open </td></tr>
439 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00139">139</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
441 <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="_error_8h_source.xhtml#l00115">ARM_COMPUTE_ERROR_ON_MSG</a>, <a class="el" href="utils_2_utils_8h_source.xhtml#l00159">PPMLoader::is_open()</a>, and <a class="el" href="utils_2_utils_8cpp_source.xhtml#l00140">arm_compute::utils::parse_ppm_header()</a>.</p>
443 <p>Referenced by <a class="el" href="cl__convolution_8cpp_source.xhtml#l00056">main_cl_convolution()</a>, <a class="el" href="cl__events_8cpp_source.xhtml#l00036">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#l00042">main_neoncl_scale_median_gaussian()</a>.</p>
444 <div class="fragment"><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  {</div>
445 <div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  <a class="code" href="_error_8h.xhtml#a54a6080c9f4df1f908e57a9bbb46f5da">ARM_COMPUTE_ERROR_ON</a>(<a class="code" href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml#a2f57f54d8c03b615bb31eee091d8a88a">is_open</a>());</div>
446 <div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  <span class="keywordflow">try</span></div>
447 <div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  {</div>
448 <div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  _fs.exceptions(std::ifstream::failbit | std::ifstream::badbit);</div>
449 <div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  _fs.open(ppm_filename, std::ios::in | std::ios::binary);</div>
450 <div class="line"><a name="l00146"></a><span class="lineno"> 146</span> </div>
451 <div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> max_val = 0;</div>
452 <div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  std::tie(_width, _height, max_val) = <a class="code" href="namespacearm__compute_1_1utils.xhtml#a3aa8f5f1b94f88fdf5b43a53e29379cf">parse_ppm_header</a>(_fs);</div>
453 <div class="line"><a name="l00149"></a><span class="lineno"> 149</span> </div>
454 <div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  <a class="code" href="_error_8h.xhtml#a5bbdcf574d3f5e412fa6a1117911e67b">ARM_COMPUTE_ERROR_ON_MSG</a>(max_val >= 256, <span class="stringliteral">"2 bytes per colour channel not supported in file %s"</span>, ppm_filename.c_str());</div>
455 <div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  }</div>
456 <div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  <span class="keywordflow">catch</span>(<span class="keyword">const</span> std::ifstream::failure &e)</div>
457 <div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  {</div>
458 <div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  <a class="code" href="_error_8h.xhtml#a05b19c75afe9c24200a62b9724734bbd">ARM_COMPUTE_ERROR</a>(<span class="stringliteral">"Accessing %s: %s"</span>, ppm_filename.c_str(), e.what());</div>
459 <div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  }</div>
460 <div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  }</div>
461 <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>
462 <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>
463 <div class="ttc" id="classarm__compute_1_1utils_1_1_p_p_m_loader_xhtml_a2f57f54d8c03b615bb31eee091d8a88a"><div class="ttname"><a href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml#a2f57f54d8c03b615bb31eee091d8a88a">arm_compute::utils::PPMLoader::is_open</a></div><div class="ttdeci">bool is_open()</div><div class="ttdoc">Return true if a PPM file is currently open. </div><div class="ttdef"><b>Definition:</b> <a href="utils_2_utils_8h_source.xhtml#l00159">Utils.h:159</a></div></div>
464 <div class="ttc" id="namespacearm__compute_1_1utils_xhtml_a3aa8f5f1b94f88fdf5b43a53e29379cf"><div class="ttname"><a href="namespacearm__compute_1_1utils.xhtml#a3aa8f5f1b94f88fdf5b43a53e29379cf">arm_compute::utils::parse_ppm_header</a></div><div class="ttdeci">std::tuple< unsigned int, unsigned int, int > parse_ppm_header(std::ifstream &fs)</div><div class="ttdoc">Parse the ppm header from an input file stream. </div><div class="ttdef"><b>Definition:</b> <a href="utils_2_utils_8cpp_source.xhtml#l00140">Utils.cpp:140</a></div></div>
465 <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>
466 </div><!-- fragment -->
469 <hr/>The documentation for this class was generated from the following file:<ul>
470 <li>utils/<a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a></li>
472 </div><!-- contents -->
473 </div><!-- doc-content -->
474 <!-- start footer part -->
475 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
477 <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><li class="navelem"><a class="el" href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml">PPMLoader</a></li>
478 <li class="footer">Generated on Thu Sep 28 2017 14:38:00 for Compute Library by
479 <a href="http://www.doxygen.org/index.html">
480 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li>