Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 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"/> |
Kaizen | 8938bd3 | 2017-09-28 14:38:23 +0100 | [diff] [blame] | 7 | <meta name="generator" content="Doxygen 1.8.6"/> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 8 | <meta name="robots" content="NOINDEX, NOFOLLOW" /> <!-- Prevent indexing by search engines --> |
Anthony Barbier | dbdab85 | 2017-06-23 15:42:00 +0100 | [diff] [blame] | 9 | <title>Compute Library: src/core/CL/cl_kernels/histogram.cl Source File</title> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 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> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 15 | <script type="text/javascript" src="navtree.js"></script> |
| 16 | <script type="text/javascript"> |
| 17 | $(document).ready(initResizable); |
| 18 | $(window).load(resizeHeight); |
| 19 | </script> |
| 20 | <link href="search/search.css" rel="stylesheet" type="text/css"/> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 21 | <script type="text/javascript" src="search/search.js"></script> |
| 22 | <script type="text/javascript"> |
Kaizen | 8938bd3 | 2017-09-28 14:38:23 +0100 | [diff] [blame] | 23 | $(document).ready(function() { searchBox.OnSelectItem(0); }); |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 24 | </script> |
| 25 | <script type="text/x-mathjax-config"> |
| 26 | MathJax.Hub.Config({ |
| 27 | extensions: ["tex2jax.js"], |
| 28 | jax: ["input/TeX","output/HTML-CSS"], |
| 29 | }); |
Kaizen | 8938bd3 | 2017-09-28 14:38:23 +0100 | [diff] [blame] | 30 | </script><script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 31 | <link href="doxygen.css" rel="stylesheet" type="text/css" /> |
| 32 | </head> |
| 33 | <body> |
| 34 | <div id="top"><!-- do not remove this div, it is closed by doxygen! --> |
| 35 | <div id="titlearea"> |
| 36 | <table cellspacing="0" cellpadding="0"> |
| 37 | <tbody> |
| 38 | <tr style="height: 56px;"> |
| 39 | <td style="padding-left: 0.5em;"> |
Anthony Barbier | dbdab85 | 2017-06-23 15:42:00 +0100 | [diff] [blame] | 40 | <div id="projectname">Compute Library |
Kaizen | bf8b01d | 2017-10-12 14:26:51 +0100 | [diff] [blame^] | 41 |  <span id="projectnumber">17.10</span> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 42 | </div> |
| 43 | </td> |
| 44 | </tr> |
| 45 | </tbody> |
| 46 | </table> |
| 47 | </div> |
| 48 | <!-- end header part --> |
Kaizen | 8938bd3 | 2017-09-28 14:38:23 +0100 | [diff] [blame] | 49 | <!-- Generated by Doxygen 1.8.6 --> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 50 | <script type="text/javascript"> |
| 51 | var searchBox = new SearchBox("searchBox", "search",false,'Search'); |
| 52 | </script> |
| 53 | <div id="navrow1" class="tabs"> |
| 54 | <ul class="tablist"> |
| 55 | <li><a href="index.xhtml"><span>Main Page</span></a></li> |
Anthony Barbier | dbdab85 | 2017-06-23 15:42:00 +0100 | [diff] [blame] | 56 | <li><a href="pages.xhtml"><span>Related Pages</span></a></li> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 57 | <li><a href="namespaces.xhtml"><span>Namespaces</span></a></li> |
| 58 | <li><a href="annotated.xhtml"><span>Data Structures</span></a></li> |
| 59 | <li class="current"><a href="files.xhtml"><span>Files</span></a></li> |
| 60 | <li> |
| 61 | <div id="MSearchBox" class="MSearchBoxInactive"> |
| 62 | <span class="left"> |
| 63 | <img id="MSearchSelect" src="search/mag_sel.png" |
| 64 | onmouseover="return searchBox.OnSearchSelectShow()" |
| 65 | onmouseout="return searchBox.OnSearchSelectHide()" |
| 66 | alt=""/> |
| 67 | <input type="text" id="MSearchField" value="Search" accesskey="S" |
| 68 | onfocus="searchBox.OnSearchFieldFocus(true)" |
| 69 | onblur="searchBox.OnSearchFieldFocus(false)" |
| 70 | onkeyup="searchBox.OnSearchFieldChange(event)"/> |
| 71 | </span><span class="right"> |
| 72 | <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> |
| 73 | </span> |
| 74 | </div> |
| 75 | </li> |
| 76 | </ul> |
| 77 | </div> |
| 78 | <div id="navrow2" class="tabs2"> |
| 79 | <ul class="tablist"> |
| 80 | <li><a href="files.xhtml"><span>File List</span></a></li> |
| 81 | <li><a href="globals.xhtml"><span>Globals</span></a></li> |
| 82 | </ul> |
| 83 | </div> |
| 84 | </div><!-- top --> |
| 85 | <div id="side-nav" class="ui-resizable side-nav-resizable"> |
| 86 | <div id="nav-tree"> |
| 87 | <div id="nav-tree-contents"> |
| 88 | <div id="nav-sync" class="sync"></div> |
| 89 | </div> |
| 90 | </div> |
| 91 | <div id="splitbar" style="-moz-user-select:none;" |
| 92 | class="ui-resizable-handle"> |
| 93 | </div> |
| 94 | </div> |
| 95 | <script type="text/javascript"> |
| 96 | $(document).ready(function(){initNavTree('histogram_8cl_source.xhtml','');}); |
| 97 | </script> |
| 98 | <div id="doc-content"> |
| 99 | <!-- window showing the filter options --> |
| 100 | <div id="MSearchSelectWindow" |
| 101 | onmouseover="return searchBox.OnSearchSelectShow()" |
| 102 | onmouseout="return searchBox.OnSearchSelectHide()" |
| 103 | onkeydown="return searchBox.OnSearchSelectKey(event)"> |
Kaizen | 8938bd3 | 2017-09-28 14:38:23 +0100 | [diff] [blame] | 104 | <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark"> </span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(11)"><span class="SelectionMark"> </span>Pages</a></div> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 105 | |
| 106 | <!-- iframe showing the search results (closed by default) --> |
| 107 | <div id="MSearchResultsWindow"> |
| 108 | <iframe src="javascript:void(0)" frameborder="0" |
| 109 | name="MSearchResults" id="MSearchResults"> |
| 110 | </iframe> |
| 111 | </div> |
| 112 | |
| 113 | <div class="header"> |
| 114 | <div class="headertitle"> |
| 115 | <div class="title">histogram.cl</div> </div> |
| 116 | </div><!--header--> |
| 117 | <div class="contents"> |
Kaizen | 8938bd3 | 2017-09-28 14:38:23 +0100 | [diff] [blame] | 118 | <a href="histogram_8cl.xhtml">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div> |
| 119 | <div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> * Copyright (c) 2016, 2017 ARM Limited.</span></div> |
| 120 | <div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> *</span></div> |
| 121 | <div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> * SPDX-License-Identifier: MIT</span></div> |
| 122 | <div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> *</span></div> |
| 123 | <div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining a copy</span></div> |
| 124 | <div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> * of this software and associated documentation files (the "Software"), to</span></div> |
| 125 | <div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> * deal in the Software without restriction, including without limitation the</span></div> |
| 126 | <div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or</span></div> |
| 127 | <div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> * sell copies of the Software, and to permit persons to whom the Software is</span></div> |
| 128 | <div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"> * furnished to do so, subject to the following conditions:</span></div> |
| 129 | <div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"> *</span></div> |
| 130 | <div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> * The above copyright notice and this permission notice shall be included in all</span></div> |
| 131 | <div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> * copies or substantial portions of the Software.</span></div> |
| 132 | <div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> *</span></div> |
| 133 | <div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span></div> |
| 134 | <div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span></div> |
| 135 | <div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment"> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE</span></div> |
| 136 | <div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment"> * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span></div> |
| 137 | <div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,</span></div> |
| 138 | <div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="comment"> * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span></div> |
| 139 | <div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="comment"> * SOFTWARE.</span></div> |
| 140 | <div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="comment"> */</span></div> |
| 141 | <div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#include "<a class="code" href="helpers_8h.xhtml">helpers.h</a>"</span></div> |
| 142 | <div class="line"><a name="l00025"></a><span class="lineno"> 25</span> </div> |
| 143 | <div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="histogram_8cl.xhtml#a2c8a35cfde24ca7728709200962e1a91"> 26</a></span> <span class="preprocessor">#define VATOMIC_INC16(histogram, win_pos) \</span></div> |
| 144 | <div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="preprocessor"> { \</span></div> |
| 145 | <div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor"> atomic_inc(histogram + win_pos.s0); \</span></div> |
| 146 | <div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="preprocessor"> atomic_inc(histogram + win_pos.s1); \</span></div> |
| 147 | <div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="preprocessor"> atomic_inc(histogram + win_pos.s2); \</span></div> |
| 148 | <div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="preprocessor"> atomic_inc(histogram + win_pos.s3); \</span></div> |
| 149 | <div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="preprocessor"> atomic_inc(histogram + win_pos.s4); \</span></div> |
| 150 | <div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="preprocessor"> atomic_inc(histogram + win_pos.s5); \</span></div> |
| 151 | <div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="preprocessor"> atomic_inc(histogram + win_pos.s6); \</span></div> |
| 152 | <div class="line"><a name="l00035"></a><span class="lineno"> 35</span> <span class="preprocessor"> atomic_inc(histogram + win_pos.s7); \</span></div> |
| 153 | <div class="line"><a name="l00036"></a><span class="lineno"> 36</span> <span class="preprocessor"> atomic_inc(histogram + win_pos.s8); \</span></div> |
| 154 | <div class="line"><a name="l00037"></a><span class="lineno"> 37</span> <span class="preprocessor"> atomic_inc(histogram + win_pos.s9); \</span></div> |
| 155 | <div class="line"><a name="l00038"></a><span class="lineno"> 38</span> <span class="preprocessor"> atomic_inc(histogram + win_pos.sa); \</span></div> |
| 156 | <div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="preprocessor"> atomic_inc(histogram + win_pos.sb); \</span></div> |
| 157 | <div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="preprocessor"> atomic_inc(histogram + win_pos.sc); \</span></div> |
| 158 | <div class="line"><a name="l00041"></a><span class="lineno"> 41</span> <span class="preprocessor"> atomic_inc(histogram + win_pos.sd); \</span></div> |
| 159 | <div class="line"><a name="l00042"></a><span class="lineno"> 42</span> <span class="preprocessor"> atomic_inc(histogram + win_pos.se); \</span></div> |
| 160 | <div class="line"><a name="l00043"></a><span class="lineno"> 43</span> <span class="preprocessor"> atomic_inc(histogram + win_pos.sf); \</span></div> |
| 161 | <div class="line"><a name="l00044"></a><span class="lineno"> 44</span> <span class="preprocessor"> }</span></div> |
| 162 | <div class="line"><a name="l00045"></a><span class="lineno"> 45</span> <span class="preprocessor"></span></div> |
| 163 | <div class="line"><a name="l00068"></a><span class="lineno"><a class="line" href="histogram_8cl.xhtml#abc81d92c9655c4ec22fff9163b66279d"> 68</a></span> __kernel <span class="keywordtype">void</span> <a class="code" href="histogram_8cl.xhtml#abc81d92c9655c4ec22fff9163b66279d">hist_local_kernel</a>(<a class="code" href="helpers_8h.xhtml#a22f42fcf2077d951271df83b55c1a71a">IMAGE_DECLARATION</a>(input),</div> |
| 164 | <div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  __local uint *histogram_local,</div> |
| 165 | <div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  __global uint *restrict histogram,</div> |
| 166 | <div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  uint num_bins,</div> |
| 167 | <div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  uint <a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>,</div> |
| 168 | <div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  uint range,</div> |
| 169 | <div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  uint offrange)</div> |
| 170 | <div class="line"><a name="l00075"></a><span class="lineno"> 75</span> {</div> |
| 171 | <div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <a class="code" href="struct_image.xhtml">Image</a> input_buffer = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(input);</div> |
| 172 | <div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  uint local_id_x = get_local_id(0);</div> |
| 173 | <div class="line"><a name="l00078"></a><span class="lineno"> 78</span> </div> |
| 174 | <div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  uint local_x_size = get_local_size(0);</div> |
| 175 | <div class="line"><a name="l00080"></a><span class="lineno"> 80</span> </div> |
| 176 | <div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  <span class="keywordflow">if</span>(num_bins > local_x_size)</div> |
| 177 | <div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  {</div> |
| 178 | <div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = local_id_x; i < num_bins; i += local_x_size)</div> |
| 179 | <div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  {</div> |
| 180 | <div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  histogram_local[i] = 0;</div> |
| 181 | <div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  }</div> |
| 182 | <div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  }</div> |
| 183 | <div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="keywordflow">else</span></div> |
| 184 | <div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  {</div> |
| 185 | <div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  <span class="keywordflow">if</span>(local_id_x <= num_bins)</div> |
| 186 | <div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  {</div> |
| 187 | <div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  histogram_local[local_id_x] = 0;</div> |
| 188 | <div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  }</div> |
| 189 | <div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  }</div> |
| 190 | <div class="line"><a name="l00095"></a><span class="lineno"> 95</span> </div> |
| 191 | <div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  uint16 vals = convert_uint16(vload16(0, input_buffer.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>));</div> |
| 192 | <div class="line"><a name="l00097"></a><span class="lineno"> 97</span> </div> |
| 193 | <div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  uint16 win_pos = select(num_bins, ((vals - offset) * num_bins) / range, (vals >= offset && vals < offrange));</div> |
| 194 | <div class="line"><a name="l00099"></a><span class="lineno"> 99</span> </div> |
| 195 | <div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  barrier(CLK_LOCAL_MEM_FENCE);</div> |
| 196 | <div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  <a class="code" href="histogram_8cl.xhtml#a2c8a35cfde24ca7728709200962e1a91">VATOMIC_INC16</a>(histogram_local, win_pos);</div> |
| 197 | <div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  barrier(CLK_LOCAL_MEM_FENCE);</div> |
| 198 | <div class="line"><a name="l00103"></a><span class="lineno"> 103</span> </div> |
| 199 | <div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  <span class="keywordflow">if</span>(num_bins > local_x_size)</div> |
| 200 | <div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  {</div> |
| 201 | <div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = local_id_x; i < num_bins; i += local_x_size)</div> |
| 202 | <div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  {</div> |
| 203 | <div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  atomic_add(histogram + i, histogram_local[i]);</div> |
| 204 | <div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  }</div> |
| 205 | <div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  }</div> |
| 206 | <div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <span class="keywordflow">else</span></div> |
| 207 | <div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  {</div> |
| 208 | <div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  <span class="keywordflow">if</span>(local_id_x <= num_bins)</div> |
| 209 | <div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  {</div> |
| 210 | <div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  atomic_add(histogram + local_id_x, histogram_local[local_id_x]);</div> |
| 211 | <div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  }</div> |
| 212 | <div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  }</div> |
| 213 | <div class="line"><a name="l00118"></a><span class="lineno"> 118</span> }</div> |
| 214 | <div class="line"><a name="l00119"></a><span class="lineno"> 119</span> </div> |
| 215 | <div class="line"><a name="l00141"></a><span class="lineno"><a class="line" href="histogram_8cl.xhtml#af82fea967051b827585009463255262d"> 141</a></span> __kernel <span class="keywordtype">void</span> <a class="code" href="histogram_8cl.xhtml#af82fea967051b827585009463255262d">hist_border_kernel</a>(<a class="code" href="helpers_8h.xhtml#a22f42fcf2077d951271df83b55c1a71a">IMAGE_DECLARATION</a>(input),</div> |
| 216 | <div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  __global uint *restrict histogram,</div> |
| 217 | <div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  uint num_bins,</div> |
| 218 | <div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  uint <a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>,</div> |
| 219 | <div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  uint range,</div> |
| 220 | <div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  uint offrange)</div> |
| 221 | <div class="line"><a name="l00147"></a><span class="lineno"> 147</span> {</div> |
| 222 | <div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  <a class="code" href="struct_image.xhtml">Image</a> input_buffer = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(input);</div> |
| 223 | <div class="line"><a name="l00149"></a><span class="lineno"> 149</span> </div> |
| 224 | <div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  uint val = (uint)(*input_buffer.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>);</div> |
| 225 | <div class="line"><a name="l00151"></a><span class="lineno"> 151</span> </div> |
| 226 | <div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  uint win_pos = (val >= <a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>) ? (((val - offset) * num_bins) / range) : 0;</div> |
| 227 | <div class="line"><a name="l00153"></a><span class="lineno"> 153</span> </div> |
| 228 | <div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  <span class="keywordflow">if</span>(val >= offset && (val < offrange))</div> |
| 229 | <div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  {</div> |
| 230 | <div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  atomic_inc(histogram + win_pos);</div> |
| 231 | <div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  }</div> |
| 232 | <div class="line"><a name="l00158"></a><span class="lineno"> 158</span> }</div> |
| 233 | <div class="line"><a name="l00159"></a><span class="lineno"> 159</span> </div> |
| 234 | <div class="line"><a name="l00178"></a><span class="lineno"><a class="line" href="histogram_8cl.xhtml#a7c8051ab952a597e66090d77f4dc60e4"> 178</a></span> __kernel <span class="keywordtype">void</span> <a class="code" href="histogram_8cl.xhtml#a7c8051ab952a597e66090d77f4dc60e4">hist_local_kernel_fixed</a>(<a class="code" href="helpers_8h.xhtml#a22f42fcf2077d951271df83b55c1a71a">IMAGE_DECLARATION</a>(input),</div> |
| 235 | <div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  __local uint *histogram_local,</div> |
| 236 | <div class="line"><a name="l00180"></a><span class="lineno"> 180</span>  __global uint *restrict histogram)</div> |
| 237 | <div class="line"><a name="l00181"></a><span class="lineno"> 181</span> {</div> |
| 238 | <div class="line"><a name="l00182"></a><span class="lineno"> 182</span>  <a class="code" href="struct_image.xhtml">Image</a> input_buffer = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(input);</div> |
| 239 | <div class="line"><a name="l00183"></a><span class="lineno"> 183</span> </div> |
| 240 | <div class="line"><a name="l00184"></a><span class="lineno"> 184</span>  uint local_index = get_local_id(0);</div> |
| 241 | <div class="line"><a name="l00185"></a><span class="lineno"> 185</span>  uint local_x_size = get_local_size(0);</div> |
| 242 | <div class="line"><a name="l00186"></a><span class="lineno"> 186</span> </div> |
| 243 | <div class="line"><a name="l00187"></a><span class="lineno"> 187</span>  <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = local_index; i < 256; i += local_x_size)</div> |
| 244 | <div class="line"><a name="l00188"></a><span class="lineno"> 188</span>  {</div> |
| 245 | <div class="line"><a name="l00189"></a><span class="lineno"> 189</span>  histogram_local[i] = 0;</div> |
| 246 | <div class="line"><a name="l00190"></a><span class="lineno"> 190</span>  }</div> |
| 247 | <div class="line"><a name="l00191"></a><span class="lineno"> 191</span> </div> |
| 248 | <div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  uint16 vals = convert_uint16(vload16(0, input_buffer.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>));</div> |
| 249 | <div class="line"><a name="l00193"></a><span class="lineno"> 193</span> </div> |
| 250 | <div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  barrier(CLK_LOCAL_MEM_FENCE);</div> |
| 251 | <div class="line"><a name="l00195"></a><span class="lineno"> 195</span> </div> |
| 252 | <div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  atomic_inc(histogram_local + vals.s0);</div> |
| 253 | <div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  atomic_inc(histogram_local + vals.s1);</div> |
| 254 | <div class="line"><a name="l00198"></a><span class="lineno"> 198</span>  atomic_inc(histogram_local + vals.s2);</div> |
| 255 | <div class="line"><a name="l00199"></a><span class="lineno"> 199</span>  atomic_inc(histogram_local + vals.s3);</div> |
| 256 | <div class="line"><a name="l00200"></a><span class="lineno"> 200</span>  atomic_inc(histogram_local + vals.s4);</div> |
| 257 | <div class="line"><a name="l00201"></a><span class="lineno"> 201</span>  atomic_inc(histogram_local + vals.s5);</div> |
| 258 | <div class="line"><a name="l00202"></a><span class="lineno"> 202</span>  atomic_inc(histogram_local + vals.s6);</div> |
| 259 | <div class="line"><a name="l00203"></a><span class="lineno"> 203</span>  atomic_inc(histogram_local + vals.s7);</div> |
| 260 | <div class="line"><a name="l00204"></a><span class="lineno"> 204</span>  atomic_inc(histogram_local + vals.s8);</div> |
| 261 | <div class="line"><a name="l00205"></a><span class="lineno"> 205</span>  atomic_inc(histogram_local + vals.s9);</div> |
| 262 | <div class="line"><a name="l00206"></a><span class="lineno"> 206</span>  atomic_inc(histogram_local + vals.sa);</div> |
| 263 | <div class="line"><a name="l00207"></a><span class="lineno"> 207</span>  atomic_inc(histogram_local + vals.sb);</div> |
| 264 | <div class="line"><a name="l00208"></a><span class="lineno"> 208</span>  atomic_inc(histogram_local + vals.sc);</div> |
| 265 | <div class="line"><a name="l00209"></a><span class="lineno"> 209</span>  atomic_inc(histogram_local + vals.sd);</div> |
| 266 | <div class="line"><a name="l00210"></a><span class="lineno"> 210</span>  atomic_inc(histogram_local + vals.se);</div> |
| 267 | <div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  atomic_inc(histogram_local + vals.sf);</div> |
| 268 | <div class="line"><a name="l00212"></a><span class="lineno"> 212</span> </div> |
| 269 | <div class="line"><a name="l00213"></a><span class="lineno"> 213</span>  barrier(CLK_LOCAL_MEM_FENCE);</div> |
| 270 | <div class="line"><a name="l00214"></a><span class="lineno"> 214</span> </div> |
| 271 | <div class="line"><a name="l00215"></a><span class="lineno"> 215</span>  <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = local_index; i < 256; i += local_x_size)</div> |
| 272 | <div class="line"><a name="l00216"></a><span class="lineno"> 216</span>  {</div> |
| 273 | <div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  atomic_add(histogram + i, histogram_local[i]);</div> |
| 274 | <div class="line"><a name="l00218"></a><span class="lineno"> 218</span>  }</div> |
| 275 | <div class="line"><a name="l00219"></a><span class="lineno"> 219</span> }</div> |
| 276 | <div class="line"><a name="l00220"></a><span class="lineno"> 220</span> </div> |
| 277 | <div class="line"><a name="l00238"></a><span class="lineno"><a class="line" href="histogram_8cl.xhtml#aec6ec6157573195df9694109ebbb38ae"> 238</a></span> __kernel <span class="keywordtype">void</span> <a class="code" href="histogram_8cl.xhtml#aec6ec6157573195df9694109ebbb38ae">hist_border_kernel_fixed</a>(<a class="code" href="helpers_8h.xhtml#a22f42fcf2077d951271df83b55c1a71a">IMAGE_DECLARATION</a>(input),</div> |
| 278 | <div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  __global uint *restrict histogram)</div> |
| 279 | <div class="line"><a name="l00240"></a><span class="lineno"> 240</span> {</div> |
| 280 | <div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  <a class="code" href="struct_image.xhtml">Image</a> input_buffer = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(input);</div> |
| 281 | <div class="line"><a name="l00242"></a><span class="lineno"> 242</span>  atomic_inc(histogram + *input_buffer.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>);</div> |
| 282 | <div class="line"><a name="l00243"></a><span class="lineno"> 243</span> }</div> |
| 283 | <div class="ttc" id="histogram_8cl_xhtml_a2c8a35cfde24ca7728709200962e1a91"><div class="ttname"><a href="histogram_8cl.xhtml#a2c8a35cfde24ca7728709200962e1a91">VATOMIC_INC16</a></div><div class="ttdeci">#define VATOMIC_INC16(histogram, win_pos)</div><div class="ttdef"><b>Definition:</b> <a href="histogram_8cl_source.xhtml#l00026">histogram.cl:26</a></div></div> |
Kaizen | bf8b01d | 2017-10-12 14:26:51 +0100 | [diff] [blame^] | 284 | <div class="ttc" id="helpers_8h_xhtml_a22f42fcf2077d951271df83b55c1a71a"><div class="ttname"><a href="helpers_8h.xhtml#a22f42fcf2077d951271df83b55c1a71a">IMAGE_DECLARATION</a></div><div class="ttdeci">#define IMAGE_DECLARATION(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00060">helpers.h:60</a></div></div> |
| 285 | <div class="ttc" id="helpers_8h_xhtml_a009469e4d9b8fce3b6d5e97d2077827d"><div class="ttname"><a href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a></div><div class="ttdeci">__global uchar * offset(const Image *img, int x, int y)</div><div class="ttdoc">Get the pointer position of a Image. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00295">helpers.h:295</a></div></div> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 286 | <div class="ttc" id="histogram_8cl_xhtml_abc81d92c9655c4ec22fff9163b66279d"><div class="ttname"><a href="histogram_8cl.xhtml#abc81d92c9655c4ec22fff9163b66279d">hist_local_kernel</a></div><div class="ttdeci">__kernel void hist_local_kernel(__global uchar *input_ptr, uint input_stride_x, uint input_step_x, uint input_stride_y, uint input_step_y, uint input_offset_first_element_in_bytes, __local uint *histogram_local, __global uint *restrict histogram, uint num_bins, uint offset, uint range, uint offrange)</div><div class="ttdoc">Calculate the histogram of an 8 bit grayscale image. </div><div class="ttdef"><b>Definition:</b> <a href="histogram_8cl_source.xhtml#l00068">histogram.cl:68</a></div></div> |
| 287 | <div class="ttc" id="histogram_8cl_xhtml_a7c8051ab952a597e66090d77f4dc60e4"><div class="ttname"><a href="histogram_8cl.xhtml#a7c8051ab952a597e66090d77f4dc60e4">hist_local_kernel_fixed</a></div><div class="ttdeci">__kernel void hist_local_kernel_fixed(__global uchar *input_ptr, uint input_stride_x, uint input_step_x, uint input_stride_y, uint input_step_y, uint input_offset_first_element_in_bytes, __local uint *histogram_local, __global uint *restrict histogram)</div><div class="ttdoc">Calculate the histogram of an 8 bit grayscale image with bin size of 256 and window size of 1...</div><div class="ttdef"><b>Definition:</b> <a href="histogram_8cl_source.xhtml#l00178">histogram.cl:178</a></div></div> |
| 288 | <div class="ttc" id="helpers_8h_xhtml"><div class="ttname"><a href="helpers_8h.xhtml">helpers.h</a></div></div> |
Kaizen | bf8b01d | 2017-10-12 14:26:51 +0100 | [diff] [blame^] | 289 | <div class="ttc" id="helpers_8h_xhtml_aebe814363556c244be043b13e7969197"><div class="ttname"><a href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a></div><div class="ttdeci">#define CONVERT_TO_IMAGE_STRUCT(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00096">helpers.h:96</a></div></div> |
Kaizen | 8938bd3 | 2017-09-28 14:38:23 +0100 | [diff] [blame] | 290 | <div class="ttc" id="histogram_8cl_xhtml_af82fea967051b827585009463255262d"><div class="ttname"><a href="histogram_8cl.xhtml#af82fea967051b827585009463255262d">hist_border_kernel</a></div><div class="ttdeci">__kernel void hist_border_kernel(__global uchar *input_ptr, uint input_stride_x, uint input_step_x, uint input_stride_y, uint input_step_y, uint input_offset_first_element_in_bytes, __global uint *restrict histogram, uint num_bins, uint offset, uint range, uint offrange)</div><div class="ttdoc">Calculate the histogram of an 8 bit grayscale image's border. </div><div class="ttdef"><b>Definition:</b> <a href="histogram_8cl_source.xhtml#l00141">histogram.cl:141</a></div></div> |
Kaizen | bf8b01d | 2017-10-12 14:26:51 +0100 | [diff] [blame^] | 291 | <div class="ttc" id="struct_image_xhtml"><div class="ttname"><a href="struct_image.xhtml">Image</a></div><div class="ttdoc">Structure to hold Image information. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00134">helpers.h:134</a></div></div> |
| 292 | <div class="ttc" id="struct_image_xhtml_acf52c23cbd7424606c10a606524e3e32"><div class="ttname"><a href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">Image::ptr</a></div><div class="ttdeci">__global uchar * ptr</div><div class="ttdoc">Pointer to the starting postion of the buffer. </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00136">helpers.h:136</a></div></div> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 293 | <div class="ttc" id="histogram_8cl_xhtml_aec6ec6157573195df9694109ebbb38ae"><div class="ttname"><a href="histogram_8cl.xhtml#aec6ec6157573195df9694109ebbb38ae">hist_border_kernel_fixed</a></div><div class="ttdeci">__kernel void hist_border_kernel_fixed(__global uchar *input_ptr, uint input_stride_x, uint input_step_x, uint input_stride_y, uint input_step_y, uint input_offset_first_element_in_bytes, __global uint *restrict histogram)</div><div class="ttdoc">Calculate the histogram of an 8 bit grayscale image with bin size as 256 and window size as 1...</div><div class="ttdef"><b>Definition:</b> <a href="histogram_8cl_source.xhtml#l00238">histogram.cl:238</a></div></div> |
| 294 | </div><!-- fragment --></div><!-- contents --> |
| 295 | </div><!-- doc-content --> |
| 296 | <!-- start footer part --> |
| 297 | <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> |
| 298 | <ul> |
Kaizen | 8938bd3 | 2017-09-28 14:38:23 +0100 | [diff] [blame] | 299 | <li class="navelem"><a class="el" href="dir_55b5a5006e943fb664ff8cff3cfe7768.xhtml">src</a></li><li class="navelem"><a class="el" href="dir_f6c3ae42d7e27145d0a3c3e38ca1c000.xhtml">core</a></li><li class="navelem"><a class="el" href="dir_1b7ae9123c88e650426d50d95c19d414.xhtml">CL</a></li><li class="navelem"><a class="el" href="dir_b7c3d80b0dadb2139bc73b7161751c12.xhtml">cl_kernels</a></li><li class="navelem"><a class="el" href="histogram_8cl.xhtml">histogram.cl</a></li> |
Kaizen | bf8b01d | 2017-10-12 14:26:51 +0100 | [diff] [blame^] | 300 | <li class="footer">Generated on Thu Oct 12 2017 14:26:33 for Compute Library by |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 301 | <a href="http://www.doxygen.org/index.html"> |
Kaizen | 8938bd3 | 2017-09-28 14:38:23 +0100 | [diff] [blame] | 302 | <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li> |
Anthony Barbier | 871448e | 2017-03-24 14:54:29 +0000 | [diff] [blame] | 303 | </ul> |
| 304 | </div> |
| 305 | </body> |
| 306 | </html> |