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.11"/>
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="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);
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(); });
27 <script type="text/x-mathjax-config">
29 extensions: ["tex2jax.js"],
30 jax: ["input/TeX","output/HTML-CSS"],
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" />
36 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
38 <table cellspacing="0" cellpadding="0">
40 <tr style="height: 56px;">
41 <td style="padding-left: 0.5em;">
42 <div id="projectname">Compute Library
43  <span id="projectnumber">17.12</span>
50 <!-- end header part -->
51 <!-- Generated by Doxygen 1.8.11 -->
52 <script type="text/javascript">
53 var searchBox = new SearchBox("searchBox", "search",false,'Search');
55 <div id="navrow1" class="tabs">
57 <li><a href="index.xhtml"><span>Main Page</span></a></li>
58 <li><a href="pages.xhtml"><span>Related Pages</span></a></li>
59 <li><a href="namespaces.xhtml"><span>Namespaces</span></a></li>
60 <li class="current"><a href="annotated.xhtml"><span>Data Structures</span></a></li>
61 <li><a href="files.xhtml"><span>Files</span></a></li>
63 <div id="MSearchBox" class="MSearchBoxInactive">
65 <img id="MSearchSelect" src="search/mag_sel.png"
66 onmouseover="return searchBox.OnSearchSelectShow()"
67 onmouseout="return searchBox.OnSearchSelectHide()"
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>
80 <div id="navrow2" class="tabs2">
82 <li><a href="annotated.xhtml"><span>Data Structures</span></a></li>
83 <li><a href="classes.xhtml"><span>Data Structure Index</span></a></li>
84 <li><a href="inherits.xhtml"><span>Class Hierarchy</span></a></li>
85 <li><a href="functions.xhtml"><span>Data Fields</span></a></li>
89 <div id="side-nav" class="ui-resizable side-nav-resizable">
91 <div id="nav-tree-contents">
92 <div id="nav-sync" class="sync"></div>
95 <div id="splitbar" style="-moz-user-select:none;"
96 class="ui-resizable-handle">
99 <script type="text/javascript">
100 $(document).ready(function(){initNavTree('classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml','');});
102 <div id="doc-content">
103 <!-- window showing the filter options -->
104 <div id="MSearchSelectWindow"
105 onmouseover="return searchBox.OnSearchSelectShow()"
106 onmouseout="return searchBox.OnSearchSelectHide()"
107 onkeydown="return searchBox.OnSearchSelectKey(event)">
110 <!-- iframe showing the search results (closed by default) -->
111 <div id="MSearchResultsWindow">
112 <iframe src="javascript:void(0)" frameborder="0"
113 name="MSearchResults" id="MSearchResults">
118 <div class="summary">
119 <a href="#pub-methods">Public Member Functions</a> </div>
120 <div class="headertitle">
121 <div class="title">PPMLoader Class Reference</div> </div>
123 <div class="contents">
125 <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>.
126 <a href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml#details">More...</a></p>
128 <p><code>#include <<a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>></code></p>
129 <table class="memberdecls">
130 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
131 Public Member Functions</h2></td></tr>
132 <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>
133 <tr class="separator:a49afa04c8a5fd9ead48e07440b37294c"><td class="memSeparator" colspan="2"> </td></tr>
134 <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>
135 <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>
136 <tr class="separator:a36e58f3e64f3851ebac7a9556b4704ed"><td class="memSeparator" colspan="2"> </td></tr>
137 <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>
138 <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>
139 <tr class="separator:a2f57f54d8c03b615bb31eee091d8a88a"><td class="memSeparator" colspan="2"> </td></tr>
140 <tr class="memitem:a69f2a0e263d4f77d1e166de9cd2746f7"><td class="memTemplParams" colspan="2">template<typename T > </td></tr>
141 <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>
142 <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>
143 <tr class="separator:a69f2a0e263d4f77d1e166de9cd2746f7"><td class="memSeparator" colspan="2"> </td></tr>
144 <tr class="memitem:a1672610b872bef30d0dc2333a0ffc402"><td class="memTemplParams" colspan="2">template<typename T > </td></tr>
145 <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>
146 <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>
147 <tr class="separator:a1672610b872bef30d0dc2333a0ffc402"><td class="memSeparator" colspan="2"> </td></tr>
148 <tr class="memitem:a7c3f70e1caee95bb95c62346e130e5ab"><td class="memTemplParams" colspan="2">template<typename T > </td></tr>
149 <tr class="memitem:a7c3f70e1caee95bb95c62346e130e5ab"><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#a7c3f70e1caee95bb95c62346e130e5ab">fill_planar_tensor</a> (T &tensor, bool bgr=false)</td></tr>
150 <tr class="memdesc:a7c3f70e1caee95bb95c62346e130e5ab"><td class="mdescLeft"> </td><td class="mdescRight">Fill a tensor with 3 planes (one for each channel) with the content of the currently open PPM file. <a href="#a7c3f70e1caee95bb95c62346e130e5ab">More...</a><br /></td></tr>
151 <tr class="separator:a7c3f70e1caee95bb95c62346e130e5ab"><td class="memSeparator" colspan="2"> </td></tr>
152 <tr class="memitem:a7b736ec9a05be5c498760d35a0406ed3"><td class="memItemLeft" align="right" valign="top">unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml#a7b736ec9a05be5c498760d35a0406ed3">width</a> () const </td></tr>
153 <tr class="memdesc:a7b736ec9a05be5c498760d35a0406ed3"><td class="mdescLeft"> </td><td class="mdescRight">Return the width of the currently open PPM file. <a href="#a7b736ec9a05be5c498760d35a0406ed3">More...</a><br /></td></tr>
154 <tr class="separator:a7b736ec9a05be5c498760d35a0406ed3"><td class="memSeparator" colspan="2"> </td></tr>
155 <tr class="memitem:aa420a28166e708e3f8b9ecc8e527fc09"><td class="memItemLeft" align="right" valign="top">unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml#aa420a28166e708e3f8b9ecc8e527fc09">height</a> () const </td></tr>
156 <tr class="memdesc:aa420a28166e708e3f8b9ecc8e527fc09"><td class="mdescLeft"> </td><td class="mdescRight">Return the height of the currently open PPM file. <a href="#aa420a28166e708e3f8b9ecc8e527fc09">More...</a><br /></td></tr>
157 <tr class="separator:aa420a28166e708e3f8b9ecc8e527fc09"><td class="memSeparator" colspan="2"> </td></tr>
159 <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
160 <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>
162 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00237">237</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
163 </div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
164 <a class="anchor" id="a49afa04c8a5fd9ead48e07440b37294c"></a>
165 <div class="memitem">
166 <div class="memproto">
167 <table class="mlabels">
169 <td class="mlabels-left">
170 <table class="memname">
172 <td class="memname"><a class="el" href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml">PPMLoader</a> </td>
174 <td class="paramname"></td><td>)</td>
179 <td class="mlabels-right">
180 <span class="mlabels"><span class="mlabel">inline</span></span> </td>
183 </div><div class="memdoc">
185 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00240">240</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
186 <div class="fragment"><div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  : _fs(), _width(0), _height(0)</div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span>  {</div><div class="line"><a name="l00243"></a><span class="lineno"> 243</span>  }</div></div><!-- fragment -->
189 <h2 class="groupheader">Member Function Documentation</h2>
190 <a class="anchor" id="a1672610b872bef30d0dc2333a0ffc402"></a>
191 <div class="memitem">
192 <div class="memproto">
193 <table class="mlabels">
195 <td class="mlabels-left">
196 <table class="memname">
198 <td class="memname">void fill_image </td>
200 <td class="paramtype">T & </td>
201 <td class="paramname"><em>image</em></td><td>)</td>
206 <td class="mlabels-right">
207 <span class="mlabels"><span class="mlabel">inline</span></span> </td>
210 </div><div class="memdoc">
212 <p>Fill an image with the content of the currently open PPM file. </p>
213 <dl class="section note"><dt>Note</dt><dd>If the image is a CLImage, the function maps and unmaps the image</dd></dl>
214 <dl class="params"><dt>Parameters</dt><dd>
215 <table class="params">
216 <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>
221 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00296">296</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
223 <p>References <a class="el" href="core_2_error_8h_source.xhtml#l00238">ARM_COMPUTE_ERROR</a>, <a class="el" href="core_2_error_8h_source.xhtml#l00306">ARM_COMPUTE_ERROR_ON</a>, <a class="el" href="_validate_8h_source.xhtml#l00574">ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN</a>, <a class="el" href="core_2_error_8h_source.xhtml#l00297">ARM_COMPUTE_ERROR_ON_MSG</a>, <a class="el" href="core_2_error_8h_source.xhtml#l00147">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#l00268">PPMLoader::is_open()</a>, <a class="el" href="utils_2_utils_8h_source.xhtml#l00158">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#l00169">arm_compute::utils::unmap()</a>.</p>
225 <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="gc__absdiff_8cpp_source.xhtml#l00037">main_gc_absdiff()</a>, <a class="el" href="neon__cartoon__effect_8cpp_source.xhtml#l00033">main_neon_cartoon_effect()</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>
226 <div class="fragment"><div class="line"><a name="l00297"></a><span class="lineno"> 297</span>  {</div><div class="line"><a name="l00298"></a><span class="lineno"> 298</span>  <a class="code" href="core_2_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><div class="line"><a name="l00299"></a><span class="lineno"> 299</span>  <a class="code" href="core_2_error_8h.xhtml#a54a6080c9f4df1f908e57a9bbb46f5da">ARM_COMPUTE_ERROR_ON</a>(image.info()->dimension(0) != _width || image.info()->dimension(1) != _height);</div><div class="line"><a name="l00300"></a><span class="lineno"> 300</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><div class="line"><a name="l00301"></a><span class="lineno"> 301</span>  <span class="keywordflow">try</span></div><div class="line"><a name="l00302"></a><span class="lineno"> 302</span>  {</div><div class="line"><a name="l00303"></a><span class="lineno"> 303</span>  <span class="comment">// Map buffer if creating a CLTensor/GCTensor</span></div><div class="line"><a name="l00304"></a><span class="lineno"> 304</span>  <a class="code" href="namespacearm__compute_1_1utils.xhtml#a9c3303817ba653b5d1e78efb88d02bcf">map</a>(image, <span class="keyword">true</span>);</div><div class="line"><a name="l00305"></a><span class="lineno"> 305</span> </div><div class="line"><a name="l00306"></a><span class="lineno"> 306</span>  <span class="comment">// Check if the file is large enough to fill the image</span></div><div class="line"><a name="l00307"></a><span class="lineno"> 307</span>  <span class="keyword">const</span> <span class="keywordtype">size_t</span> current_position = _fs.tellg();</div><div class="line"><a name="l00308"></a><span class="lineno"> 308</span>  _fs.seekg(0, std::ios_base::end);</div><div class="line"><a name="l00309"></a><span class="lineno"> 309</span>  <span class="keyword">const</span> <span class="keywordtype">size_t</span> end_position = _fs.tellg();</div><div class="line"><a name="l00310"></a><span class="lineno"> 310</span>  _fs.seekg(current_position, std::ios_base::beg);</div><div class="line"><a name="l00311"></a><span class="lineno"> 311</span> </div><div class="line"><a name="l00312"></a><span class="lineno"> 312</span>  <a class="code" href="core_2_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><div class="line"><a name="l00313"></a><span class="lineno"> 313</span>  <span class="stringliteral">"Not enough data in file"</span>);</div><div class="line"><a name="l00314"></a><span class="lineno"> 314</span>  <a class="code" href="core_2_error_8h.xhtml#a4103adbb45806b2f2002d44b91d0d206">ARM_COMPUTE_UNUSED</a>(end_position);</div><div class="line"><a name="l00315"></a><span class="lineno"> 315</span> </div><div class="line"><a name="l00316"></a><span class="lineno"> 316</span>  <span class="keywordflow">switch</span>(image.info()->format())</div><div class="line"><a name="l00317"></a><span class="lineno"> 317</span>  {</div><div class="line"><a name="l00318"></a><span class="lineno"> 318</span>  <span class="keywordflow">case</span> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6669348b484e3008dca2bfa8e85e40b5">arm_compute::Format::U8</a>:</div><div class="line"><a name="l00319"></a><span class="lineno"> 319</span>  {</div><div class="line"><a name="l00320"></a><span class="lineno"> 320</span>  <span class="comment">// We need to convert the data from RGB to grayscale:</span></div><div class="line"><a name="l00321"></a><span class="lineno"> 321</span>  <span class="comment">// Iterate through every pixel of the image</span></div><div class="line"><a name="l00322"></a><span class="lineno"> 322</span>  <a class="code" href="classarm__compute_1_1_window.xhtml">arm_compute::Window</a> window;</div><div class="line"><a name="l00323"></a><span class="lineno"> 323</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><div class="line"><a name="l00324"></a><span class="lineno"> 324</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><div class="line"><a name="l00325"></a><span class="lineno"> 325</span> </div><div class="line"><a name="l00326"></a><span class="lineno"> 326</span>  <a class="code" href="classarm__compute_1_1_iterator.xhtml">arm_compute::Iterator</a> out(&image, window);</div><div class="line"><a name="l00327"></a><span class="lineno"> 327</span> </div><div class="line"><a name="l00328"></a><span class="lineno"> 328</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> red = 0;</div><div class="line"><a name="l00329"></a><span class="lineno"> 329</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> green = 0;</div><div class="line"><a name="l00330"></a><span class="lineno"> 330</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> blue = 0;</div><div class="line"><a name="l00331"></a><span class="lineno"> 331</span> </div><div class="line"><a name="l00332"></a><span class="lineno"> 332</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><div class="line"><a name="l00333"></a><span class="lineno"> 333</span>  {</div><div class="line"><a name="l00334"></a><span class="lineno"> 334</span>  red = _fs.get();</div><div class="line"><a name="l00335"></a><span class="lineno"> 335</span>  green = _fs.get();</div><div class="line"><a name="l00336"></a><span class="lineno"> 336</span>  blue = _fs.get();</div><div class="line"><a name="l00337"></a><span class="lineno"> 337</span> </div><div class="line"><a name="l00338"></a><span class="lineno"> 338</span>  *out.ptr() = 0.2126f * red + 0.7152f * green + 0.0722f * blue;</div><div class="line"><a name="l00339"></a><span class="lineno"> 339</span>  },</div><div class="line"><a name="l00340"></a><span class="lineno"> 340</span>  out);</div><div class="line"><a name="l00341"></a><span class="lineno"> 341</span> </div><div class="line"><a name="l00342"></a><span class="lineno"> 342</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00343"></a><span class="lineno"> 343</span>  }</div><div class="line"><a name="l00344"></a><span class="lineno"> 344</span>  <span class="keywordflow">case</span> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a30ff380a3be74628024063a99fba10f0">arm_compute::Format::RGB888</a>:</div><div class="line"><a name="l00345"></a><span class="lineno"> 345</span>  {</div><div class="line"><a name="l00346"></a><span class="lineno"> 346</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><div class="line"><a name="l00347"></a><span class="lineno"> 347</span>  <span class="comment">// Create a vertical window to iterate through the image's rows:</span></div><div class="line"><a name="l00348"></a><span class="lineno"> 348</span>  <a class="code" href="classarm__compute_1_1_window.xhtml">arm_compute::Window</a> window;</div><div class="line"><a name="l00349"></a><span class="lineno"> 349</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><div class="line"><a name="l00350"></a><span class="lineno"> 350</span> </div><div class="line"><a name="l00351"></a><span class="lineno"> 351</span>  <a class="code" href="classarm__compute_1_1_iterator.xhtml">arm_compute::Iterator</a> out(&image, window);</div><div class="line"><a name="l00352"></a><span class="lineno"> 352</span> </div><div class="line"><a name="l00353"></a><span class="lineno"> 353</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><div class="line"><a name="l00354"></a><span class="lineno"> 354</span>  {</div><div class="line"><a name="l00355"></a><span class="lineno"> 355</span>  <span class="comment">// Copy one row from the input file to the current row of the image:</span></div><div class="line"><a name="l00356"></a><span class="lineno"> 356</span>  _fs.read(reinterpret_cast<std::fstream::char_type *>(out.ptr()), _width * image.info()->element_size());</div><div class="line"><a name="l00357"></a><span class="lineno"> 357</span>  },</div><div class="line"><a name="l00358"></a><span class="lineno"> 358</span>  out);</div><div class="line"><a name="l00359"></a><span class="lineno"> 359</span> </div><div class="line"><a name="l00360"></a><span class="lineno"> 360</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00361"></a><span class="lineno"> 361</span>  }</div><div class="line"><a name="l00362"></a><span class="lineno"> 362</span>  <span class="keywordflow">default</span>:</div><div class="line"><a name="l00363"></a><span class="lineno"> 363</span>  <a class="code" href="core_2_error_8h.xhtml#a05b19c75afe9c24200a62b9724734bbd">ARM_COMPUTE_ERROR</a>(<span class="stringliteral">"Unsupported format"</span>);</div><div class="line"><a name="l00364"></a><span class="lineno"> 364</span>  }</div><div class="line"><a name="l00365"></a><span class="lineno"> 365</span> </div><div class="line"><a name="l00366"></a><span class="lineno"> 366</span>  <span class="comment">// Unmap buffer if creating a CLTensor/GCTensor</span></div><div class="line"><a name="l00367"></a><span class="lineno"> 367</span>  <a class="code" href="namespacearm__compute_1_1utils.xhtml#a4ff2134cb88cb5a27120cddb98b59774">unmap</a>(image);</div><div class="line"><a name="l00368"></a><span class="lineno"> 368</span>  }</div><div class="line"><a name="l00369"></a><span class="lineno"> 369</span>  <span class="keywordflow">catch</span>(<span class="keyword">const</span> std::ifstream::failure &e)</div><div class="line"><a name="l00370"></a><span class="lineno"> 370</span>  {</div><div class="line"><a name="l00371"></a><span class="lineno"> 371</span>  <a class="code" href="core_2_error_8h.xhtml#a05b19c75afe9c24200a62b9724734bbd">ARM_COMPUTE_ERROR</a>(<span class="stringliteral">"Loading PPM file: %s"</span>, e.what());</div><div class="line"><a name="l00372"></a><span class="lineno"> 372</span>  }</div><div class="line"><a name="l00373"></a><span class="lineno"> 373</span>  }</div><div class="ttc" id="core_2_error_8h_xhtml_a54a6080c9f4df1f908e57a9bbb46f5da"><div class="ttname"><a href="core_2_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="core_2_error_8h_source.xhtml#l00306">Error.h:306</a></div></div>
227 <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">1 channel, 1 U8 per channel </div></div>
228 <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#l00574">Validate.h:574</a></div></div>
229 <div class="ttc" id="core_2_error_8h_xhtml_a05b19c75afe9c24200a62b9724734bbd"><div class="ttname"><a href="core_2_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="core_2_error_8h_source.xhtml#l00238">Error.h:238</a></div></div>
230 <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&#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>
231 <div class="ttc" id="core_2_error_8h_xhtml_a4103adbb45806b2f2002d44b91d0d206"><div class="ttname"><a href="core_2_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="core_2_error_8h_source.xhtml#l00147">Error.h:147</a></div></div>
232 <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#l00169">Utils.h:169</a></div></div>
233 <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">3 channels, 1 U8 per channel </div></div>
234 <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>
235 <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>
236 <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>
237 <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#l00268">Utils.h:268</a></div></div>
238 <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>
239 <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>
240 <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#l00158">Utils.h:158</a></div></div>
241 <div class="ttc" id="core_2_error_8h_xhtml_a5bbdcf574d3f5e412fa6a1117911e67b"><div class="ttname"><a href="core_2_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="core_2_error_8h_source.xhtml#l00297">Error.h:297</a></div></div>
242 <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#l00323">Helpers.h:323</a></div></div>
243 <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>
244 </div><!-- fragment -->
247 <a class="anchor" id="a7c3f70e1caee95bb95c62346e130e5ab"></a>
248 <div class="memitem">
249 <div class="memproto">
250 <table class="mlabels">
252 <td class="mlabels-left">
253 <table class="memname">
255 <td class="memname">void fill_planar_tensor </td>
257 <td class="paramtype">T & </td>
258 <td class="paramname"><em>tensor</em>, </td>
261 <td class="paramkey"></td>
263 <td class="paramtype">bool </td>
264 <td class="paramname"><em>bgr</em> = <code>false</code> </td>
273 <td class="mlabels-right">
274 <span class="mlabels"><span class="mlabel">inline</span></span> </td>
277 </div><div class="memdoc">
279 <p>Fill a tensor with 3 planes (one for each channel) with the content of the currently open PPM file. </p>
280 <dl class="section note"><dt>Note</dt><dd>If the image is a CLImage, the function maps and unmaps the image</dd></dl>
281 <dl class="params"><dt>Parameters</dt><dd>
282 <table class="params">
283 <tr><td class="paramdir">[in,out]</td><td class="paramname">tensor</td><td><a class="el" href="classarm__compute_1_1_tensor.xhtml" title="Basic implementation of the tensor interface. ">Tensor</a> with 3 planes to fill (Must be allocated, and of matching dimensions with the opened PPM). Data types supported: U8/F32 </td></tr>
284 <tr><td class="paramdir">[in]</td><td class="paramname">bgr</td><td>(Optional) Fill the first plane with blue channel (default = false) </td></tr>
289 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00383">383</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
291 <p>References <a class="el" href="core_2_error_8h_source.xhtml#l00238">ARM_COMPUTE_ERROR</a>, <a class="el" href="core_2_error_8h_source.xhtml#l00306">ARM_COMPUTE_ERROR_ON</a>, <a class="el" href="_validate_8h_source.xhtml#l00669">ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN</a>, <a class="el" href="core_2_error_8h_source.xhtml#l00297">ARM_COMPUTE_ERROR_ON_MSG</a>, <a class="el" href="core_2_error_8h_source.xhtml#l00147">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="_window_8h_source.xhtml#l00047">Window::DimZ</a>, <a class="el" href="_helpers_8inl_source.xhtml#l00127">arm_compute::execute_window_loop()</a>, <a class="el" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a44ad4ef5a76e6aa6fb3e3fa079a54fda">arm_compute::F32</a>, <a class="el" href="utils_2_utils_8h_source.xhtml#l00268">PPMLoader::is_open()</a>, <a class="el" href="utils_2_utils_8h_source.xhtml#l00158">arm_compute::utils::map()</a>, <a class="el" href="_helpers_8inl_source.xhtml#l00183">Iterator::ptr()</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#l00169">arm_compute::utils::unmap()</a>.</p>
293 <p>Referenced by <a class="el" href="_graph_utils_8cpp_source.xhtml#l00088">PPMAccessor::access_tensor()</a>.</p>
294 <div class="fragment"><div class="line"><a name="l00384"></a><span class="lineno"> 384</span>  {</div><div class="line"><a name="l00385"></a><span class="lineno"> 385</span>  <a class="code" href="core_2_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><div class="line"><a name="l00386"></a><span class="lineno"> 386</span>  <a class="code" href="_validate_8h.xhtml#aadf5c9cff86327b96d88d04649d9715e">ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN</a>(&tensor, 1, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6669348b484e3008dca2bfa8e85e40b5">DataType::U8</a>, <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a44ad4ef5a76e6aa6fb3e3fa079a54fda">DataType::F32</a>);</div><div class="line"><a name="l00387"></a><span class="lineno"> 387</span>  <a class="code" href="core_2_error_8h.xhtml#a54a6080c9f4df1f908e57a9bbb46f5da">ARM_COMPUTE_ERROR_ON</a>(tensor.info()->dimension(0) != _width || tensor.info()->dimension(1) != _height || tensor.info()->dimension(2) != 3);</div><div class="line"><a name="l00388"></a><span class="lineno"> 388</span> </div><div class="line"><a name="l00389"></a><span class="lineno"> 389</span>  <span class="keywordflow">try</span></div><div class="line"><a name="l00390"></a><span class="lineno"> 390</span>  {</div><div class="line"><a name="l00391"></a><span class="lineno"> 391</span>  <span class="comment">// Map buffer if creating a CLTensor</span></div><div class="line"><a name="l00392"></a><span class="lineno"> 392</span>  <a class="code" href="namespacearm__compute_1_1utils.xhtml#a9c3303817ba653b5d1e78efb88d02bcf">map</a>(tensor, <span class="keyword">true</span>);</div><div class="line"><a name="l00393"></a><span class="lineno"> 393</span> </div><div class="line"><a name="l00394"></a><span class="lineno"> 394</span>  <span class="comment">// Check if the file is large enough to fill the image</span></div><div class="line"><a name="l00395"></a><span class="lineno"> 395</span>  <span class="keyword">const</span> <span class="keywordtype">size_t</span> current_position = _fs.tellg();</div><div class="line"><a name="l00396"></a><span class="lineno"> 396</span>  _fs.seekg(0, std::ios_base::end);</div><div class="line"><a name="l00397"></a><span class="lineno"> 397</span>  <span class="keyword">const</span> <span class="keywordtype">size_t</span> end_position = _fs.tellg();</div><div class="line"><a name="l00398"></a><span class="lineno"> 398</span>  _fs.seekg(current_position, std::ios_base::beg);</div><div class="line"><a name="l00399"></a><span class="lineno"> 399</span> </div><div class="line"><a name="l00400"></a><span class="lineno"> 400</span>  <a class="code" href="core_2_error_8h.xhtml#a5bbdcf574d3f5e412fa6a1117911e67b">ARM_COMPUTE_ERROR_ON_MSG</a>((end_position - current_position) < tensor.info()->tensor_shape().total_size(),</div><div class="line"><a name="l00401"></a><span class="lineno"> 401</span>  <span class="stringliteral">"Not enough data in file"</span>);</div><div class="line"><a name="l00402"></a><span class="lineno"> 402</span>  <a class="code" href="core_2_error_8h.xhtml#a4103adbb45806b2f2002d44b91d0d206">ARM_COMPUTE_UNUSED</a>(end_position);</div><div class="line"><a name="l00403"></a><span class="lineno"> 403</span> </div><div class="line"><a name="l00404"></a><span class="lineno"> 404</span>  <span class="comment">// Iterate through every pixel of the image</span></div><div class="line"><a name="l00405"></a><span class="lineno"> 405</span>  <a class="code" href="classarm__compute_1_1_window.xhtml">arm_compute::Window</a> window;</div><div class="line"><a name="l00406"></a><span class="lineno"> 406</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><div class="line"><a name="l00407"></a><span class="lineno"> 407</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><div class="line"><a name="l00408"></a><span class="lineno"> 408</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#a893d17b56b9abc4423ce26e9a24ac5dc">arm_compute::Window::DimZ</a>, <a class="code" href="classarm__compute_1_1_window_1_1_dimension.xhtml">arm_compute::Window::Dimension</a>(0, 1, 1));</div><div class="line"><a name="l00409"></a><span class="lineno"> 409</span> </div><div class="line"><a name="l00410"></a><span class="lineno"> 410</span>  <a class="code" href="classarm__compute_1_1_iterator.xhtml">arm_compute::Iterator</a> out(&tensor, window);</div><div class="line"><a name="l00411"></a><span class="lineno"> 411</span> </div><div class="line"><a name="l00412"></a><span class="lineno"> 412</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> red = 0;</div><div class="line"><a name="l00413"></a><span class="lineno"> 413</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> green = 0;</div><div class="line"><a name="l00414"></a><span class="lineno"> 414</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> blue = 0;</div><div class="line"><a name="l00415"></a><span class="lineno"> 415</span> </div><div class="line"><a name="l00416"></a><span class="lineno"> 416</span>  <span class="keywordtype">size_t</span> stride_z = tensor.info()->strides_in_bytes()[2];</div><div class="line"><a name="l00417"></a><span class="lineno"> 417</span> </div><div class="line"><a name="l00418"></a><span class="lineno"> 418</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><div class="line"><a name="l00419"></a><span class="lineno"> 419</span>  {</div><div class="line"><a name="l00420"></a><span class="lineno"> 420</span>  red = _fs.get();</div><div class="line"><a name="l00421"></a><span class="lineno"> 421</span>  green = _fs.get();</div><div class="line"><a name="l00422"></a><span class="lineno"> 422</span>  blue = _fs.get();</div><div class="line"><a name="l00423"></a><span class="lineno"> 423</span> </div><div class="line"><a name="l00424"></a><span class="lineno"> 424</span>  <span class="keywordflow">switch</span>(tensor.info()->data_type())</div><div class="line"><a name="l00425"></a><span class="lineno"> 425</span>  {</div><div class="line"><a name="l00426"></a><span class="lineno"> 426</span>  <span class="keywordflow">case</span> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6669348b484e3008dca2bfa8e85e40b5">arm_compute::DataType::U8</a>:</div><div class="line"><a name="l00427"></a><span class="lineno"> 427</span>  {</div><div class="line"><a name="l00428"></a><span class="lineno"> 428</span>  *(out.ptr() + 0 * stride_z) = bgr ? blue : red;</div><div class="line"><a name="l00429"></a><span class="lineno"> 429</span>  *(out.ptr() + 1 * stride_z) = green;</div><div class="line"><a name="l00430"></a><span class="lineno"> 430</span>  *(out.ptr() + 2 * stride_z) = bgr ? red : blue;</div><div class="line"><a name="l00431"></a><span class="lineno"> 431</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00432"></a><span class="lineno"> 432</span>  }</div><div class="line"><a name="l00433"></a><span class="lineno"> 433</span>  <span class="keywordflow">case</span> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a44ad4ef5a76e6aa6fb3e3fa079a54fda">arm_compute::DataType::F32</a>:</div><div class="line"><a name="l00434"></a><span class="lineno"> 434</span>  {</div><div class="line"><a name="l00435"></a><span class="lineno"> 435</span>  *<span class="keyword">reinterpret_cast<</span><span class="keywordtype">float</span> *<span class="keyword">></span>(out.ptr() + 0 * stride_z) = static_cast<float>(bgr ? blue : red);</div><div class="line"><a name="l00436"></a><span class="lineno"> 436</span>  *<span class="keyword">reinterpret_cast<</span><span class="keywordtype">float</span> *<span class="keyword">></span>(out.ptr() + 1 * stride_z) = static_cast<float>(green);</div><div class="line"><a name="l00437"></a><span class="lineno"> 437</span>  *<span class="keyword">reinterpret_cast<</span><span class="keywordtype">float</span> *<span class="keyword">></span>(out.ptr() + 2 * stride_z) = static_cast<float>(bgr ? red : blue);</div><div class="line"><a name="l00438"></a><span class="lineno"> 438</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00439"></a><span class="lineno"> 439</span>  }</div><div class="line"><a name="l00440"></a><span class="lineno"> 440</span>  <span class="keywordflow">default</span>:</div><div class="line"><a name="l00441"></a><span class="lineno"> 441</span>  {</div><div class="line"><a name="l00442"></a><span class="lineno"> 442</span>  <a class="code" href="core_2_error_8h.xhtml#a05b19c75afe9c24200a62b9724734bbd">ARM_COMPUTE_ERROR</a>(<span class="stringliteral">"Unsupported data type"</span>);</div><div class="line"><a name="l00443"></a><span class="lineno"> 443</span>  }</div><div class="line"><a name="l00444"></a><span class="lineno"> 444</span>  }</div><div class="line"><a name="l00445"></a><span class="lineno"> 445</span>  },</div><div class="line"><a name="l00446"></a><span class="lineno"> 446</span>  out);</div><div class="line"><a name="l00447"></a><span class="lineno"> 447</span> </div><div class="line"><a name="l00448"></a><span class="lineno"> 448</span>  <span class="comment">// Unmap buffer if creating a CLTensor</span></div><div class="line"><a name="l00449"></a><span class="lineno"> 449</span>  <a class="code" href="namespacearm__compute_1_1utils.xhtml#a4ff2134cb88cb5a27120cddb98b59774">unmap</a>(tensor);</div><div class="line"><a name="l00450"></a><span class="lineno"> 450</span>  }</div><div class="line"><a name="l00451"></a><span class="lineno"> 451</span>  <span class="keywordflow">catch</span>(<span class="keyword">const</span> std::ifstream::failure &e)</div><div class="line"><a name="l00452"></a><span class="lineno"> 452</span>  {</div><div class="line"><a name="l00453"></a><span class="lineno"> 453</span>  <a class="code" href="core_2_error_8h.xhtml#a05b19c75afe9c24200a62b9724734bbd">ARM_COMPUTE_ERROR</a>(<span class="stringliteral">"Loading PPM file: %s"</span>, e.what());</div><div class="line"><a name="l00454"></a><span class="lineno"> 454</span>  }</div><div class="line"><a name="l00455"></a><span class="lineno"> 455</span>  }</div><div class="ttc" id="core_2_error_8h_xhtml_a54a6080c9f4df1f908e57a9bbb46f5da"><div class="ttname"><a href="core_2_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="core_2_error_8h_source.xhtml#l00306">Error.h:306</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">1 channel, 1 U8 per channel </div></div>
296 <div class="ttc" id="core_2_error_8h_xhtml_a05b19c75afe9c24200a62b9724734bbd"><div class="ttname"><a href="core_2_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="core_2_error_8h_source.xhtml#l00238">Error.h:238</a></div></div>
297 <div class="ttc" id="namespacearm__compute_xhtml_ab4e88c89b3b7ea1735996cc4def22d58a44ad4ef5a76e6aa6fb3e3fa079a54fda"><div class="ttname"><a href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a44ad4ef5a76e6aa6fb3e3fa079a54fda">arm_compute::Format::F32</a></div><div class="ttdoc">1 channel, 1 F32 per channel </div></div>
298 <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&#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>
299 <div class="ttc" id="core_2_error_8h_xhtml_a4103adbb45806b2f2002d44b91d0d206"><div class="ttname"><a href="core_2_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="core_2_error_8h_source.xhtml#l00147">Error.h:147</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#l00169">Utils.h:169</a></div></div>
301 <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>
302 <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>
303 <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>
304 <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#l00268">Utils.h:268</a></div></div>
305 <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>
306 <div class="ttc" id="_validate_8h_xhtml_aadf5c9cff86327b96d88d04649d9715e"><div class="ttname"><a href="_validate_8h.xhtml#aadf5c9cff86327b96d88d04649d9715e">ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN</a></div><div class="ttdeci">#define ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)</div><div class="ttdef"><b>Definition:</b> <a href="_validate_8h_source.xhtml#l00669">Validate.h:669</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#l00158">Utils.h:158</a></div></div>
309 <div class="ttc" id="classarm__compute_1_1_window_xhtml_a893d17b56b9abc4423ce26e9a24ac5dc"><div class="ttname"><a href="classarm__compute_1_1_window.xhtml#a893d17b56b9abc4423ce26e9a24ac5dc">arm_compute::Window::DimZ</a></div><div class="ttdeci">static constexpr size_t DimZ</div><div class="ttdoc">Alias for dimension 2 also known as Z dimension. </div><div class="ttdef"><b>Definition:</b> <a href="_window_8h_source.xhtml#l00047">Window.h:47</a></div></div>
310 <div class="ttc" id="core_2_error_8h_xhtml_a5bbdcf574d3f5e412fa6a1117911e67b"><div class="ttname"><a href="core_2_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="core_2_error_8h_source.xhtml#l00297">Error.h:297</a></div></div>
311 <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#l00323">Helpers.h:323</a></div></div>
312 <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>
313 </div><!-- fragment -->
316 <a class="anchor" id="aa420a28166e708e3f8b9ecc8e527fc09"></a>
317 <div class="memitem">
318 <div class="memproto">
319 <table class="mlabels">
321 <td class="mlabels-left">
322 <table class="memname">
324 <td class="memname">unsigned int height </td>
326 <td class="paramname"></td><td>)</td>
331 <td class="mlabels-right">
332 <span class="mlabels"><span class="mlabel">inline</span></span> </td>
335 </div><div class="memdoc">
337 <p>Return the height of the currently open PPM file. </p>
339 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00466">466</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
341 <p>Referenced by <a class="el" href="_graph_utils_8cpp_source.xhtml#l00088">PPMAccessor::access_tensor()</a>, <a class="el" href="utils_2_utils_8h_source.xhtml#l00720">arm_compute::utils::save_to_npy()</a>, and <a class="el" href="utils_2_utils_8h_source.xhtml#l00639">arm_compute::utils::save_to_ppm()</a>.</p>
342 <div class="fragment"><div class="line"><a name="l00467"></a><span class="lineno"> 467</span>  {</div><div class="line"><a name="l00468"></a><span class="lineno"> 468</span>  <span class="keywordflow">return</span> _height;</div><div class="line"><a name="l00469"></a><span class="lineno"> 469</span>  }</div></div><!-- fragment -->
345 <a class="anchor" id="a69f2a0e263d4f77d1e166de9cd2746f7"></a>
346 <div class="memitem">
347 <div class="memproto">
348 <table class="mlabels">
350 <td class="mlabels-left">
351 <table class="memname">
353 <td class="memname">void init_image </td>
355 <td class="paramtype">T & </td>
356 <td class="paramname"><em>image</em>, </td>
359 <td class="paramkey"></td>
361 <td class="paramtype"><a class="el" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58">arm_compute::Format</a> </td>
362 <td class="paramname"><em>format</em> </td>
371 <td class="mlabels-right">
372 <span class="mlabels"><span class="mlabel">inline</span></span> </td>
375 </div><div class="memdoc">
377 <p>Initialise an image's metadata with the dimensions of the PPM file currently open. </p>
378 <dl class="params"><dt>Parameters</dt><dd>
379 <table class="params">
380 <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>
381 <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>
386 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00279">279</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
388 <p>References <a class="el" href="core_2_error_8h_source.xhtml#l00306">ARM_COMPUTE_ERROR_ON</a>, <a class="el" href="utils_2_utils_8h_source.xhtml#l00268">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>
390 <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="gc__absdiff_8cpp_source.xhtml#l00037">main_gc_absdiff()</a>, <a class="el" href="neon__cartoon__effect_8cpp_source.xhtml#l00033">main_neon_cartoon_effect()</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>
391 <div class="fragment"><div class="line"><a name="l00280"></a><span class="lineno"> 280</span>  {</div><div class="line"><a name="l00281"></a><span class="lineno"> 281</span>  <a class="code" href="core_2_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><div class="line"><a name="l00282"></a><span class="lineno"> 282</span>  <a class="code" href="core_2_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><div class="line"><a name="l00283"></a><span class="lineno"> 283</span> </div><div class="line"><a name="l00284"></a><span class="lineno"> 284</span>  <span class="comment">// Use the size of the input PPM image</span></div><div class="line"><a name="l00285"></a><span class="lineno"> 285</span>  <a class="code" href="classarm__compute_1_1_tensor_info.xhtml">arm_compute::TensorInfo</a> image_info(_width, _height, format);</div><div class="line"><a name="l00286"></a><span class="lineno"> 286</span>  image.allocator()->init(image_info);</div><div class="line"><a name="l00287"></a><span class="lineno"> 287</span>  }</div><div class="ttc" id="core_2_error_8h_xhtml_a54a6080c9f4df1f908e57a9bbb46f5da"><div class="ttname"><a href="core_2_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="core_2_error_8h_source.xhtml#l00306">Error.h:306</a></div></div>
392 <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">1 channel, 1 U8 per channel </div></div>
393 <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">3 channels, 1 U8 per channel </div></div>
394 <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#l00268">Utils.h:268</a></div></div>
395 <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&#39;s metadata. </div><div class="ttdef"><b>Definition:</b> <a href="_tensor_info_8h_source.xhtml#l00044">TensorInfo.h:44</a></div></div>
396 </div><!-- fragment -->
399 <a class="anchor" id="a2f57f54d8c03b615bb31eee091d8a88a"></a>
400 <div class="memitem">
401 <div class="memproto">
402 <table class="mlabels">
404 <td class="mlabels-left">
405 <table class="memname">
407 <td class="memname">bool is_open </td>
409 <td class="paramname"></td><td>)</td>
414 <td class="mlabels-right">
415 <span class="mlabels"><span class="mlabel">inline</span></span> </td>
418 </div><div class="memdoc">
420 <p>Return true if a PPM file is currently open. </p>
422 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00268">268</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
424 <p>Referenced by <a class="el" href="utils_2_utils_8h_source.xhtml#l00296">PPMLoader::fill_image()</a>, <a class="el" href="utils_2_utils_8h_source.xhtml#l00383">PPMLoader::fill_planar_tensor()</a>, <a class="el" href="utils_2_utils_8h_source.xhtml#l00545">NPYLoader::fill_tensor()</a>, <a class="el" href="utils_2_utils_8h_source.xhtml#l00279">PPMLoader::init_image()</a>, <a class="el" href="utils_2_utils_8h_source.xhtml#l00521">NPYLoader::init_tensor()</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="gc__absdiff_8cpp_source.xhtml#l00037">main_gc_absdiff()</a>, <a class="el" href="neon__cartoon__effect_8cpp_source.xhtml#l00033">main_neon_cartoon_effect()</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>, <a class="el" href="utils_2_utils_8h_source.xhtml#l00248">PPMLoader::open()</a>, and <a class="el" href="utils_2_utils_8h_source.xhtml#l00488">NPYLoader::open()</a>.</p>
425 <div class="fragment"><div class="line"><a name="l00269"></a><span class="lineno"> 269</span>  {</div><div class="line"><a name="l00270"></a><span class="lineno"> 270</span>  <span class="keywordflow">return</span> _fs.is_open();</div><div class="line"><a name="l00271"></a><span class="lineno"> 271</span>  }</div></div><!-- fragment -->
428 <a class="anchor" id="a36e58f3e64f3851ebac7a9556b4704ed"></a>
429 <div class="memitem">
430 <div class="memproto">
431 <table class="mlabels">
433 <td class="mlabels-left">
434 <table class="memname">
436 <td class="memname">void open </td>
438 <td class="paramtype">const std::string & </td>
439 <td class="paramname"><em>ppm_filename</em></td><td>)</td>
444 <td class="mlabels-right">
445 <span class="mlabels"><span class="mlabel">inline</span></span> </td>
448 </div><div class="memdoc">
450 <p>Open a PPM file and reads its metadata (Width, height) </p>
451 <dl class="params"><dt>Parameters</dt><dd>
452 <table class="params">
453 <tr><td class="paramdir">[in]</td><td class="paramname">ppm_filename</td><td>File to open </td></tr>
458 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00248">248</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
460 <p>References <a class="el" href="core_2_error_8h_source.xhtml#l00238">ARM_COMPUTE_ERROR</a>, <a class="el" href="core_2_error_8h_source.xhtml#l00306">ARM_COMPUTE_ERROR_ON</a>, <a class="el" href="core_2_error_8h_source.xhtml#l00297">ARM_COMPUTE_ERROR_ON_MSG</a>, <a class="el" href="utils_2_utils_8h_source.xhtml#l00268">PPMLoader::is_open()</a>, and <a class="el" href="utils_2_utils_8cpp_source.xhtml#l00140">arm_compute::utils::parse_ppm_header()</a>.</p>
462 <p>Referenced by <a class="el" href="_graph_utils_8cpp_source.xhtml#l00088">PPMAccessor::access_tensor()</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="gc__absdiff_8cpp_source.xhtml#l00037">main_gc_absdiff()</a>, <a class="el" href="neon__cartoon__effect_8cpp_source.xhtml#l00033">main_neon_cartoon_effect()</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>
463 <div class="fragment"><div class="line"><a name="l00249"></a><span class="lineno"> 249</span>  {</div><div class="line"><a name="l00250"></a><span class="lineno"> 250</span>  <a class="code" href="core_2_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><div class="line"><a name="l00251"></a><span class="lineno"> 251</span>  <span class="keywordflow">try</span></div><div class="line"><a name="l00252"></a><span class="lineno"> 252</span>  {</div><div class="line"><a name="l00253"></a><span class="lineno"> 253</span>  _fs.exceptions(std::ifstream::failbit | std::ifstream::badbit);</div><div class="line"><a name="l00254"></a><span class="lineno"> 254</span>  _fs.open(ppm_filename, std::ios::in | std::ios::binary);</div><div class="line"><a name="l00255"></a><span class="lineno"> 255</span> </div><div class="line"><a name="l00256"></a><span class="lineno"> 256</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> max_val = 0;</div><div class="line"><a name="l00257"></a><span class="lineno"> 257</span>  std::tie(_width, _height, max_val) = <a class="code" href="namespacearm__compute_1_1utils.xhtml#a3aa8f5f1b94f88fdf5b43a53e29379cf">parse_ppm_header</a>(_fs);</div><div class="line"><a name="l00258"></a><span class="lineno"> 258</span> </div><div class="line"><a name="l00259"></a><span class="lineno"> 259</span>  <a class="code" href="core_2_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><div class="line"><a name="l00260"></a><span class="lineno"> 260</span>  }</div><div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  <span class="keywordflow">catch</span>(<span class="keyword">const</span> std::ifstream::failure &e)</div><div class="line"><a name="l00262"></a><span class="lineno"> 262</span>  {</div><div class="line"><a name="l00263"></a><span class="lineno"> 263</span>  <a class="code" href="core_2_error_8h.xhtml#a05b19c75afe9c24200a62b9724734bbd">ARM_COMPUTE_ERROR</a>(<span class="stringliteral">"Accessing %s: %s"</span>, ppm_filename.c_str(), e.what());</div><div class="line"><a name="l00264"></a><span class="lineno"> 264</span>  }</div><div class="line"><a name="l00265"></a><span class="lineno"> 265</span>  }</div><div class="ttc" id="core_2_error_8h_xhtml_a54a6080c9f4df1f908e57a9bbb46f5da"><div class="ttname"><a href="core_2_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="core_2_error_8h_source.xhtml#l00306">Error.h:306</a></div></div>
464 <div class="ttc" id="core_2_error_8h_xhtml_a05b19c75afe9c24200a62b9724734bbd"><div class="ttname"><a href="core_2_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="core_2_error_8h_source.xhtml#l00238">Error.h:238</a></div></div>
465 <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#l00268">Utils.h:268</a></div></div>
466 <div class="ttc" id="core_2_error_8h_xhtml_a5bbdcf574d3f5e412fa6a1117911e67b"><div class="ttname"><a href="core_2_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="core_2_error_8h_source.xhtml#l00297">Error.h:297</a></div></div>
467 <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>
468 </div><!-- fragment -->
471 <a class="anchor" id="a7b736ec9a05be5c498760d35a0406ed3"></a>
472 <div class="memitem">
473 <div class="memproto">
474 <table class="mlabels">
476 <td class="mlabels-left">
477 <table class="memname">
479 <td class="memname">unsigned int width </td>
481 <td class="paramname"></td><td>)</td>
486 <td class="mlabels-right">
487 <span class="mlabels"><span class="mlabel">inline</span></span> </td>
490 </div><div class="memdoc">
492 <p>Return the width of the currently open PPM file. </p>
494 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00459">459</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
496 <p>Referenced by <a class="el" href="_graph_utils_8cpp_source.xhtml#l00088">PPMAccessor::access_tensor()</a>, <a class="el" href="utils_2_utils_8h_source.xhtml#l00720">arm_compute::utils::save_to_npy()</a>, and <a class="el" href="utils_2_utils_8h_source.xhtml#l00639">arm_compute::utils::save_to_ppm()</a>.</p>
497 <div class="fragment"><div class="line"><a name="l00460"></a><span class="lineno"> 460</span>  {</div><div class="line"><a name="l00461"></a><span class="lineno"> 461</span>  <span class="keywordflow">return</span> _width;</div><div class="line"><a name="l00462"></a><span class="lineno"> 462</span>  }</div></div><!-- fragment -->
500 <hr/>The documentation for this class was generated from the following file:<ul>
501 <li>utils/<a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a></li>
503 </div><!-- contents -->
504 </div><!-- doc-content -->
505 <!-- start footer part -->
506 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
508 <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>
509 <li class="footer">Generated on Thu Dec 14 2017 23:48:39 for Compute Library by
510 <a href="http://www.doxygen.org/index.html">
511 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>