arm_compute v17.06
[platform/upstream/armcl.git] / documentation / classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml
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">
4 <head>
5 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
6 <meta http-equiv="X-UA-Compatible" content="IE=9"/>
7 <meta name="generator" content="Doxygen 1.8.11"/>
8 <meta name="robots" content="NOINDEX, NOFOLLOW" /> <!-- Prevent indexing by search engines -->
9 <title>Compute Library: 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);
20 </script>
21 <link href="search/search.css" rel="stylesheet" type="text/css"/>
22 <script type="text/javascript" src="search/searchdata.js"></script>
23 <script type="text/javascript" src="search/search.js"></script>
24 <script type="text/javascript">
25   $(document).ready(function() { init_search(); });
26 </script>
27 <script type="text/x-mathjax-config">
28   MathJax.Hub.Config({
29     extensions: ["tex2jax.js"],
30     jax: ["input/TeX","output/HTML-CSS"],
31 });
32 </script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
33 <link href="doxygen.css" rel="stylesheet" type="text/css" />
34 </head>
35 <body>
36 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
37 <div id="titlearea">
38 <table cellspacing="0" cellpadding="0">
39  <tbody>
40  <tr style="height: 56px;">
41   <td style="padding-left: 0.5em;">
42    <div id="projectname">Compute Library
43    &#160;<span id="projectnumber">v17.06</span>
44    </div>
45   </td>
46  </tr>
47  </tbody>
48 </table>
49 </div>
50 <!-- end header part -->
51 <!-- Generated by Doxygen 1.8.11 -->
52 <script type="text/javascript">
53 var searchBox = new SearchBox("searchBox", "search",false,'Search');
54 </script>
55   <div id="navrow1" class="tabs">
56     <ul class="tablist">
57       <li><a href="index.xhtml"><span>Main&#160;Page</span></a></li>
58       <li><a href="pages.xhtml"><span>Related&#160;Pages</span></a></li>
59       <li><a href="namespaces.xhtml"><span>Namespaces</span></a></li>
60       <li class="current"><a href="annotated.xhtml"><span>Data&#160;Structures</span></a></li>
61       <li><a href="files.xhtml"><span>Files</span></a></li>
62       <li>
63         <div id="MSearchBox" class="MSearchBoxInactive">
64         <span class="left">
65           <img id="MSearchSelect" src="search/mag_sel.png"
66                onmouseover="return searchBox.OnSearchSelectShow()"
67                onmouseout="return searchBox.OnSearchSelectHide()"
68                alt=""/>
69           <input type="text" id="MSearchField" value="Search" accesskey="S"
70                onfocus="searchBox.OnSearchFieldFocus(true)" 
71                onblur="searchBox.OnSearchFieldFocus(false)" 
72                onkeyup="searchBox.OnSearchFieldChange(event)"/>
73           </span><span class="right">
74             <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
75           </span>
76         </div>
77       </li>
78     </ul>
79   </div>
80   <div id="navrow2" class="tabs2">
81     <ul class="tablist">
82       <li><a href="annotated.xhtml"><span>Data&#160;Structures</span></a></li>
83       <li><a href="classes.xhtml"><span>Data&#160;Structure&#160;Index</span></a></li>
84       <li><a href="inherits.xhtml"><span>Class&#160;Hierarchy</span></a></li>
85       <li><a href="functions.xhtml"><span>Data&#160;Fields</span></a></li>
86     </ul>
87   </div>
88 </div><!-- top -->
89 <div id="side-nav" class="ui-resizable side-nav-resizable">
90   <div id="nav-tree">
91     <div id="nav-tree-contents">
92       <div id="nav-sync" class="sync"></div>
93     </div>
94   </div>
95   <div id="splitbar" style="-moz-user-select:none;" 
96        class="ui-resizable-handle">
97   </div>
98 </div>
99 <script type="text/javascript">
100 $(document).ready(function(){initNavTree('classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml','');});
101 </script>
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)">
108 </div>
109
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">
114 </iframe>
115 </div>
116
117 <div class="header">
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>
122 </div><!--header-->
123 <div class="contents">
124
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>
127
128 <p><code>#include &lt;<a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>&gt;</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">&#160;</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">&#160;</td></tr>
134 <tr class="memitem:a36e58f3e64f3851ebac7a9556b4704ed"><td class="memItemLeft" align="right" valign="top">void&#160;</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 &amp;ppm_filename)</td></tr>
135 <tr class="memdesc:a36e58f3e64f3851ebac7a9556b4704ed"><td class="mdescLeft">&#160;</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">&#160;</td></tr>
137 <tr class="memitem:a2f57f54d8c03b615bb31eee091d8a88a"><td class="memItemLeft" align="right" valign="top">bool&#160;</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">&#160;</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">&#160;</td></tr>
140 <tr class="memitem:a69f2a0e263d4f77d1e166de9cd2746f7"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
141 <tr class="memitem:a69f2a0e263d4f77d1e166de9cd2746f7"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</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 &amp;image, <a class="el" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58">arm_compute::Format</a> format)</td></tr>
142 <tr class="memdesc:a69f2a0e263d4f77d1e166de9cd2746f7"><td class="mdescLeft">&#160;</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">&#160;</td></tr>
144 <tr class="memitem:a1672610b872bef30d0dc2333a0ffc402"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
145 <tr class="memitem:a1672610b872bef30d0dc2333a0ffc402"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</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 &amp;image)</td></tr>
146 <tr class="memdesc:a1672610b872bef30d0dc2333a0ffc402"><td class="mdescLeft">&#160;</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">&#160;</td></tr>
148 </table>
149 <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
150 <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>
151
152 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00083">83</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
153 </div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
154 <a class="anchor" id="a49afa04c8a5fd9ead48e07440b37294c"></a>
155 <div class="memitem">
156 <div class="memproto">
157 <table class="mlabels">
158   <tr>
159   <td class="mlabels-left">
160       <table class="memname">
161         <tr>
162           <td class="memname"><a class="el" href="classarm__compute_1_1utils_1_1_p_p_m_loader.xhtml">PPMLoader</a> </td>
163           <td>(</td>
164           <td class="paramname"></td><td>)</td>
165           <td></td>
166         </tr>
167       </table>
168   </td>
169   <td class="mlabels-right">
170 <span class="mlabels"><span class="mlabel">inline</span></span>  </td>
171   </tr>
172 </table>
173 </div><div class="memdoc">
174
175 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00086">86</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
176 <div class="fragment"><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;        : _fs(), _width(0), _height(0)</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    {</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    }</div></div><!-- fragment -->
177 </div>
178 </div>
179 <h2 class="groupheader">Member Function Documentation</h2>
180 <a class="anchor" id="a1672610b872bef30d0dc2333a0ffc402"></a>
181 <div class="memitem">
182 <div class="memproto">
183 <table class="mlabels">
184   <tr>
185   <td class="mlabels-left">
186       <table class="memname">
187         <tr>
188           <td class="memname">void fill_image </td>
189           <td>(</td>
190           <td class="paramtype">T &amp;&#160;</td>
191           <td class="paramname"><em>image</em></td><td>)</td>
192           <td></td>
193         </tr>
194       </table>
195   </td>
196   <td class="mlabels-right">
197 <span class="mlabels"><span class="mlabel">inline</span></span>  </td>
198   </tr>
199 </table>
200 </div><div class="memdoc">
201
202 <p>Fill an image with the content of the currently open PPM file. </p>
203 <dl class="section note"><dt>Note</dt><dd>If the image is a CLImage, the function maps and unmaps the image</dd></dl>
204 <dl class="params"><dt>Parameters</dt><dd>
205   <table class="params">
206     <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>
207   </table>
208   </dd>
209 </dl>
210
211 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00142">142</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
212
213 <p>References <a class="el" href="_error_8h_source.xhtml#l00031">ARM_COMPUTE_ERROR</a>, <a class="el" href="_error_8h_source.xhtml#l00124">ARM_COMPUTE_ERROR_ON</a>, <a class="el" href="_validate_8h_source.xhtml#l00359">ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN</a>, <a class="el" href="_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#l00176">arm_compute::execute_window_loop()</a>, <a class="el" href="utils_2_utils_8h_source.xhtml#l00114">PPMLoader::is_open()</a>, <a class="el" href="_helpers_8inl_source.xhtml#l00232">Iterator::ptr()</a>, <a class="el" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a30ff380a3be74628024063a99fba10f0">arm_compute::RGB888</a>, <a class="el" href="_window_8inl_source.xhtml#l00040">Window::set()</a>, and <a class="el" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6669348b484e3008dca2bfa8e85e40b5">arm_compute::U8</a>.</p>
214
215 <p>Referenced by <a class="el" href="cl__convolution_8cpp_source.xhtml#l00053">main_cl_convolution()</a>, <a class="el" href="cl__events_8cpp_source.xhtml#l00033">main_cl_events()</a>, <a class="el" href="neon__convolution_8cpp_source.xhtml#l00052">main_neon_convolution()</a>, <a class="el" href="neon__scale_8cpp_source.xhtml#l00032">main_neon_scale()</a>, and <a class="el" href="neoncl__scale__median__gaussian_8cpp_source.xhtml#l00039">main_neoncl_scale_median_gaussian()</a>.</p>
216 <div class="fragment"><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;    {</div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;        <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><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;        <a class="code" href="_error_8h.xhtml#a54a6080c9f4df1f908e57a9bbb46f5da">ARM_COMPUTE_ERROR_ON</a>(image.info()-&gt;dimension(0) != _width || image.info()-&gt;dimension(1) != _height);</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;        <a class="code" href="_validate_8h.xhtml#a0d34a8aa07600727e4e5034c7cdad47d">ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN</a>(&amp;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="l00147"></a><span class="lineno">  147</span>&#160;        <span class="keywordflow">try</span></div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;        {</div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;<span class="preprocessor">#ifdef ARM_COMPUTE_CL</span></div><div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;            <span class="comment">// Map buffer if creating a CLTensor</span></div><div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;            <span class="keywordflow">if</span>(std::is_same&lt;<span class="keyword">typename</span> std::decay&lt;T&gt;::type, <a class="code" href="classarm__compute_1_1_c_l_tensor.xhtml">arm_compute::CLImage</a>&gt;::value)</div><div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;            {</div><div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;                image.map();</div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;            }</div><div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;            <span class="comment">// Check if the file is large enough to fill the image</span></div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;            <span class="keyword">const</span> <span class="keywordtype">size_t</span> current_position = _fs.tellg();</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;            _fs.seekg(0, std::ios_base::end);</div><div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;            <span class="keyword">const</span> <span class="keywordtype">size_t</span> end_position = _fs.tellg();</div><div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;            _fs.seekg(current_position, std::ios_base::beg);</div><div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;</div><div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;            <a class="code" href="_error_8h.xhtml#a5bbdcf574d3f5e412fa6a1117911e67b">ARM_COMPUTE_ERROR_ON_MSG</a>((end_position - current_position) &lt; image.info()-&gt;tensor_shape().total_size() * image.info()-&gt;element_size(),</div><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;                                     <span class="stringliteral">&quot;Not enough data in file&quot;</span>);</div><div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;            <a class="code" href="_error_8h.xhtml#a4103adbb45806b2f2002d44b91d0d206">ARM_COMPUTE_UNUSED</a>(end_position);</div><div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;</div><div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;            <span class="keywordflow">switch</span>(image.info()-&gt;format())</div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;            {</div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;                <span class="keywordflow">case</span> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6669348b484e3008dca2bfa8e85e40b5">arm_compute::Format::U8</a>:</div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;                {</div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;                    <span class="comment">// We need to convert the data from RGB to grayscale:</span></div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;                    <span class="comment">// Iterate through every pixel of the image</span></div><div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;                    <a class="code" href="classarm__compute_1_1_window.xhtml">arm_compute::Window</a> window;</div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;                    window.<a class="code" href="classarm__compute_1_1_window.xhtml#acd3d2bba51cb84d34dd7656ad2375a6e">set</a>(<a class="code" href="classarm__compute_1_1_window.xhtml#aa96e81276ee4f87ab386cd05a5539a7d">arm_compute::Window::DimX</a>, <a class="code" href="classarm__compute_1_1_window_1_1_dimension.xhtml">arm_compute::Window::Dimension</a>(0, _width, 1));</div><div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;                    window.<a class="code" href="classarm__compute_1_1_window.xhtml#acd3d2bba51cb84d34dd7656ad2375a6e">set</a>(<a class="code" href="classarm__compute_1_1_window.xhtml#ad2d402364fa822b0b7775081291eeca9">arm_compute::Window::DimY</a>, <a class="code" href="classarm__compute_1_1_window_1_1_dimension.xhtml">arm_compute::Window::Dimension</a>(0, _height, 1));</div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;</div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;                    <a class="code" href="classarm__compute_1_1_iterator.xhtml">arm_compute::Iterator</a> out(&amp;image, window);</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;</div><div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;                    <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> red   = 0;</div><div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;                    <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> green = 0;</div><div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;                    <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> blue  = 0;</div><div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;</div><div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;                    <a class="code" href="namespacearm__compute.xhtml#a6c0dcc38187027dcb89cd9724bc5a823">arm_compute::execute_window_loop</a>(window, [&amp;](<span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_coordinates.xhtml">arm_compute::Coordinates</a> &amp; <span class="keywordtype">id</span>)</div><div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;                    {</div><div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;                        red   = _fs.get();</div><div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;                        green = _fs.get();</div><div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;                        blue  = _fs.get();</div><div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;</div><div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;                        *out.ptr() = 0.2126f * red + 0.7152f * green + 0.0722f * blue;</div><div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;                    },</div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;                    out);</div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;</div><div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;                    <span class="keywordflow">break</span>;</div><div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;                }</div><div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;                <span class="keywordflow">case</span> <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a30ff380a3be74628024063a99fba10f0">arm_compute::Format::RGB888</a>:</div><div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;                {</div><div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;                    <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="l00197"></a><span class="lineno">  197</span>&#160;                    <span class="comment">// Create a vertical window to iterate through the image&#39;s rows:</span></div><div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;                    <a class="code" href="classarm__compute_1_1_window.xhtml">arm_compute::Window</a> window;</div><div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;                    window.<a class="code" href="classarm__compute_1_1_window.xhtml#acd3d2bba51cb84d34dd7656ad2375a6e">set</a>(<a class="code" href="classarm__compute_1_1_window.xhtml#ad2d402364fa822b0b7775081291eeca9">arm_compute::Window::DimY</a>, <a class="code" href="classarm__compute_1_1_window_1_1_dimension.xhtml">arm_compute::Window::Dimension</a>(0, _height, 1));</div><div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;</div><div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;                    <a class="code" href="classarm__compute_1_1_iterator.xhtml">arm_compute::Iterator</a> out(&amp;image, window);</div><div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;</div><div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;                    <a class="code" href="namespacearm__compute.xhtml#a6c0dcc38187027dcb89cd9724bc5a823">arm_compute::execute_window_loop</a>(window, [&amp;](<span class="keyword">const</span> <a class="code" href="classarm__compute_1_1_coordinates.xhtml">arm_compute::Coordinates</a> &amp; <span class="keywordtype">id</span>)</div><div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;                    {</div><div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;                        <span class="comment">// Copy one row from the input file to the current row of the image:</span></div><div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;                        _fs.read(reinterpret_cast&lt;std::fstream::char_type *&gt;(out.ptr()), _width * image.info()-&gt;element_size());</div><div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;                    },</div><div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;                    out);</div><div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;</div><div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;                    <span class="keywordflow">break</span>;</div><div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;                }</div><div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;                <span class="keywordflow">default</span>:</div><div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;                    <a class="code" href="_error_8h.xhtml#a05b19c75afe9c24200a62b9724734bbd">ARM_COMPUTE_ERROR</a>(<span class="stringliteral">&quot;Unsupported format&quot;</span>);</div><div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;            }</div><div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;</div><div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;<span class="preprocessor">#ifdef ARM_COMPUTE_CL</span></div><div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;            <span class="comment">// Unmap buffer if creating a CLTensor</span></div><div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;            <span class="keywordflow">if</span>(std::is_same&lt;<span class="keyword">typename</span> std::decay&lt;T&gt;::type, <a class="code" href="classarm__compute_1_1_c_l_tensor.xhtml">arm_compute::CLTensor</a>&gt;::value)</div><div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;            {</div><div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;                image.unmap();</div><div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;            }</div><div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;        }</div><div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;        <span class="keywordflow">catch</span>(<span class="keyword">const</span> std::ifstream::failure &amp;e)</div><div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;        {</div><div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;            <a class="code" href="_error_8h.xhtml#a05b19c75afe9c24200a62b9724734bbd">ARM_COMPUTE_ERROR</a>(<span class="stringliteral">&quot;Loading PPM file: %s&quot;</span>, e.what());</div><div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;        }</div><div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;    }</div><div class="ttc" id="_error_8h_xhtml_a05b19c75afe9c24200a62b9724734bbd"><div class="ttname"><a href="_error_8h.xhtml#a05b19c75afe9c24200a62b9724734bbd">ARM_COMPUTE_ERROR</a></div><div class="ttdeci">#define ARM_COMPUTE_ERROR(...)</div><div class="ttdoc">Print the given message then throw an std::runtime_error. </div><div class="ttdef"><b>Definition:</b> <a href="_error_8h_source.xhtml#l00031">Error.h:31</a></div></div>
217 <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>
218 <div class="ttc" id="_validate_8h_xhtml_a0d34a8aa07600727e4e5034c7cdad47d"><div class="ttname"><a href="_validate_8h.xhtml#a0d34a8aa07600727e4e5034c7cdad47d">ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN</a></div><div class="ttdeci">#define ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN(t,...)</div><div class="ttdef"><b>Definition:</b> <a href="_validate_8h_source.xhtml#l00359">Validate.h:359</a></div></div>
219 <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>
220 <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>
221 <div class="ttc" id="classarm__compute_1_1_window_1_1_dimension_xhtml"><div class="ttname"><a href="classarm__compute_1_1_window_1_1_dimension.xhtml">arm_compute::Window::Dimension</a></div><div class="ttdoc">Describe one of the image&amp;#39;s dimensions with a start, end and step. </div><div class="ttdef"><b>Definition:</b> <a href="_window_8h_source.xhtml#l00068">Window.h:68</a></div></div>
222 <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>
223 <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>
224 <div class="ttc" id="namespacearm__compute_xhtml_a6c0dcc38187027dcb89cd9724bc5a823"><div class="ttname"><a href="namespacearm__compute.xhtml#a6c0dcc38187027dcb89cd9724bc5a823">arm_compute::execute_window_loop</a></div><div class="ttdeci">void execute_window_loop(const Window &amp;w, L &amp;&amp;lambda_function, Ts &amp;&amp;...iterators)</div><div class="ttdoc">Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...</div><div class="ttdef"><b>Definition:</b> <a href="_helpers_8inl_source.xhtml#l00176">Helpers.inl:176</a></div></div>
225 <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>
226 <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#l00114">Utils.h:114</a></div></div>
227 <div class="ttc" id="classarm__compute_1_1_window_xhtml_acd3d2bba51cb84d34dd7656ad2375a6e"><div class="ttname"><a href="classarm__compute_1_1_window.xhtml#acd3d2bba51cb84d34dd7656ad2375a6e">arm_compute::Window::set</a></div><div class="ttdeci">void set(size_t dimension, const Dimension &amp;dim)</div><div class="ttdoc">Set the values of a given dimension. </div><div class="ttdef"><b>Definition:</b> <a href="_window_8inl_source.xhtml#l00040">Window.inl:40</a></div></div>
228 <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>
229 <div class="ttc" id="classarm__compute_1_1_iterator_xhtml"><div class="ttname"><a href="classarm__compute_1_1_iterator.xhtml">arm_compute::Iterator</a></div><div class="ttdoc">Iterator updated by execute_window_loop for each window element. </div><div class="ttdef"><b>Definition:</b> <a href="arm__compute_2core_2_helpers_8h_source.xhtml#l00251">Helpers.h:251</a></div></div>
230 <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>
231 <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>
232 <div class="ttc" id="classarm__compute_1_1_c_l_tensor_xhtml"><div class="ttname"><a href="classarm__compute_1_1_c_l_tensor.xhtml">arm_compute::CLTensor</a></div><div class="ttdoc">Basic implementation of the OpenCL tensor interface. </div><div class="ttdef"><b>Definition:</b> <a href="_c_l_tensor_8h_source.xhtml#l00039">CLTensor.h:39</a></div></div>
233 </div><!-- fragment -->
234 </div>
235 </div>
236 <a class="anchor" id="a69f2a0e263d4f77d1e166de9cd2746f7"></a>
237 <div class="memitem">
238 <div class="memproto">
239 <table class="mlabels">
240   <tr>
241   <td class="mlabels-left">
242       <table class="memname">
243         <tr>
244           <td class="memname">void init_image </td>
245           <td>(</td>
246           <td class="paramtype">T &amp;&#160;</td>
247           <td class="paramname"><em>image</em>, </td>
248         </tr>
249         <tr>
250           <td class="paramkey"></td>
251           <td></td>
252           <td class="paramtype"><a class="el" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58">arm_compute::Format</a>&#160;</td>
253           <td class="paramname"><em>format</em>&#160;</td>
254         </tr>
255         <tr>
256           <td></td>
257           <td>)</td>
258           <td></td><td></td>
259         </tr>
260       </table>
261   </td>
262   <td class="mlabels-right">
263 <span class="mlabels"><span class="mlabel">inline</span></span>  </td>
264   </tr>
265 </table>
266 </div><div class="memdoc">
267
268 <p>Initialise an image's metadata with the dimensions of the PPM file currently open. </p>
269 <dl class="params"><dt>Parameters</dt><dd>
270   <table class="params">
271     <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>
272     <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>
273   </table>
274   </dd>
275 </dl>
276
277 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00125">125</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
278
279 <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#l00114">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>
280
281 <p>Referenced by <a class="el" href="cl__convolution_8cpp_source.xhtml#l00053">main_cl_convolution()</a>, <a class="el" href="cl__events_8cpp_source.xhtml#l00033">main_cl_events()</a>, <a class="el" href="neon__convolution_8cpp_source.xhtml#l00052">main_neon_convolution()</a>, <a class="el" href="neon__scale_8cpp_source.xhtml#l00032">main_neon_scale()</a>, and <a class="el" href="neoncl__scale__median__gaussian_8cpp_source.xhtml#l00039">main_neoncl_scale_median_gaussian()</a>.</p>
282 <div class="fragment"><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    {</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;        <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><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;        <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> &amp;&amp; format != <a class="code" href="namespacearm__compute.xhtml#ab4e88c89b3b7ea1735996cc4def22d58a6669348b484e3008dca2bfa8e85e40b5">arm_compute::Format::U8</a>);</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;        <span class="comment">// Use the size of the input PPM image</span></div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;        <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="l00132"></a><span class="lineno">  132</span>&#160;        image.allocator()-&gt;init(image_info);</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;    }</div><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>
283 <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>
284 <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>
285 <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#l00114">Utils.h:114</a></div></div>
286 <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&amp;#39;s metadata. </div><div class="ttdef"><b>Definition:</b> <a href="_tensor_info_8h_source.xhtml#l00042">TensorInfo.h:42</a></div></div>
287 </div><!-- fragment -->
288 </div>
289 </div>
290 <a class="anchor" id="a2f57f54d8c03b615bb31eee091d8a88a"></a>
291 <div class="memitem">
292 <div class="memproto">
293 <table class="mlabels">
294   <tr>
295   <td class="mlabels-left">
296       <table class="memname">
297         <tr>
298           <td class="memname">bool is_open </td>
299           <td>(</td>
300           <td class="paramname"></td><td>)</td>
301           <td></td>
302         </tr>
303       </table>
304   </td>
305   <td class="mlabels-right">
306 <span class="mlabels"><span class="mlabel">inline</span></span>  </td>
307   </tr>
308 </table>
309 </div><div class="memdoc">
310
311 <p>Return true if a PPM file is currently open. </p>
312
313 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00114">114</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
314
315 <p>Referenced by <a class="el" href="utils_2_utils_8h_source.xhtml#l00142">PPMLoader::fill_image()</a>, <a class="el" href="utils_2_utils_8h_source.xhtml#l00125">PPMLoader::init_image()</a>, <a class="el" href="cl__convolution_8cpp_source.xhtml#l00053">main_cl_convolution()</a>, <a class="el" href="cl__events_8cpp_source.xhtml#l00033">main_cl_events()</a>, <a class="el" href="neon__convolution_8cpp_source.xhtml#l00052">main_neon_convolution()</a>, <a class="el" href="neon__scale_8cpp_source.xhtml#l00032">main_neon_scale()</a>, <a class="el" href="neoncl__scale__median__gaussian_8cpp_source.xhtml#l00039">main_neoncl_scale_median_gaussian()</a>, and <a class="el" href="utils_2_utils_8h_source.xhtml#l00094">PPMLoader::open()</a>.</p>
316 <div class="fragment"><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    {</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;        <span class="keywordflow">return</span> _fs.is_open();</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    }</div></div><!-- fragment -->
317 </div>
318 </div>
319 <a class="anchor" id="a36e58f3e64f3851ebac7a9556b4704ed"></a>
320 <div class="memitem">
321 <div class="memproto">
322 <table class="mlabels">
323   <tr>
324   <td class="mlabels-left">
325       <table class="memname">
326         <tr>
327           <td class="memname">void open </td>
328           <td>(</td>
329           <td class="paramtype">const std::string &amp;&#160;</td>
330           <td class="paramname"><em>ppm_filename</em></td><td>)</td>
331           <td></td>
332         </tr>
333       </table>
334   </td>
335   <td class="mlabels-right">
336 <span class="mlabels"><span class="mlabel">inline</span></span>  </td>
337   </tr>
338 </table>
339 </div><div class="memdoc">
340
341 <p>Open a PPM file and reads its metadata (Width, height) </p>
342 <dl class="params"><dt>Parameters</dt><dd>
343   <table class="params">
344     <tr><td class="paramdir">[in]</td><td class="paramname">ppm_filename</td><td>File to open </td></tr>
345   </table>
346   </dd>
347 </dl>
348
349 <p>Definition at line <a class="el" href="utils_2_utils_8h_source.xhtml#l00094">94</a> of file <a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a>.</p>
350
351 <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#l00114">PPMLoader::is_open()</a>, and <a class="el" href="utils_2_utils_8cpp_source.xhtml#l00140">arm_compute::utils::parse_ppm_header()</a>.</p>
352
353 <p>Referenced by <a class="el" href="cl__convolution_8cpp_source.xhtml#l00053">main_cl_convolution()</a>, <a class="el" href="cl__events_8cpp_source.xhtml#l00033">main_cl_events()</a>, <a class="el" href="neon__convolution_8cpp_source.xhtml#l00052">main_neon_convolution()</a>, <a class="el" href="neon__scale_8cpp_source.xhtml#l00032">main_neon_scale()</a>, and <a class="el" href="neoncl__scale__median__gaussian_8cpp_source.xhtml#l00039">main_neoncl_scale_median_gaussian()</a>.</p>
354 <div class="fragment"><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;    {</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;        <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><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;        <span class="keywordflow">try</span></div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;        {</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;            _fs.exceptions(std::ifstream::failbit | std::ifstream::badbit);</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;            _fs.open(ppm_filename, std::ios::in | std::ios::binary);</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;            <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> max_val = 0;</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;            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="l00104"></a><span class="lineno">  104</span>&#160;</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;            <a class="code" href="_error_8h.xhtml#a5bbdcf574d3f5e412fa6a1117911e67b">ARM_COMPUTE_ERROR_ON_MSG</a>(max_val &gt;= 256, <span class="stringliteral">&quot;2 bytes per colour channel not supported in file %s&quot;</span>, ppm_filename.c_str());</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;        }</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;        <span class="keywordflow">catch</span>(<span class="keyword">const</span> std::ifstream::failure &amp;e)</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;        {</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;            <a class="code" href="_error_8h.xhtml#a05b19c75afe9c24200a62b9724734bbd">ARM_COMPUTE_ERROR</a>(<span class="stringliteral">&quot;Accessing %s: %s&quot;</span>, ppm_filename.c_str(), e.what());</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;        }</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;    }</div><div class="ttc" id="_error_8h_xhtml_a05b19c75afe9c24200a62b9724734bbd"><div class="ttname"><a href="_error_8h.xhtml#a05b19c75afe9c24200a62b9724734bbd">ARM_COMPUTE_ERROR</a></div><div class="ttdeci">#define ARM_COMPUTE_ERROR(...)</div><div class="ttdoc">Print the given message then throw an std::runtime_error. </div><div class="ttdef"><b>Definition:</b> <a href="_error_8h_source.xhtml#l00031">Error.h:31</a></div></div>
355 <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>
356 <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#l00114">Utils.h:114</a></div></div>
357 <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&lt; unsigned int, unsigned int, int &gt; parse_ppm_header(std::ifstream &amp;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>
358 <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>
359 </div><!-- fragment -->
360 </div>
361 </div>
362 <hr/>The documentation for this class was generated from the following file:<ul>
363 <li>utils/<a class="el" href="utils_2_utils_8h_source.xhtml">Utils.h</a></li>
364 </ul>
365 </div><!-- contents -->
366 </div><!-- doc-content -->
367 <!-- start footer part -->
368 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
369   <ul>
370     <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>
371     <li class="footer">Generated on Fri Jun 23 2017 15:44:36 for Compute Library by
372     <a href="http://www.doxygen.org/index.html">
373     <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
374   </ul>
375 </div>
376 </body>
377 </html>