arm_compute v17.04
[platform/upstream/armcl.git] / documentation / canny_8cl.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>ARM Compute Library: src/core/CL/cl_kernels/canny.cl File 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">ARM Compute Library
43    &#160;<span id="projectnumber">17.04</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="namespaces.xhtml"><span>Namespaces</span></a></li>
59       <li><a href="annotated.xhtml"><span>Data&#160;Structures</span></a></li>
60       <li class="current"><a href="files.xhtml"><span>Files</span></a></li>
61       <li>
62         <div id="MSearchBox" class="MSearchBoxInactive">
63         <span class="left">
64           <img id="MSearchSelect" src="search/mag_sel.png"
65                onmouseover="return searchBox.OnSearchSelectShow()"
66                onmouseout="return searchBox.OnSearchSelectHide()"
67                alt=""/>
68           <input type="text" id="MSearchField" value="Search" accesskey="S"
69                onfocus="searchBox.OnSearchFieldFocus(true)" 
70                onblur="searchBox.OnSearchFieldFocus(false)" 
71                onkeyup="searchBox.OnSearchFieldChange(event)"/>
72           </span><span class="right">
73             <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
74           </span>
75         </div>
76       </li>
77     </ul>
78   </div>
79   <div id="navrow2" class="tabs2">
80     <ul class="tablist">
81       <li><a href="files.xhtml"><span>File&#160;List</span></a></li>
82       <li><a href="globals.xhtml"><span>Globals</span></a></li>
83     </ul>
84   </div>
85 </div><!-- top -->
86 <div id="side-nav" class="ui-resizable side-nav-resizable">
87   <div id="nav-tree">
88     <div id="nav-tree-contents">
89       <div id="nav-sync" class="sync"></div>
90     </div>
91   </div>
92   <div id="splitbar" style="-moz-user-select:none;" 
93        class="ui-resizable-handle">
94   </div>
95 </div>
96 <script type="text/javascript">
97 $(document).ready(function(){initNavTree('canny_8cl.xhtml','');});
98 </script>
99 <div id="doc-content">
100 <!-- window showing the filter options -->
101 <div id="MSearchSelectWindow"
102      onmouseover="return searchBox.OnSearchSelectShow()"
103      onmouseout="return searchBox.OnSearchSelectHide()"
104      onkeydown="return searchBox.OnSearchSelectKey(event)">
105 </div>
106
107 <!-- iframe showing the search results (closed by default) -->
108 <div id="MSearchResultsWindow">
109 <iframe src="javascript:void(0)" frameborder="0" 
110         name="MSearchResults" id="MSearchResults">
111 </iframe>
112 </div>
113
114 <div class="header">
115   <div class="summary">
116 <a href="#define-members">Macros</a> &#124;
117 <a href="#func-members">Functions</a> &#124;
118 <a href="#var-members">Variables</a>  </div>
119   <div class="headertitle">
120 <div class="title">canny.cl File Reference</div>  </div>
121 </div><!--header-->
122 <div class="contents">
123 <div class="textblock"><code>#include &quot;<a class="el" href="helpers_8h_source.xhtml">helpers.h</a>&quot;</code><br />
124 </div>
125 <p><a href="canny_8cl_source.xhtml">Go to the source code of this file.</a></p>
126 <table class="memberdecls">
127 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
128 Macros</h2></td></tr>
129 <tr class="memitem:ac243bfa96aa2c28014159ff098bd2324"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="canny_8cl.xhtml#ac243bfa96aa2c28014159ff098bd2324">EDGE</a>&#160;&#160;&#160;255</td></tr>
130 <tr class="separator:ac243bfa96aa2c28014159ff098bd2324"><td class="memSeparator" colspan="2">&#160;</td></tr>
131 <tr class="memitem:a242e5ec23ae26cd2dfa5eab5ae68a0f1"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="canny_8cl.xhtml#a242e5ec23ae26cd2dfa5eab5ae68a0f1">hysteresis_local_stack_L1</a>&#160;&#160;&#160;8</td></tr>
132 <tr class="separator:a242e5ec23ae26cd2dfa5eab5ae68a0f1"><td class="memSeparator" colspan="2">&#160;</td></tr>
133 <tr class="memitem:aa55093fb165fb76898efb3ba80f62bae"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="canny_8cl.xhtml#aa55093fb165fb76898efb3ba80f62bae">hysteresis_local_stack_L2</a>&#160;&#160;&#160;16</td></tr>
134 <tr class="separator:aa55093fb165fb76898efb3ba80f62bae"><td class="memSeparator" colspan="2">&#160;</td></tr>
135 <tr class="memitem:a64ee229d1bcee88c8017356d5d485650"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="canny_8cl.xhtml#a64ee229d1bcee88c8017356d5d485650">check_pixel</a>(early_test,  x_pos,  y_pos,  x_cur,  y_cur)</td></tr>
136 <tr class="memdesc:a64ee229d1bcee88c8017356d5d485650"><td class="mdescLeft">&#160;</td><td class="mdescRight">Check whether pixel is valid.  <a href="#a64ee229d1bcee88c8017356d5d485650">More...</a><br /></td></tr>
137 <tr class="separator:a64ee229d1bcee88c8017356d5d485650"><td class="memSeparator" colspan="2">&#160;</td></tr>
138 </table><table class="memberdecls">
139 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
140 Functions</h2></td></tr>
141 <tr class="memitem:a92f95668118a1bc6ef0eed965dfd570f"><td class="memItemLeft" align="right" valign="top">__kernel void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="canny_8cl.xhtml#a92f95668118a1bc6ef0eed965dfd570f">combine_gradients_L1</a> (__global uchar *src1_ptr, uint src1_stride_x, uint src1_step_x, uint src1_stride_y, uint src1_step_y, uint src1_offset_first_element_in_bytes, __global uchar *src2_ptr, uint src2_stride_x, uint src2_step_x, uint src2_stride_y, uint src2_step_y, uint src2_offset_first_element_in_bytes, __global uchar *grad_ptr, uint grad_stride_x, uint grad_step_x, uint grad_stride_y, uint grad_step_y, uint grad_offset_first_element_in_bytes, __global uchar *angle_ptr, uint angle_stride_x, uint angle_step_x, uint angle_stride_y, uint angle_step_y, uint angle_offset_first_element_in_bytes)</td></tr>
142 <tr class="memdesc:a92f95668118a1bc6ef0eed965dfd570f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculate the magnitude and phase from horizontal and vertical result of sobel result.  <a href="#a92f95668118a1bc6ef0eed965dfd570f">More...</a><br /></td></tr>
143 <tr class="separator:a92f95668118a1bc6ef0eed965dfd570f"><td class="memSeparator" colspan="2">&#160;</td></tr>
144 <tr class="memitem:a7046357526e2f95a34e3ffa217752d9f"><td class="memItemLeft" align="right" valign="top">__kernel void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="canny_8cl.xhtml#a7046357526e2f95a34e3ffa217752d9f">combine_gradients_L2</a> (__global uchar *src1_ptr, uint src1_stride_x, uint src1_step_x, uint src1_stride_y, uint src1_step_y, uint src1_offset_first_element_in_bytes, __global uchar *src2_ptr, uint src2_stride_x, uint src2_step_x, uint src2_stride_y, uint src2_step_y, uint src2_offset_first_element_in_bytes, __global uchar *grad_ptr, uint grad_stride_x, uint grad_step_x, uint grad_stride_y, uint grad_step_y, uint grad_offset_first_element_in_bytes, __global uchar *angle_ptr, uint angle_stride_x, uint angle_step_x, uint angle_stride_y, uint angle_step_y, uint angle_offset_first_element_in_bytes)</td></tr>
145 <tr class="memdesc:a7046357526e2f95a34e3ffa217752d9f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculate the gradient and angle from horizontal and vertical result of sobel result.  <a href="#a7046357526e2f95a34e3ffa217752d9f">More...</a><br /></td></tr>
146 <tr class="separator:a7046357526e2f95a34e3ffa217752d9f"><td class="memSeparator" colspan="2">&#160;</td></tr>
147 <tr class="memitem:a8c233c75ee1010bcec8601d559f4be68"><td class="memItemLeft" align="right" valign="top">__kernel void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="canny_8cl.xhtml#a8c233c75ee1010bcec8601d559f4be68">suppress_non_maximum</a> (__global uchar *grad_ptr, uint grad_stride_x, uint grad_step_x, uint grad_stride_y, uint grad_step_y, uint grad_offset_first_element_in_bytes, __global uchar *angle_ptr, uint angle_stride_x, uint angle_step_x, uint angle_stride_y, uint angle_step_y, uint angle_offset_first_element_in_bytes, __global uchar *non_max_ptr, uint non_max_stride_x, uint non_max_step_x, uint non_max_stride_y, uint non_max_step_y, uint non_max_offset_first_element_in_bytes, uint lower_thr)</td></tr>
148 <tr class="memdesc:a8c233c75ee1010bcec8601d559f4be68"><td class="mdescLeft">&#160;</td><td class="mdescRight">Perform non maximum suppression.  <a href="#a8c233c75ee1010bcec8601d559f4be68">More...</a><br /></td></tr>
149 <tr class="separator:a8c233c75ee1010bcec8601d559f4be68"><td class="memSeparator" colspan="2">&#160;</td></tr>
150 <tr class="memitem:acd62ae1c9f3d7a1c7e49499d308d1904"><td class="memItemLeft" align="right" valign="top">kernel void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="canny_8cl.xhtml#acd62ae1c9f3d7a1c7e49499d308d1904">hysteresis</a> (__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_stride_y, uint src_step_y, uint src_offset_first_element_in_bytes, __global uchar *out_ptr, uint out_stride_x, uint out_step_x, uint out_stride_y, uint out_step_y, uint out_offset_first_element_in_bytes, __global uchar *visited_ptr, uint visited_stride_x, uint visited_step_x, uint visited_stride_y, uint visited_step_y, uint visited_offset_first_element_in_bytes, __global uchar *recorded_ptr, uint recorded_stride_x, uint recorded_step_x, uint recorded_stride_y, uint recorded_step_y, uint recorded_offset_first_element_in_bytes, __global uchar *l1_stack_ptr, uint l1_stack_stride_x, uint l1_stack_step_x, uint l1_stack_stride_y, uint l1_stack_step_y, uint l1_stack_offset_first_element_in_bytes, __global uchar *l1_stack_counter_ptr, uint l1_stack_counter_stride_x, uint l1_stack_counter_step_x, uint l1_stack_counter_stride_y, uint l1_stack_counter_step_y, uint l1_stack_counter_offset_first_element_in_bytes, uint low_thr, uint up_thr, int width, int height)</td></tr>
151 <tr class="memdesc:acd62ae1c9f3d7a1c7e49499d308d1904"><td class="mdescLeft">&#160;</td><td class="mdescRight">Perform hysteresis.  <a href="#acd62ae1c9f3d7a1c7e49499d308d1904">More...</a><br /></td></tr>
152 <tr class="separator:acd62ae1c9f3d7a1c7e49499d308d1904"><td class="memSeparator" colspan="2">&#160;</td></tr>
153 </table><table class="memberdecls">
154 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
155 Variables</h2></td></tr>
156 <tr class="memitem:a65e45b2f8637f10dd14a427f37c2cd4c"><td class="memItemLeft" align="right" valign="top">__constant short4&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="canny_8cl.xhtml#a65e45b2f8637f10dd14a427f37c2cd4c">neighbours_coords</a> []</td></tr>
157 <tr class="memdesc:a65e45b2f8637f10dd14a427f37c2cd4c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Array that holds the relative coordinates offset for the neighbouring pixels.  <a href="#a65e45b2f8637f10dd14a427f37c2cd4c">More...</a><br /></td></tr>
158 <tr class="separator:a65e45b2f8637f10dd14a427f37c2cd4c"><td class="memSeparator" colspan="2">&#160;</td></tr>
159 </table>
160 <h2 class="groupheader">Macro Definition Documentation</h2>
161 <a class="anchor" id="a64ee229d1bcee88c8017356d5d485650"></a>
162 <div class="memitem">
163 <div class="memproto">
164       <table class="memname">
165         <tr>
166           <td class="memname">#define check_pixel</td>
167           <td>(</td>
168           <td class="paramtype">&#160;</td>
169           <td class="paramname">early_test, </td>
170         </tr>
171         <tr>
172           <td class="paramkey"></td>
173           <td></td>
174           <td class="paramtype">&#160;</td>
175           <td class="paramname">x_pos, </td>
176         </tr>
177         <tr>
178           <td class="paramkey"></td>
179           <td></td>
180           <td class="paramtype">&#160;</td>
181           <td class="paramname">y_pos, </td>
182         </tr>
183         <tr>
184           <td class="paramkey"></td>
185           <td></td>
186           <td class="paramtype">&#160;</td>
187           <td class="paramname">x_cur, </td>
188         </tr>
189         <tr>
190           <td class="paramkey"></td>
191           <td></td>
192           <td class="paramtype">&#160;</td>
193           <td class="paramname">y_cur&#160;</td>
194         </tr>
195         <tr>
196           <td></td>
197           <td>)</td>
198           <td></td><td></td>
199         </tr>
200       </table>
201 </div><div class="memdoc">
202 <b>Value:</b><div class="fragment"><div class="line">{                                                                                     \</div><div class="line">        if(!early_test)                                                                   \</div><div class="line">        {                                                                                 \</div><div class="line">            <span class="comment">/* Number of elements in the local stack 1, points to next available entry */</span> \</div><div class="line">            c = *((__global <span class="keywordtype">char</span> *)<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;l1_stack_counter, x_cur, y_cur));              \</div><div class="line">            \</div><div class="line">            if(c &gt; (<a class="code" href="canny_8cl.xhtml#a242e5ec23ae26cd2dfa5eab5ae68a0f1">hysteresis_local_stack_L1</a> - 1)) <span class="comment">/* Stack level 1 is full */</span>           \</div><div class="line">                goto pop_stack;                                                           \</div><div class="line">            \</div><div class="line">            <span class="comment">/* The pixel that has already been recorded is ignored */</span>                     \</div><div class="line">            if(!atomic_or((__global uint *)<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;recorded, x_pos, y_pos), 1))           \</div><div class="line">            {                                                                             \</div><div class="line">                l1_ptr[c] = (short2)(x_pos, y_pos);                                       \</div><div class="line">                *((__global <span class="keywordtype">char</span> *)<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;l1_stack_counter, x_cur, y_cur)) += 1;         \</div><div class="line">            }                                                                             \</div><div class="line">        }                                                                                 \</div><div class="line">    }</div><div class="ttc" id="canny_8cl_xhtml_a242e5ec23ae26cd2dfa5eab5ae68a0f1"><div class="ttname"><a href="canny_8cl.xhtml#a242e5ec23ae26cd2dfa5eab5ae68a0f1">hysteresis_local_stack_L1</a></div><div class="ttdeci">#define hysteresis_local_stack_L1</div><div class="ttdef"><b>Definition:</b> <a href="canny_8cl_source.xhtml#l00228">canny.cl:228</a></div></div>
203 <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#l00201">helpers.h:201</a></div></div>
204 </div><!-- fragment -->
205 <p>Check whether pixel is valid. </p>
206 <p>Skip the pixel if the early_test fails. Otherwise, it tries to add the pixel coordinate to the stack, and proceed to popping the stack instead if the stack is full</p>
207 <dl class="params"><dt>Parameters</dt><dd>
208   <table class="params">
209     <tr><td class="paramdir">[in]</td><td class="paramname">early_test</td><td>Boolean condition based on the minv check and visited buffer check </td></tr>
210     <tr><td class="paramdir">[in]</td><td class="paramname">x_pos</td><td>X-coordinate of pixel that is going to be recorded, has to be within the boundary </td></tr>
211     <tr><td class="paramdir">[in]</td><td class="paramname">y_pos</td><td>Y-coordinate of pixel that is going to be recorded, has to be within the boundary </td></tr>
212     <tr><td class="paramdir">[in]</td><td class="paramname">x_cur</td><td>X-coordinate of current central pixel </td></tr>
213     <tr><td class="paramdir">[in]</td><td class="paramname">y_cur</td><td>Y-coordinate of current central pixel </td></tr>
214   </table>
215   </dd>
216 </dl>
217
218 <p>Definition at line <a class="el" href="canny_8cl_source.xhtml#l00242">242</a> of file <a class="el" href="canny_8cl_source.xhtml">canny.cl</a>.</p>
219
220 <p>Referenced by <a class="el" href="canny_8cl_source.xhtml#l00306">hysteresis()</a>.</p>
221
222 </div>
223 </div>
224 <a class="anchor" id="ac243bfa96aa2c28014159ff098bd2324"></a>
225 <div class="memitem">
226 <div class="memproto">
227       <table class="memname">
228         <tr>
229           <td class="memname">#define EDGE&#160;&#160;&#160;255</td>
230         </tr>
231       </table>
232 </div><div class="memdoc">
233
234 <p>Definition at line <a class="el" href="canny_8cl_source.xhtml#l00227">227</a> of file <a class="el" href="canny_8cl_source.xhtml">canny.cl</a>.</p>
235
236 <p>Referenced by <a class="el" href="canny_8cl_source.xhtml#l00306">hysteresis()</a>.</p>
237
238 </div>
239 </div>
240 <a class="anchor" id="a242e5ec23ae26cd2dfa5eab5ae68a0f1"></a>
241 <div class="memitem">
242 <div class="memproto">
243       <table class="memname">
244         <tr>
245           <td class="memname">#define hysteresis_local_stack_L1&#160;&#160;&#160;8</td>
246         </tr>
247       </table>
248 </div><div class="memdoc">
249
250 <p>Definition at line <a class="el" href="canny_8cl_source.xhtml#l00228">228</a> of file <a class="el" href="canny_8cl_source.xhtml">canny.cl</a>.</p>
251
252 <p>Referenced by <a class="el" href="canny_8cl_source.xhtml#l00306">hysteresis()</a>.</p>
253
254 </div>
255 </div>
256 <a class="anchor" id="aa55093fb165fb76898efb3ba80f62bae"></a>
257 <div class="memitem">
258 <div class="memproto">
259       <table class="memname">
260         <tr>
261           <td class="memname">#define hysteresis_local_stack_L2&#160;&#160;&#160;16</td>
262         </tr>
263       </table>
264 </div><div class="memdoc">
265
266 <p>Definition at line <a class="el" href="canny_8cl_source.xhtml#l00229">229</a> of file <a class="el" href="canny_8cl_source.xhtml">canny.cl</a>.</p>
267
268 <p>Referenced by <a class="el" href="canny_8cl_source.xhtml#l00306">hysteresis()</a>.</p>
269
270 </div>
271 </div>
272 <h2 class="groupheader">Function Documentation</h2>
273 <a class="anchor" id="a92f95668118a1bc6ef0eed965dfd570f"></a>
274 <div class="memitem">
275 <div class="memproto">
276       <table class="memname">
277         <tr>
278           <td class="memname">__kernel void combine_gradients_L1 </td>
279           <td>(</td>
280           <td class="paramtype">__global uchar *&#160;</td>
281           <td class="paramname"><em>src1_ptr</em>, </td>
282         </tr>
283         <tr>
284           <td class="paramkey"></td>
285           <td></td>
286           <td class="paramtype">uint&#160;</td>
287           <td class="paramname"><em>src1_stride_x</em>, </td>
288         </tr>
289         <tr>
290           <td class="paramkey"></td>
291           <td></td>
292           <td class="paramtype">uint&#160;</td>
293           <td class="paramname"><em>src1_step_x</em>, </td>
294         </tr>
295         <tr>
296           <td class="paramkey"></td>
297           <td></td>
298           <td class="paramtype">uint&#160;</td>
299           <td class="paramname"><em>src1_stride_y</em>, </td>
300         </tr>
301         <tr>
302           <td class="paramkey"></td>
303           <td></td>
304           <td class="paramtype">uint&#160;</td>
305           <td class="paramname"><em>src1_step_y</em>, </td>
306         </tr>
307         <tr>
308           <td class="paramkey"></td>
309           <td></td>
310           <td class="paramtype">uint&#160;</td>
311           <td class="paramname"><em>src1_offset_first_element_in_bytes</em>, </td>
312         </tr>
313         <tr>
314           <td class="paramkey"></td>
315           <td></td>
316           <td class="paramtype">__global uchar *&#160;</td>
317           <td class="paramname"><em>src2_ptr</em>, </td>
318         </tr>
319         <tr>
320           <td class="paramkey"></td>
321           <td></td>
322           <td class="paramtype">uint&#160;</td>
323           <td class="paramname"><em>src2_stride_x</em>, </td>
324         </tr>
325         <tr>
326           <td class="paramkey"></td>
327           <td></td>
328           <td class="paramtype">uint&#160;</td>
329           <td class="paramname"><em>src2_step_x</em>, </td>
330         </tr>
331         <tr>
332           <td class="paramkey"></td>
333           <td></td>
334           <td class="paramtype">uint&#160;</td>
335           <td class="paramname"><em>src2_stride_y</em>, </td>
336         </tr>
337         <tr>
338           <td class="paramkey"></td>
339           <td></td>
340           <td class="paramtype">uint&#160;</td>
341           <td class="paramname"><em>src2_step_y</em>, </td>
342         </tr>
343         <tr>
344           <td class="paramkey"></td>
345           <td></td>
346           <td class="paramtype">uint&#160;</td>
347           <td class="paramname"><em>src2_offset_first_element_in_bytes</em>, </td>
348         </tr>
349         <tr>
350           <td class="paramkey"></td>
351           <td></td>
352           <td class="paramtype">__global uchar *&#160;</td>
353           <td class="paramname"><em>grad_ptr</em>, </td>
354         </tr>
355         <tr>
356           <td class="paramkey"></td>
357           <td></td>
358           <td class="paramtype">uint&#160;</td>
359           <td class="paramname"><em>grad_stride_x</em>, </td>
360         </tr>
361         <tr>
362           <td class="paramkey"></td>
363           <td></td>
364           <td class="paramtype">uint&#160;</td>
365           <td class="paramname"><em>grad_step_x</em>, </td>
366         </tr>
367         <tr>
368           <td class="paramkey"></td>
369           <td></td>
370           <td class="paramtype">uint&#160;</td>
371           <td class="paramname"><em>grad_stride_y</em>, </td>
372         </tr>
373         <tr>
374           <td class="paramkey"></td>
375           <td></td>
376           <td class="paramtype">uint&#160;</td>
377           <td class="paramname"><em>grad_step_y</em>, </td>
378         </tr>
379         <tr>
380           <td class="paramkey"></td>
381           <td></td>
382           <td class="paramtype">uint&#160;</td>
383           <td class="paramname"><em>grad_offset_first_element_in_bytes</em>, </td>
384         </tr>
385         <tr>
386           <td class="paramkey"></td>
387           <td></td>
388           <td class="paramtype">__global uchar *&#160;</td>
389           <td class="paramname"><em>angle_ptr</em>, </td>
390         </tr>
391         <tr>
392           <td class="paramkey"></td>
393           <td></td>
394           <td class="paramtype">uint&#160;</td>
395           <td class="paramname"><em>angle_stride_x</em>, </td>
396         </tr>
397         <tr>
398           <td class="paramkey"></td>
399           <td></td>
400           <td class="paramtype">uint&#160;</td>
401           <td class="paramname"><em>angle_step_x</em>, </td>
402         </tr>
403         <tr>
404           <td class="paramkey"></td>
405           <td></td>
406           <td class="paramtype">uint&#160;</td>
407           <td class="paramname"><em>angle_stride_y</em>, </td>
408         </tr>
409         <tr>
410           <td class="paramkey"></td>
411           <td></td>
412           <td class="paramtype">uint&#160;</td>
413           <td class="paramname"><em>angle_step_y</em>, </td>
414         </tr>
415         <tr>
416           <td class="paramkey"></td>
417           <td></td>
418           <td class="paramtype">uint&#160;</td>
419           <td class="paramname"><em>angle_offset_first_element_in_bytes</em>&#160;</td>
420         </tr>
421         <tr>
422           <td></td>
423           <td>)</td>
424           <td></td><td></td>
425         </tr>
426       </table>
427 </div><div class="memdoc">
428
429 <p>Calculate the magnitude and phase from horizontal and vertical result of sobel result. </p>
430 <dl class="section note"><dt>Note</dt><dd>The calculation of gradient uses level 1 normalisation. </dd></dl>
431 <dl class="section attention"><dt>Attention</dt><dd>The input and output data types need to be passed at compile time using -DDATA_TYPE_IN and -DDATA_TYPE_OUT: e.g. -DDATA_TYPE_IN=uchar -DDATA_TYPE_OUT=short</dd></dl>
432 <dl class="params"><dt>Parameters</dt><dd>
433   <table class="params">
434     <tr><td class="paramdir">[in]</td><td class="paramname">src1_ptr</td><td>Pointer to the source image (Vertical result of Sobel). Supported data types: S16, S32 </td></tr>
435     <tr><td class="paramdir">[in]</td><td class="paramname">src1_stride_x</td><td>Stride of the source image in X dimension (in bytes) </td></tr>
436     <tr><td class="paramdir">[in]</td><td class="paramname">src1_step_x</td><td>src1_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
437     <tr><td class="paramdir">[in]</td><td class="paramname">src1_stride_y</td><td>Stride of the source image in Y dimension (in bytes) </td></tr>
438     <tr><td class="paramdir">[in]</td><td class="paramname">src1_step_y</td><td>src1_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
439     <tr><td class="paramdir">[in]</td><td class="paramname">src1_offset_first_element_in_bytes</td><td>The offset of the first element in the source image </td></tr>
440     <tr><td class="paramdir">[in]</td><td class="paramname">src2_ptr</td><td>Pointer to the source image (Vertical result of Sobel). Supported data types: S16, S32 </td></tr>
441     <tr><td class="paramdir">[in]</td><td class="paramname">src2_stride_x</td><td>Stride of the source image in X dimension (in bytes) </td></tr>
442     <tr><td class="paramdir">[in]</td><td class="paramname">src2_step_x</td><td>src2_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
443     <tr><td class="paramdir">[in]</td><td class="paramname">src2_stride_y</td><td>Stride of the source image in Y dimension (in bytes) </td></tr>
444     <tr><td class="paramdir">[in]</td><td class="paramname">src2_step_y</td><td>src2_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
445     <tr><td class="paramdir">[in]</td><td class="paramname">src2_offset_first_element_in_bytes</td><td>The offset of the first element in the source image </td></tr>
446     <tr><td class="paramdir">[out]</td><td class="paramname">grad_ptr</td><td>Pointer to the gradient output. Supported data types: U16, U32 </td></tr>
447     <tr><td class="paramdir">[in]</td><td class="paramname">grad_stride_x</td><td>Stride of the source image in X dimension (in bytes) </td></tr>
448     <tr><td class="paramdir">[in]</td><td class="paramname">grad_step_x</td><td>grad_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
449     <tr><td class="paramdir">[in]</td><td class="paramname">grad_stride_y</td><td>Stride of the source image in Y dimension (in bytes) </td></tr>
450     <tr><td class="paramdir">[in]</td><td class="paramname">grad_step_y</td><td>grad_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
451     <tr><td class="paramdir">[in]</td><td class="paramname">grad_offset_first_element_in_bytes</td><td>The offset of the first element of the output </td></tr>
452     <tr><td class="paramdir">[out]</td><td class="paramname">angle_ptr</td><td>Pointer to the angle output. Supported data types: U8 </td></tr>
453     <tr><td class="paramdir">[in]</td><td class="paramname">angle_stride_x</td><td>Stride of the source image in X dimension (in bytes) </td></tr>
454     <tr><td class="paramdir">[in]</td><td class="paramname">angle_step_x</td><td>angle_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
455     <tr><td class="paramdir">[in]</td><td class="paramname">angle_stride_y</td><td>Stride of the source image in Y dimension (in bytes) </td></tr>
456     <tr><td class="paramdir">[in]</td><td class="paramname">angle_step_y</td><td>angle_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
457     <tr><td class="paramdir">[in]</td><td class="paramname">angle_offset_first_element_in_bytes</td><td>The offset of the first element of the output </td></tr>
458   </table>
459   </dd>
460 </dl>
461
462 <p>Definition at line <a class="el" href="canny_8cl_source.xhtml#l00057">57</a> of file <a class="el" href="canny_8cl_source.xhtml">canny.cl</a>.</p>
463
464 <p>References <a class="el" href="helpers_8h_source.xhtml#l00038">CONVERT_SAT</a>, <a class="el" href="helpers_8h_source.xhtml#l00073">CONVERT_TO_IMAGE_STRUCT</a>, <a class="el" href="convolution3x3_8cl_source.xhtml#l00031">DATA_TYPE_OUT</a>, <a class="el" href="helpers_8h_source.xhtml#l00097">Image::ptr</a>, and <a class="el" href="helpers_8h_source.xhtml#l00032">VEC_DATA_TYPE</a>.</p>
465 <div class="fragment"><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;{</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    <span class="comment">// Construct images</span></div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    <a class="code" href="struct_image.xhtml">Image</a> src1  = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(src1);</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    <a class="code" href="struct_image.xhtml">Image</a> src2  = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(src2);</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    <a class="code" href="struct_image.xhtml">Image</a> grad  = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(grad);</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    <a class="code" href="struct_image.xhtml">Image</a> angle = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(angle);</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;    <span class="comment">// Load sobel horizontal and vertical values</span></div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;    <a class="code" href="helpers_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(DATA_TYPE_IN, 4)</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;    h = vload4(0, (__global DATA_TYPE_IN *)src1.ptr);</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    <a class="code" href="helpers_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(DATA_TYPE_IN, 4)</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;    v = vload4(0, (__global DATA_TYPE_IN *)src2.ptr);</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    <span class="comment">/* Calculate the gradient, using level 1 normalisation method */</span></div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    <a class="code" href="helpers_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#ac06f3e24d3fffd3c465d8b2a6e7c985e">DATA_TYPE_OUT</a>, 4)</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    m = <a class="code" href="helpers_8h.xhtml#a23fb01b6f3453cc0e48a026fd44f6acd">CONVERT_SAT</a>((abs(h) + abs(v)), <a class="code" href="helpers_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(DATA_TYPE_OUT, 4));</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    <span class="comment">/* Calculate the angle */</span></div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;    float4 p = atan2pi(convert_float4(v), convert_float4(h));</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;    <span class="comment">/* Remap angle to range [0, 256) */</span></div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;    p = select(p, p + 2, p &lt; 0.0f) * 128.0f;</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;    <span class="comment">/* Store results */</span></div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    vstore4(m, 0, (__global DATA_TYPE_OUT *)grad.ptr);</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    vstore4(convert_uchar4_sat_rte(p), 0, angle.ptr);</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;}</div><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#l00073">helpers.h:73</a></div></div>
466 <div class="ttc" id="helpers_8h_xhtml_a36f754c05b6fddf6df0d8d0a74f8159f"><div class="ttname"><a href="helpers_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a></div><div class="ttdeci">#define VEC_DATA_TYPE(type, size)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00032">helpers.h:32</a></div></div>
467 <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#l00095">helpers.h:95</a></div></div>
468 <div class="ttc" id="helpers_8h_xhtml_a23fb01b6f3453cc0e48a026fd44f6acd"><div class="ttname"><a href="helpers_8h.xhtml#a23fb01b6f3453cc0e48a026fd44f6acd">CONVERT_SAT</a></div><div class="ttdeci">#define CONVERT_SAT(x, type)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00038">helpers.h:38</a></div></div>
469 <div class="ttc" id="convolution3x3_8cl_xhtml_ac06f3e24d3fffd3c465d8b2a6e7c985e"><div class="ttname"><a href="convolution3x3_8cl.xhtml#ac06f3e24d3fffd3c465d8b2a6e7c985e">DATA_TYPE_OUT</a></div><div class="ttdeci">#define DATA_TYPE_OUT</div><div class="ttdef"><b>Definition:</b> <a href="convolution3x3_8cl_source.xhtml#l00031">convolution3x3.cl:31</a></div></div>
470 </div><!-- fragment -->
471 </div>
472 </div>
473 <a class="anchor" id="a7046357526e2f95a34e3ffa217752d9f"></a>
474 <div class="memitem">
475 <div class="memproto">
476       <table class="memname">
477         <tr>
478           <td class="memname">__kernel void combine_gradients_L2 </td>
479           <td>(</td>
480           <td class="paramtype">__global uchar *&#160;</td>
481           <td class="paramname"><em>src1_ptr</em>, </td>
482         </tr>
483         <tr>
484           <td class="paramkey"></td>
485           <td></td>
486           <td class="paramtype">uint&#160;</td>
487           <td class="paramname"><em>src1_stride_x</em>, </td>
488         </tr>
489         <tr>
490           <td class="paramkey"></td>
491           <td></td>
492           <td class="paramtype">uint&#160;</td>
493           <td class="paramname"><em>src1_step_x</em>, </td>
494         </tr>
495         <tr>
496           <td class="paramkey"></td>
497           <td></td>
498           <td class="paramtype">uint&#160;</td>
499           <td class="paramname"><em>src1_stride_y</em>, </td>
500         </tr>
501         <tr>
502           <td class="paramkey"></td>
503           <td></td>
504           <td class="paramtype">uint&#160;</td>
505           <td class="paramname"><em>src1_step_y</em>, </td>
506         </tr>
507         <tr>
508           <td class="paramkey"></td>
509           <td></td>
510           <td class="paramtype">uint&#160;</td>
511           <td class="paramname"><em>src1_offset_first_element_in_bytes</em>, </td>
512         </tr>
513         <tr>
514           <td class="paramkey"></td>
515           <td></td>
516           <td class="paramtype">__global uchar *&#160;</td>
517           <td class="paramname"><em>src2_ptr</em>, </td>
518         </tr>
519         <tr>
520           <td class="paramkey"></td>
521           <td></td>
522           <td class="paramtype">uint&#160;</td>
523           <td class="paramname"><em>src2_stride_x</em>, </td>
524         </tr>
525         <tr>
526           <td class="paramkey"></td>
527           <td></td>
528           <td class="paramtype">uint&#160;</td>
529           <td class="paramname"><em>src2_step_x</em>, </td>
530         </tr>
531         <tr>
532           <td class="paramkey"></td>
533           <td></td>
534           <td class="paramtype">uint&#160;</td>
535           <td class="paramname"><em>src2_stride_y</em>, </td>
536         </tr>
537         <tr>
538           <td class="paramkey"></td>
539           <td></td>
540           <td class="paramtype">uint&#160;</td>
541           <td class="paramname"><em>src2_step_y</em>, </td>
542         </tr>
543         <tr>
544           <td class="paramkey"></td>
545           <td></td>
546           <td class="paramtype">uint&#160;</td>
547           <td class="paramname"><em>src2_offset_first_element_in_bytes</em>, </td>
548         </tr>
549         <tr>
550           <td class="paramkey"></td>
551           <td></td>
552           <td class="paramtype">__global uchar *&#160;</td>
553           <td class="paramname"><em>grad_ptr</em>, </td>
554         </tr>
555         <tr>
556           <td class="paramkey"></td>
557           <td></td>
558           <td class="paramtype">uint&#160;</td>
559           <td class="paramname"><em>grad_stride_x</em>, </td>
560         </tr>
561         <tr>
562           <td class="paramkey"></td>
563           <td></td>
564           <td class="paramtype">uint&#160;</td>
565           <td class="paramname"><em>grad_step_x</em>, </td>
566         </tr>
567         <tr>
568           <td class="paramkey"></td>
569           <td></td>
570           <td class="paramtype">uint&#160;</td>
571           <td class="paramname"><em>grad_stride_y</em>, </td>
572         </tr>
573         <tr>
574           <td class="paramkey"></td>
575           <td></td>
576           <td class="paramtype">uint&#160;</td>
577           <td class="paramname"><em>grad_step_y</em>, </td>
578         </tr>
579         <tr>
580           <td class="paramkey"></td>
581           <td></td>
582           <td class="paramtype">uint&#160;</td>
583           <td class="paramname"><em>grad_offset_first_element_in_bytes</em>, </td>
584         </tr>
585         <tr>
586           <td class="paramkey"></td>
587           <td></td>
588           <td class="paramtype">__global uchar *&#160;</td>
589           <td class="paramname"><em>angle_ptr</em>, </td>
590         </tr>
591         <tr>
592           <td class="paramkey"></td>
593           <td></td>
594           <td class="paramtype">uint&#160;</td>
595           <td class="paramname"><em>angle_stride_x</em>, </td>
596         </tr>
597         <tr>
598           <td class="paramkey"></td>
599           <td></td>
600           <td class="paramtype">uint&#160;</td>
601           <td class="paramname"><em>angle_step_x</em>, </td>
602         </tr>
603         <tr>
604           <td class="paramkey"></td>
605           <td></td>
606           <td class="paramtype">uint&#160;</td>
607           <td class="paramname"><em>angle_stride_y</em>, </td>
608         </tr>
609         <tr>
610           <td class="paramkey"></td>
611           <td></td>
612           <td class="paramtype">uint&#160;</td>
613           <td class="paramname"><em>angle_step_y</em>, </td>
614         </tr>
615         <tr>
616           <td class="paramkey"></td>
617           <td></td>
618           <td class="paramtype">uint&#160;</td>
619           <td class="paramname"><em>angle_offset_first_element_in_bytes</em>&#160;</td>
620         </tr>
621         <tr>
622           <td></td>
623           <td>)</td>
624           <td></td><td></td>
625         </tr>
626       </table>
627 </div><div class="memdoc">
628
629 <p>Calculate the gradient and angle from horizontal and vertical result of sobel result. </p>
630 <dl class="section note"><dt>Note</dt><dd>The calculation of gradient uses level 2 normalisation </dd></dl>
631 <dl class="section attention"><dt>Attention</dt><dd>The input and output data types need to be passed at compile time using -DDATA_TYPE_IN and -DDATA_TYPE_OUT: e.g. -DDATA_TYPE_IN=uchar -DDATA_TYPE_OUT=short</dd></dl>
632 <dl class="params"><dt>Parameters</dt><dd>
633   <table class="params">
634     <tr><td class="paramdir">[in]</td><td class="paramname">src1_ptr</td><td>Pointer to the source image (Vertical result of Sobel). Supported data types: S16, S32 </td></tr>
635     <tr><td class="paramdir">[in]</td><td class="paramname">src1_stride_x</td><td>Stride of the source image in X dimension (in bytes) </td></tr>
636     <tr><td class="paramdir">[in]</td><td class="paramname">src1_step_x</td><td>src1_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
637     <tr><td class="paramdir">[in]</td><td class="paramname">src1_stride_y</td><td>Stride of the source image in Y dimension (in bytes) </td></tr>
638     <tr><td class="paramdir">[in]</td><td class="paramname">src1_step_y</td><td>src1_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
639     <tr><td class="paramdir">[in]</td><td class="paramname">src1_offset_first_element_in_bytes</td><td>The offset of the first element in the source image </td></tr>
640     <tr><td class="paramdir">[in]</td><td class="paramname">src2_ptr</td><td>Pointer to the source image (Vertical result of Sobel). Supported data types: S16, S32 </td></tr>
641     <tr><td class="paramdir">[in]</td><td class="paramname">src2_stride_x</td><td>Stride of the source image in X dimension (in bytes) </td></tr>
642     <tr><td class="paramdir">[in]</td><td class="paramname">src2_step_x</td><td>src2_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
643     <tr><td class="paramdir">[in]</td><td class="paramname">src2_stride_y</td><td>Stride of the source image in Y dimension (in bytes) </td></tr>
644     <tr><td class="paramdir">[in]</td><td class="paramname">src2_step_y</td><td>src2_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
645     <tr><td class="paramdir">[in]</td><td class="paramname">src2_offset_first_element_in_bytes</td><td>The offset of the first element in the source image </td></tr>
646     <tr><td class="paramdir">[out]</td><td class="paramname">grad_ptr</td><td>Pointer to the gradient output. Supported data types: U16, U32 </td></tr>
647     <tr><td class="paramdir">[in]</td><td class="paramname">grad_stride_x</td><td>Stride of the source image in X dimension (in bytes) </td></tr>
648     <tr><td class="paramdir">[in]</td><td class="paramname">grad_step_x</td><td>grad_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
649     <tr><td class="paramdir">[in]</td><td class="paramname">grad_stride_y</td><td>Stride of the source image in Y dimension (in bytes) </td></tr>
650     <tr><td class="paramdir">[in]</td><td class="paramname">grad_step_y</td><td>grad_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
651     <tr><td class="paramdir">[in]</td><td class="paramname">grad_offset_first_element_in_bytes</td><td>The offset of the first element of the output </td></tr>
652     <tr><td class="paramdir">[out]</td><td class="paramname">angle_ptr</td><td>Pointer to the angle output. Supported data types: U8 </td></tr>
653     <tr><td class="paramdir">[in]</td><td class="paramname">angle_stride_x</td><td>Stride of the source image in X dimension (in bytes) </td></tr>
654     <tr><td class="paramdir">[in]</td><td class="paramname">angle_step_x</td><td>angle_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
655     <tr><td class="paramdir">[in]</td><td class="paramname">angle_stride_y</td><td>Stride of the source image in Y dimension (in bytes) </td></tr>
656     <tr><td class="paramdir">[in]</td><td class="paramname">angle_step_y</td><td>angle_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
657     <tr><td class="paramdir">[in]</td><td class="paramname">angle_offset_first_element_in_bytes</td><td>The offset of the first element of the output </td></tr>
658   </table>
659   </dd>
660 </dl>
661
662 <p>Definition at line <a class="el" href="canny_8cl_source.xhtml#l00121">121</a> of file <a class="el" href="canny_8cl_source.xhtml">canny.cl</a>.</p>
663
664 <p>References <a class="el" href="helpers_8h_source.xhtml#l00041">CONVERT_SAT_ROUND</a>, <a class="el" href="helpers_8h_source.xhtml#l00073">CONVERT_TO_IMAGE_STRUCT</a>, <a class="el" href="convolution3x3_8cl_source.xhtml#l00031">DATA_TYPE_OUT</a>, <a class="el" href="helpers_8h_source.xhtml#l00097">Image::ptr</a>, and <a class="el" href="helpers_8h_source.xhtml#l00032">VEC_DATA_TYPE</a>.</p>
665 <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;    <span class="comment">// Construct images</span></div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;    <a class="code" href="struct_image.xhtml">Image</a> src1  = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(src1);</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;    <a class="code" href="struct_image.xhtml">Image</a> src2  = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(src2);</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;    <a class="code" href="struct_image.xhtml">Image</a> grad  = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(grad);</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;    <a class="code" href="struct_image.xhtml">Image</a> angle = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(angle);</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;    <span class="comment">// Load sobel horizontal and vertical values</span></div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;    float4 h = convert_float4(vload4(0, (__global DATA_TYPE_IN *)src1.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>));</div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;    float4 v = convert_float4(vload4(0, (__global DATA_TYPE_IN *)src2.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>));</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;</div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;    <span class="comment">/* Calculate the gradient, using level 2 normalisation method */</span></div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;    float4 m = sqrt(h * h + v * v);</div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;    <span class="comment">/* Calculate the angle */</span></div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;    float4 p = atan2pi(v, h);</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;    <span class="comment">/* Remap angle to range [0, 256) */</span></div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;    p = select(p, p + 2, p &lt; 0.0f) * 128.0f;</div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;    <span class="comment">/* Store results */</span></div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;    vstore4(<a class="code" href="helpers_8h.xhtml#a28b2b123792a5b11a32cb05a6d327437">CONVERT_SAT_ROUND</a>(m, <a class="code" href="helpers_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(<a class="code" href="convolution3x3_8cl.xhtml#ac06f3e24d3fffd3c465d8b2a6e7c985e">DATA_TYPE_OUT</a>, 4), rte), 0, (__global <a class="code" href="convolution3x3_8cl.xhtml#ac06f3e24d3fffd3c465d8b2a6e7c985e">DATA_TYPE_OUT</a> *)grad.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>);</div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;    vstore4(convert_uchar4_sat_rte(p), 0, angle.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>);</div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;}</div><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#l00073">helpers.h:73</a></div></div>
666 <div class="ttc" id="helpers_8h_xhtml_a36f754c05b6fddf6df0d8d0a74f8159f"><div class="ttname"><a href="helpers_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a></div><div class="ttdeci">#define VEC_DATA_TYPE(type, size)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00032">helpers.h:32</a></div></div>
667 <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#l00095">helpers.h:95</a></div></div>
668 <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#l00097">helpers.h:97</a></div></div>
669 <div class="ttc" id="helpers_8h_xhtml_a28b2b123792a5b11a32cb05a6d327437"><div class="ttname"><a href="helpers_8h.xhtml#a28b2b123792a5b11a32cb05a6d327437">CONVERT_SAT_ROUND</a></div><div class="ttdeci">#define CONVERT_SAT_ROUND(x, type, round)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00041">helpers.h:41</a></div></div>
670 <div class="ttc" id="convolution3x3_8cl_xhtml_ac06f3e24d3fffd3c465d8b2a6e7c985e"><div class="ttname"><a href="convolution3x3_8cl.xhtml#ac06f3e24d3fffd3c465d8b2a6e7c985e">DATA_TYPE_OUT</a></div><div class="ttdeci">#define DATA_TYPE_OUT</div><div class="ttdef"><b>Definition:</b> <a href="convolution3x3_8cl_source.xhtml#l00031">convolution3x3.cl:31</a></div></div>
671 </div><!-- fragment -->
672 </div>
673 </div>
674 <a class="anchor" id="acd62ae1c9f3d7a1c7e49499d308d1904"></a>
675 <div class="memitem">
676 <div class="memproto">
677       <table class="memname">
678         <tr>
679           <td class="memname">kernel void hysteresis </td>
680           <td>(</td>
681           <td class="paramtype">__global uchar *&#160;</td>
682           <td class="paramname"><em>src_ptr</em>, </td>
683         </tr>
684         <tr>
685           <td class="paramkey"></td>
686           <td></td>
687           <td class="paramtype">uint&#160;</td>
688           <td class="paramname"><em>src_stride_x</em>, </td>
689         </tr>
690         <tr>
691           <td class="paramkey"></td>
692           <td></td>
693           <td class="paramtype">uint&#160;</td>
694           <td class="paramname"><em>src_step_x</em>, </td>
695         </tr>
696         <tr>
697           <td class="paramkey"></td>
698           <td></td>
699           <td class="paramtype">uint&#160;</td>
700           <td class="paramname"><em>src_stride_y</em>, </td>
701         </tr>
702         <tr>
703           <td class="paramkey"></td>
704           <td></td>
705           <td class="paramtype">uint&#160;</td>
706           <td class="paramname"><em>src_step_y</em>, </td>
707         </tr>
708         <tr>
709           <td class="paramkey"></td>
710           <td></td>
711           <td class="paramtype">uint&#160;</td>
712           <td class="paramname"><em>src_offset_first_element_in_bytes</em>, </td>
713         </tr>
714         <tr>
715           <td class="paramkey"></td>
716           <td></td>
717           <td class="paramtype">__global uchar *&#160;</td>
718           <td class="paramname"><em>out_ptr</em>, </td>
719         </tr>
720         <tr>
721           <td class="paramkey"></td>
722           <td></td>
723           <td class="paramtype">uint&#160;</td>
724           <td class="paramname"><em>out_stride_x</em>, </td>
725         </tr>
726         <tr>
727           <td class="paramkey"></td>
728           <td></td>
729           <td class="paramtype">uint&#160;</td>
730           <td class="paramname"><em>out_step_x</em>, </td>
731         </tr>
732         <tr>
733           <td class="paramkey"></td>
734           <td></td>
735           <td class="paramtype">uint&#160;</td>
736           <td class="paramname"><em>out_stride_y</em>, </td>
737         </tr>
738         <tr>
739           <td class="paramkey"></td>
740           <td></td>
741           <td class="paramtype">uint&#160;</td>
742           <td class="paramname"><em>out_step_y</em>, </td>
743         </tr>
744         <tr>
745           <td class="paramkey"></td>
746           <td></td>
747           <td class="paramtype">uint&#160;</td>
748           <td class="paramname"><em>out_offset_first_element_in_bytes</em>, </td>
749         </tr>
750         <tr>
751           <td class="paramkey"></td>
752           <td></td>
753           <td class="paramtype">__global uchar *&#160;</td>
754           <td class="paramname"><em>visited_ptr</em>, </td>
755         </tr>
756         <tr>
757           <td class="paramkey"></td>
758           <td></td>
759           <td class="paramtype">uint&#160;</td>
760           <td class="paramname"><em>visited_stride_x</em>, </td>
761         </tr>
762         <tr>
763           <td class="paramkey"></td>
764           <td></td>
765           <td class="paramtype">uint&#160;</td>
766           <td class="paramname"><em>visited_step_x</em>, </td>
767         </tr>
768         <tr>
769           <td class="paramkey"></td>
770           <td></td>
771           <td class="paramtype">uint&#160;</td>
772           <td class="paramname"><em>visited_stride_y</em>, </td>
773         </tr>
774         <tr>
775           <td class="paramkey"></td>
776           <td></td>
777           <td class="paramtype">uint&#160;</td>
778           <td class="paramname"><em>visited_step_y</em>, </td>
779         </tr>
780         <tr>
781           <td class="paramkey"></td>
782           <td></td>
783           <td class="paramtype">uint&#160;</td>
784           <td class="paramname"><em>visited_offset_first_element_in_bytes</em>, </td>
785         </tr>
786         <tr>
787           <td class="paramkey"></td>
788           <td></td>
789           <td class="paramtype">__global uchar *&#160;</td>
790           <td class="paramname"><em>recorded_ptr</em>, </td>
791         </tr>
792         <tr>
793           <td class="paramkey"></td>
794           <td></td>
795           <td class="paramtype">uint&#160;</td>
796           <td class="paramname"><em>recorded_stride_x</em>, </td>
797         </tr>
798         <tr>
799           <td class="paramkey"></td>
800           <td></td>
801           <td class="paramtype">uint&#160;</td>
802           <td class="paramname"><em>recorded_step_x</em>, </td>
803         </tr>
804         <tr>
805           <td class="paramkey"></td>
806           <td></td>
807           <td class="paramtype">uint&#160;</td>
808           <td class="paramname"><em>recorded_stride_y</em>, </td>
809         </tr>
810         <tr>
811           <td class="paramkey"></td>
812           <td></td>
813           <td class="paramtype">uint&#160;</td>
814           <td class="paramname"><em>recorded_step_y</em>, </td>
815         </tr>
816         <tr>
817           <td class="paramkey"></td>
818           <td></td>
819           <td class="paramtype">uint&#160;</td>
820           <td class="paramname"><em>recorded_offset_first_element_in_bytes</em>, </td>
821         </tr>
822         <tr>
823           <td class="paramkey"></td>
824           <td></td>
825           <td class="paramtype">__global uchar *&#160;</td>
826           <td class="paramname"><em>l1_stack_ptr</em>, </td>
827         </tr>
828         <tr>
829           <td class="paramkey"></td>
830           <td></td>
831           <td class="paramtype">uint&#160;</td>
832           <td class="paramname"><em>l1_stack_stride_x</em>, </td>
833         </tr>
834         <tr>
835           <td class="paramkey"></td>
836           <td></td>
837           <td class="paramtype">uint&#160;</td>
838           <td class="paramname"><em>l1_stack_step_x</em>, </td>
839         </tr>
840         <tr>
841           <td class="paramkey"></td>
842           <td></td>
843           <td class="paramtype">uint&#160;</td>
844           <td class="paramname"><em>l1_stack_stride_y</em>, </td>
845         </tr>
846         <tr>
847           <td class="paramkey"></td>
848           <td></td>
849           <td class="paramtype">uint&#160;</td>
850           <td class="paramname"><em>l1_stack_step_y</em>, </td>
851         </tr>
852         <tr>
853           <td class="paramkey"></td>
854           <td></td>
855           <td class="paramtype">uint&#160;</td>
856           <td class="paramname"><em>l1_stack_offset_first_element_in_bytes</em>, </td>
857         </tr>
858         <tr>
859           <td class="paramkey"></td>
860           <td></td>
861           <td class="paramtype">__global uchar *&#160;</td>
862           <td class="paramname"><em>l1_stack_counter_ptr</em>, </td>
863         </tr>
864         <tr>
865           <td class="paramkey"></td>
866           <td></td>
867           <td class="paramtype">uint&#160;</td>
868           <td class="paramname"><em>l1_stack_counter_stride_x</em>, </td>
869         </tr>
870         <tr>
871           <td class="paramkey"></td>
872           <td></td>
873           <td class="paramtype">uint&#160;</td>
874           <td class="paramname"><em>l1_stack_counter_step_x</em>, </td>
875         </tr>
876         <tr>
877           <td class="paramkey"></td>
878           <td></td>
879           <td class="paramtype">uint&#160;</td>
880           <td class="paramname"><em>l1_stack_counter_stride_y</em>, </td>
881         </tr>
882         <tr>
883           <td class="paramkey"></td>
884           <td></td>
885           <td class="paramtype">uint&#160;</td>
886           <td class="paramname"><em>l1_stack_counter_step_y</em>, </td>
887         </tr>
888         <tr>
889           <td class="paramkey"></td>
890           <td></td>
891           <td class="paramtype">uint&#160;</td>
892           <td class="paramname"><em>l1_stack_counter_offset_first_element_in_bytes</em>, </td>
893         </tr>
894         <tr>
895           <td class="paramkey"></td>
896           <td></td>
897           <td class="paramtype">uint&#160;</td>
898           <td class="paramname"><em>low_thr</em>, </td>
899         </tr>
900         <tr>
901           <td class="paramkey"></td>
902           <td></td>
903           <td class="paramtype">uint&#160;</td>
904           <td class="paramname"><em>up_thr</em>, </td>
905         </tr>
906         <tr>
907           <td class="paramkey"></td>
908           <td></td>
909           <td class="paramtype">int&#160;</td>
910           <td class="paramname"><em>width</em>, </td>
911         </tr>
912         <tr>
913           <td class="paramkey"></td>
914           <td></td>
915           <td class="paramtype">int&#160;</td>
916           <td class="paramname"><em>height</em>&#160;</td>
917         </tr>
918         <tr>
919           <td></td>
920           <td>)</td>
921           <td></td><td></td>
922         </tr>
923       </table>
924 </div><div class="memdoc">
925
926 <p>Perform hysteresis. </p>
927 <dl class="section attention"><dt>Attention</dt><dd>The input data_type needs to be passed at compile time using -DDATA_TYPE_IN: e.g. -DDATA_TYPE_IN=short</dd></dl>
928 <dl class="params"><dt>Parameters</dt><dd>
929   <table class="params">
930     <tr><td class="paramdir">[in]</td><td class="paramname">src_ptr</td><td>Pointer to the input image. Supported data types: U8 </td></tr>
931     <tr><td class="paramdir">[in]</td><td class="paramname">src_stride_x</td><td>Stride of the source image in X dimension (in bytes) </td></tr>
932     <tr><td class="paramdir">[in]</td><td class="paramname">src_step_x</td><td>src_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
933     <tr><td class="paramdir">[in]</td><td class="paramname">src_stride_y</td><td>Stride of the source image in Y dimension (in bytes) </td></tr>
934     <tr><td class="paramdir">[in]</td><td class="paramname">src_step_y</td><td>src_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
935     <tr><td class="paramdir">[in]</td><td class="paramname">src_offset_first_element_in_bytes</td><td>The offset of the first element of the output </td></tr>
936     <tr><td class="paramdir">[out]</td><td class="paramname">out_ptr</td><td>Pointer to the output image. Supported data types: U8 </td></tr>
937     <tr><td class="paramdir">[in]</td><td class="paramname">out_stride_x</td><td>Stride of the source image in X dimension (in bytes) </td></tr>
938     <tr><td class="paramdir">[in]</td><td class="paramname">out_step_x</td><td>out_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
939     <tr><td class="paramdir">[in]</td><td class="paramname">out_stride_y</td><td>Stride of the source image in Y dimension (in bytes) </td></tr>
940     <tr><td class="paramdir">[in]</td><td class="paramname">out_step_y</td><td>out_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
941     <tr><td class="paramdir">[in]</td><td class="paramname">out_offset_first_element_in_bytes</td><td>The offset of the first element of the output </td></tr>
942     <tr><td class="paramdir">[out]</td><td class="paramname">visited_ptr</td><td>Pointer to the visited buffer, where pixels are marked as visited. Supported data types: U32 </td></tr>
943     <tr><td class="paramdir">[in]</td><td class="paramname">visited_stride_x</td><td>Stride of the source image in X dimension (in bytes) </td></tr>
944     <tr><td class="paramdir">[in]</td><td class="paramname">visited_step_x</td><td>visited_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
945     <tr><td class="paramdir">[in]</td><td class="paramname">visited_stride_y</td><td>Stride of the source image in Y dimension (in bytes) </td></tr>
946     <tr><td class="paramdir">[in]</td><td class="paramname">visited_step_y</td><td>visited_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
947     <tr><td class="paramdir">[in]</td><td class="paramname">visited_offset_first_element_in_bytes</td><td>The offset of the first element of the output </td></tr>
948     <tr><td class="paramdir">[out]</td><td class="paramname">recorded_ptr</td><td>Pointer to the recorded buffer, where pixels are marked as recorded. Supported data types: U32 </td></tr>
949     <tr><td class="paramdir">[in]</td><td class="paramname">recorded_stride_x</td><td>Stride of the source image in X dimension (in bytes) </td></tr>
950     <tr><td class="paramdir">[in]</td><td class="paramname">recorded_step_x</td><td>recorded_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
951     <tr><td class="paramdir">[in]</td><td class="paramname">recorded_stride_y</td><td>Stride of the source image in Y dimension (in bytes) </td></tr>
952     <tr><td class="paramdir">[in]</td><td class="paramname">recorded_step_y</td><td>recorded_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
953     <tr><td class="paramdir">[in]</td><td class="paramname">recorded_offset_first_element_in_bytes</td><td>The offset of the first element of the output </td></tr>
954     <tr><td class="paramdir">[out]</td><td class="paramname">l1_stack_ptr</td><td>Pointer to the l1 stack of a pixel. Supported data types: S32 </td></tr>
955     <tr><td class="paramdir">[in]</td><td class="paramname">l1_stack_stride_x</td><td>Stride of the source image in X dimension (in bytes) </td></tr>
956     <tr><td class="paramdir">[in]</td><td class="paramname">l1_stack_step_x</td><td>l1_stack_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
957     <tr><td class="paramdir">[in]</td><td class="paramname">l1_stack_stride_y</td><td>Stride of the source image in Y dimension (in bytes) </td></tr>
958     <tr><td class="paramdir">[in]</td><td class="paramname">l1_stack_step_y</td><td>l1_stack_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
959     <tr><td class="paramdir">[in]</td><td class="paramname">l1_stack_offset_first_element_in_bytes</td><td>The offset of the first element of the output </td></tr>
960     <tr><td class="paramdir">[out]</td><td class="paramname">l1_stack_counter_ptr</td><td>Pointer to the l1 stack counters of an image. Supported data types: U8 </td></tr>
961     <tr><td class="paramdir">[in]</td><td class="paramname">l1_stack_counter_stride_x</td><td>Stride of the source image in X dimension (in bytes) </td></tr>
962     <tr><td class="paramdir">[in]</td><td class="paramname">l1_stack_counter_step_x</td><td>l1_stack_counter_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
963     <tr><td class="paramdir">[in]</td><td class="paramname">l1_stack_counter_stride_y</td><td>Stride of the source image in Y dimension (in bytes) </td></tr>
964     <tr><td class="paramdir">[in]</td><td class="paramname">l1_stack_counter_step_y</td><td>l1_stack_counter_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
965     <tr><td class="paramdir">[in]</td><td class="paramname">l1_stack_counter_offset_first_element_in_bytes</td><td>The offset of the first element of the output </td></tr>
966     <tr><td class="paramdir">[in]</td><td class="paramname">low_thr</td><td>The lower threshold </td></tr>
967     <tr><td class="paramdir">[in]</td><td class="paramname">up_thr</td><td>The upper threshold </td></tr>
968     <tr><td class="paramdir">[in]</td><td class="paramname">width</td><td>The width of the image. </td></tr>
969     <tr><td class="paramdir">[in]</td><td class="paramname">height</td><td>The height of the image </td></tr>
970   </table>
971   </dd>
972 </dl>
973
974 <p>Definition at line <a class="el" href="canny_8cl_source.xhtml#l00306">306</a> of file <a class="el" href="canny_8cl_source.xhtml">canny.cl</a>.</p>
975
976 <p>References <a class="el" href="canny_8cl_source.xhtml#l00242">check_pixel</a>, <a class="el" href="helpers_8h_source.xhtml#l00076">CONVERT_TO_IMAGE_STRUCT_NO_STEP</a>, <a class="el" href="canny_8cl_source.xhtml#l00227">EDGE</a>, <a class="el" href="canny_8cl_source.xhtml#l00228">hysteresis_local_stack_L1</a>, <a class="el" href="canny_8cl_source.xhtml#l00229">hysteresis_local_stack_L2</a>, <a class="el" href="helpers_8h_source.xhtml#l00201">offset()</a>, <a class="el" href="helpers_8h_source.xhtml#l00097">Image::ptr</a>, <a class="el" href="helpers_8h_source.xhtml#l00099">Image::stride_x</a>, <a class="el" href="helpers_8h_source.xhtml#l00100">Image::stride_y</a>, and <a class="el" href="helpers_8h_source.xhtml#l00032">VEC_DATA_TYPE</a>.</p>
977 <div class="fragment"><div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;{</div><div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;    <span class="comment">// Create images</span></div><div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;    <a class="code" href="struct_image.xhtml">Image</a> src              = <a class="code" href="helpers_8h.xhtml#a4334a4a76f8e9628c0fb9e1acf616e2a">CONVERT_TO_IMAGE_STRUCT_NO_STEP</a>(src);</div><div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;    <a class="code" href="struct_image.xhtml">Image</a> out              = <a class="code" href="helpers_8h.xhtml#a4334a4a76f8e9628c0fb9e1acf616e2a">CONVERT_TO_IMAGE_STRUCT_NO_STEP</a>(out);</div><div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;    <a class="code" href="struct_image.xhtml">Image</a> visited          = <a class="code" href="helpers_8h.xhtml#a4334a4a76f8e9628c0fb9e1acf616e2a">CONVERT_TO_IMAGE_STRUCT_NO_STEP</a>(visited);</div><div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;    <a class="code" href="struct_image.xhtml">Image</a> recorded         = <a class="code" href="helpers_8h.xhtml#a4334a4a76f8e9628c0fb9e1acf616e2a">CONVERT_TO_IMAGE_STRUCT_NO_STEP</a>(recorded);</div><div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;    <a class="code" href="struct_image.xhtml">Image</a> l1_stack         = <a class="code" href="helpers_8h.xhtml#a4334a4a76f8e9628c0fb9e1acf616e2a">CONVERT_TO_IMAGE_STRUCT_NO_STEP</a>(l1_stack);</div><div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;    <a class="code" href="struct_image.xhtml">Image</a> l1_stack_counter = <a class="code" href="helpers_8h.xhtml#a4334a4a76f8e9628c0fb9e1acf616e2a">CONVERT_TO_IMAGE_STRUCT_NO_STEP</a>(l1_stack_counter);</div><div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;</div><div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;    <span class="comment">// Index</span></div><div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;    <span class="keywordtype">int</span> x = get_global_id(0);</div><div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;    <span class="keywordtype">int</span> y = get_global_id(1);</div><div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;</div><div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160;    <span class="comment">// Load value</span></div><div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160;    DATA_TYPE_IN val = *((__global DATA_TYPE_IN *)<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;src, x, y));</div><div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;</div><div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;    <span class="comment">// If less than upper threshold set to NO_EDGE and return</span></div><div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;    <span class="keywordflow">if</span>(val &lt;= up_thr)</div><div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;    {</div><div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;        *<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;out, x, y) = 0;</div><div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;        <span class="keywordflow">return</span>;</div><div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;    }</div><div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160;</div><div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160;    <span class="comment">// Init local stack 2</span></div><div class="line"><a name="l00341"></a><span class="lineno">  341</span>&#160;    short2 stack_L2[<a class="code" href="canny_8cl.xhtml#aa55093fb165fb76898efb3ba80f62bae">hysteresis_local_stack_L2</a>] = { 0 };</div><div class="line"><a name="l00342"></a><span class="lineno">  342</span>&#160;    <span class="keywordtype">int</span>    L2_counter                          = 0;</div><div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160;</div><div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;    <span class="comment">// Perform recursive hysteresis</span></div><div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;    <span class="keywordflow">while</span>(<span class="keyword">true</span>)</div><div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;    {</div><div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160;        <span class="comment">// Get L1 stack pointer</span></div><div class="line"><a name="l00348"></a><span class="lineno">  348</span>&#160;        __global short2 *l1_ptr = (__global short2 *)(l1_stack.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a> + y * l1_stack.<a class="code" href="struct_image.xhtml#a4f0b90c9ecd6e57ceb3f37332fefe8f1">stride_y</a> + x * <a class="code" href="canny_8cl.xhtml#a242e5ec23ae26cd2dfa5eab5ae68a0f1">hysteresis_local_stack_L1</a> * l1_stack.<a class="code" href="struct_image.xhtml#ae01febbfd0689ef709f3ff6fdd2abc7e">stride_x</a>);</div><div class="line"><a name="l00349"></a><span class="lineno">  349</span>&#160;</div><div class="line"><a name="l00350"></a><span class="lineno">  350</span>&#160;        <span class="comment">// If the pixel has already been visited, proceed with the items in the stack instead</span></div><div class="line"><a name="l00351"></a><span class="lineno">  351</span>&#160;        <span class="keywordflow">if</span>(atomic_or((__global uint *)<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;visited, x, y), 1) != 0)</div><div class="line"><a name="l00352"></a><span class="lineno">  352</span>&#160;        {</div><div class="line"><a name="l00353"></a><span class="lineno">  353</span>&#160;            <span class="keywordflow">goto</span> pop_stack;</div><div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160;        }</div><div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160;</div><div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160;        <span class="comment">// Set strong edge</span></div><div class="line"><a name="l00357"></a><span class="lineno">  357</span>&#160;        *<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;out, x, y) = <a class="code" href="canny_8cl.xhtml#ac243bfa96aa2c28014159ff098bd2324">EDGE</a>;</div><div class="line"><a name="l00358"></a><span class="lineno">  358</span>&#160;</div><div class="line"><a name="l00359"></a><span class="lineno">  359</span>&#160;        <span class="comment">// If it is the top of stack l2, we don&#39;t need check the surrounding pixels</span></div><div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160;        <span class="keywordflow">if</span>(L2_counter &gt; (<a class="code" href="canny_8cl.xhtml#aa55093fb165fb76898efb3ba80f62bae">hysteresis_local_stack_L2</a> - 1))</div><div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;        {</div><div class="line"><a name="l00362"></a><span class="lineno">  362</span>&#160;            <span class="keywordflow">goto</span> pop_stack2;</div><div class="line"><a name="l00363"></a><span class="lineno">  363</span>&#160;        }</div><div class="line"><a name="l00364"></a><span class="lineno">  364</span>&#160;</div><div class="line"><a name="l00365"></a><span class="lineno">  365</span>&#160;        <span class="comment">// Points to the start of the local stack;</span></div><div class="line"><a name="l00366"></a><span class="lineno">  366</span>&#160;        <span class="keywordtype">char</span> c;</div><div class="line"><a name="l00367"></a><span class="lineno">  367</span>&#160;</div><div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160;        <a class="code" href="helpers_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a>(DATA_TYPE_IN, 4)</div><div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160;        x_tmp;</div><div class="line"><a name="l00370"></a><span class="lineno">  370</span>&#160;        uint4 v_tmp;</div><div class="line"><a name="l00371"></a><span class="lineno">  371</span>&#160;</div><div class="line"><a name="l00372"></a><span class="lineno">  372</span>&#160;        <span class="comment">// Get direction pixel indices</span></div><div class="line"><a name="l00373"></a><span class="lineno">  373</span>&#160;        <span class="keywordtype">int</span> N = max(y - 1, 0), S = min(y + 1, height - 2), W = max(x - 1, 0), E = min(x + 1, width - 2);</div><div class="line"><a name="l00374"></a><span class="lineno">  374</span>&#160;</div><div class="line"><a name="l00375"></a><span class="lineno">  375</span>&#160;        <span class="comment">// Check 8 pixels around for week edges where low_thr &lt; val &lt;= up_thr</span></div><div class="line"><a name="l00376"></a><span class="lineno">  376</span>&#160;        x_tmp = vload4(0, (__global DATA_TYPE_IN *)<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;src, W, N));</div><div class="line"><a name="l00377"></a><span class="lineno">  377</span>&#160;        v_tmp = vload4(0, (__global uint *)<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;visited, W, N));</div><div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;        <a class="code" href="canny_8cl.xhtml#a64ee229d1bcee88c8017356d5d485650">check_pixel</a>(((x_tmp.s0 &lt;= low_thr) || v_tmp.s0 || (x_tmp.s0 &gt; up_thr)), W, N, x, y); <span class="comment">// NW</span></div><div class="line"><a name="l00379"></a><span class="lineno">  379</span>&#160;        <a class="code" href="canny_8cl.xhtml#a64ee229d1bcee88c8017356d5d485650">check_pixel</a>(((x_tmp.s1 &lt;= low_thr) || v_tmp.s1 || (x_tmp.s1 &gt; up_thr)), x, N, x, y); <span class="comment">// N</span></div><div class="line"><a name="l00380"></a><span class="lineno">  380</span>&#160;        <a class="code" href="canny_8cl.xhtml#a64ee229d1bcee88c8017356d5d485650">check_pixel</a>(((x_tmp.s2 &lt;= low_thr) || v_tmp.s2 || (x_tmp.s2 &gt; up_thr)), E, N, x, y); <span class="comment">// NE</span></div><div class="line"><a name="l00381"></a><span class="lineno">  381</span>&#160;</div><div class="line"><a name="l00382"></a><span class="lineno">  382</span>&#160;        x_tmp = vload4(0, (__global DATA_TYPE_IN *)<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;src, W, y));</div><div class="line"><a name="l00383"></a><span class="lineno">  383</span>&#160;        v_tmp = vload4(0, (__global uint *)<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;visited, W, y));</div><div class="line"><a name="l00384"></a><span class="lineno">  384</span>&#160;        <a class="code" href="canny_8cl.xhtml#a64ee229d1bcee88c8017356d5d485650">check_pixel</a>(((x_tmp.s0 &lt;= low_thr) || v_tmp.s0 || (x_tmp.s0 &gt; up_thr)), W, y, x, y); <span class="comment">// W</span></div><div class="line"><a name="l00385"></a><span class="lineno">  385</span>&#160;        <a class="code" href="canny_8cl.xhtml#a64ee229d1bcee88c8017356d5d485650">check_pixel</a>(((x_tmp.s2 &lt;= low_thr) || v_tmp.s2 || (x_tmp.s2 &gt; up_thr)), E, y, x, y); <span class="comment">// E</span></div><div class="line"><a name="l00386"></a><span class="lineno">  386</span>&#160;</div><div class="line"><a name="l00387"></a><span class="lineno">  387</span>&#160;        x_tmp = vload4(0, (__global DATA_TYPE_IN *)<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;src, W, S));</div><div class="line"><a name="l00388"></a><span class="lineno">  388</span>&#160;        v_tmp = vload4(0, (__global uint *)<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;visited, W, S));</div><div class="line"><a name="l00389"></a><span class="lineno">  389</span>&#160;        <a class="code" href="canny_8cl.xhtml#a64ee229d1bcee88c8017356d5d485650">check_pixel</a>(((x_tmp.s0 &lt;= low_thr) || v_tmp.s0 || (x_tmp.s0 &gt; up_thr)), W, S, x, y); <span class="comment">// SW</span></div><div class="line"><a name="l00390"></a><span class="lineno">  390</span>&#160;        <a class="code" href="canny_8cl.xhtml#a64ee229d1bcee88c8017356d5d485650">check_pixel</a>(((x_tmp.s1 &lt;= low_thr) || v_tmp.s1 || (x_tmp.s1 &gt; up_thr)), x, S, x, y); <span class="comment">// S</span></div><div class="line"><a name="l00391"></a><span class="lineno">  391</span>&#160;        <a class="code" href="canny_8cl.xhtml#a64ee229d1bcee88c8017356d5d485650">check_pixel</a>(((x_tmp.s2 &lt;= low_thr) || v_tmp.s2 || (x_tmp.s2 &gt; up_thr)), E, S, x, y); <span class="comment">// SE</span></div><div class="line"><a name="l00392"></a><span class="lineno">  392</span>&#160;</div><div class="line"><a name="l00393"></a><span class="lineno">  393</span>&#160;<span class="preprocessor">#undef check_pixel</span></div><div class="line"><a name="l00394"></a><span class="lineno">  394</span>&#160;</div><div class="line"><a name="l00395"></a><span class="lineno">  395</span>&#160;pop_stack:</div><div class="line"><a name="l00396"></a><span class="lineno">  396</span>&#160;        c = *((__global <span class="keywordtype">char</span> *)<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;l1_stack_counter, x, y));</div><div class="line"><a name="l00397"></a><span class="lineno">  397</span>&#160;</div><div class="line"><a name="l00398"></a><span class="lineno">  398</span>&#160;        <span class="keywordflow">if</span>(c &gt;= 1)</div><div class="line"><a name="l00399"></a><span class="lineno">  399</span>&#160;        {</div><div class="line"><a name="l00400"></a><span class="lineno">  400</span>&#160;            *((__global <span class="keywordtype">char</span> *)<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;l1_stack_counter, x, y)) -= 1;</div><div class="line"><a name="l00401"></a><span class="lineno">  401</span>&#160;            int2 l_c = convert_int2(l1_ptr[c - 1]);</div><div class="line"><a name="l00402"></a><span class="lineno">  402</span>&#160;</div><div class="line"><a name="l00403"></a><span class="lineno">  403</span>&#160;            <span class="comment">// Push the current position into level 2 stack</span></div><div class="line"><a name="l00404"></a><span class="lineno">  404</span>&#160;            stack_L2[L2_counter].x = x;</div><div class="line"><a name="l00405"></a><span class="lineno">  405</span>&#160;            stack_L2[L2_counter].y = y;</div><div class="line"><a name="l00406"></a><span class="lineno">  406</span>&#160;</div><div class="line"><a name="l00407"></a><span class="lineno">  407</span>&#160;            x = l_c.x;</div><div class="line"><a name="l00408"></a><span class="lineno">  408</span>&#160;            y = l_c.y;</div><div class="line"><a name="l00409"></a><span class="lineno">  409</span>&#160;</div><div class="line"><a name="l00410"></a><span class="lineno">  410</span>&#160;            L2_counter++;</div><div class="line"><a name="l00411"></a><span class="lineno">  411</span>&#160;</div><div class="line"><a name="l00412"></a><span class="lineno">  412</span>&#160;            <span class="keywordflow">continue</span>;</div><div class="line"><a name="l00413"></a><span class="lineno">  413</span>&#160;        }</div><div class="line"><a name="l00414"></a><span class="lineno">  414</span>&#160;</div><div class="line"><a name="l00415"></a><span class="lineno">  415</span>&#160;        <span class="keywordflow">if</span>(L2_counter &gt; 0)</div><div class="line"><a name="l00416"></a><span class="lineno">  416</span>&#160;        {</div><div class="line"><a name="l00417"></a><span class="lineno">  417</span>&#160;            <span class="keywordflow">goto</span> pop_stack2;</div><div class="line"><a name="l00418"></a><span class="lineno">  418</span>&#160;        }</div><div class="line"><a name="l00419"></a><span class="lineno">  419</span>&#160;        <span class="keywordflow">else</span></div><div class="line"><a name="l00420"></a><span class="lineno">  420</span>&#160;        {</div><div class="line"><a name="l00421"></a><span class="lineno">  421</span>&#160;            <span class="keywordflow">return</span>;</div><div class="line"><a name="l00422"></a><span class="lineno">  422</span>&#160;        }</div><div class="line"><a name="l00423"></a><span class="lineno">  423</span>&#160;</div><div class="line"><a name="l00424"></a><span class="lineno">  424</span>&#160;pop_stack2:</div><div class="line"><a name="l00425"></a><span class="lineno">  425</span>&#160;        L2_counter--;</div><div class="line"><a name="l00426"></a><span class="lineno">  426</span>&#160;        x = stack_L2[L2_counter].x;</div><div class="line"><a name="l00427"></a><span class="lineno">  427</span>&#160;        y = stack_L2[L2_counter].y;</div><div class="line"><a name="l00428"></a><span class="lineno">  428</span>&#160;    };</div><div class="line"><a name="l00429"></a><span class="lineno">  429</span>&#160;}</div><div class="ttc" id="canny_8cl_xhtml_a242e5ec23ae26cd2dfa5eab5ae68a0f1"><div class="ttname"><a href="canny_8cl.xhtml#a242e5ec23ae26cd2dfa5eab5ae68a0f1">hysteresis_local_stack_L1</a></div><div class="ttdeci">#define hysteresis_local_stack_L1</div><div class="ttdef"><b>Definition:</b> <a href="canny_8cl_source.xhtml#l00228">canny.cl:228</a></div></div>
978 <div class="ttc" id="helpers_8h_xhtml_a4334a4a76f8e9628c0fb9e1acf616e2a"><div class="ttname"><a href="helpers_8h.xhtml#a4334a4a76f8e9628c0fb9e1acf616e2a">CONVERT_TO_IMAGE_STRUCT_NO_STEP</a></div><div class="ttdeci">#define CONVERT_TO_IMAGE_STRUCT_NO_STEP(name)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00076">helpers.h:76</a></div></div>
979 <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#l00201">helpers.h:201</a></div></div>
980 <div class="ttc" id="helpers_8h_xhtml_a36f754c05b6fddf6df0d8d0a74f8159f"><div class="ttname"><a href="helpers_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f">VEC_DATA_TYPE</a></div><div class="ttdeci">#define VEC_DATA_TYPE(type, size)</div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00032">helpers.h:32</a></div></div>
981 <div class="ttc" id="canny_8cl_xhtml_ac243bfa96aa2c28014159ff098bd2324"><div class="ttname"><a href="canny_8cl.xhtml#ac243bfa96aa2c28014159ff098bd2324">EDGE</a></div><div class="ttdeci">#define EDGE</div><div class="ttdef"><b>Definition:</b> <a href="canny_8cl_source.xhtml#l00227">canny.cl:227</a></div></div>
982 <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#l00095">helpers.h:95</a></div></div>
983 <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#l00097">helpers.h:97</a></div></div>
984 <div class="ttc" id="canny_8cl_xhtml_a64ee229d1bcee88c8017356d5d485650"><div class="ttname"><a href="canny_8cl.xhtml#a64ee229d1bcee88c8017356d5d485650">check_pixel</a></div><div class="ttdeci">#define check_pixel(early_test, x_pos, y_pos, x_cur, y_cur)</div><div class="ttdoc">Check whether pixel is valid. </div><div class="ttdef"><b>Definition:</b> <a href="canny_8cl_source.xhtml#l00242">canny.cl:242</a></div></div>
985 <div class="ttc" id="canny_8cl_xhtml_aa55093fb165fb76898efb3ba80f62bae"><div class="ttname"><a href="canny_8cl.xhtml#aa55093fb165fb76898efb3ba80f62bae">hysteresis_local_stack_L2</a></div><div class="ttdeci">#define hysteresis_local_stack_L2</div><div class="ttdef"><b>Definition:</b> <a href="canny_8cl_source.xhtml#l00229">canny.cl:229</a></div></div>
986 <div class="ttc" id="struct_image_xhtml_a4f0b90c9ecd6e57ceb3f37332fefe8f1"><div class="ttname"><a href="struct_image.xhtml#a4f0b90c9ecd6e57ceb3f37332fefe8f1">Image::stride_y</a></div><div class="ttdeci">int stride_y</div><div class="ttdoc">Stride of the image in Y dimension (in bytes) </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00100">helpers.h:100</a></div></div>
987 <div class="ttc" id="struct_image_xhtml_ae01febbfd0689ef709f3ff6fdd2abc7e"><div class="ttname"><a href="struct_image.xhtml#ae01febbfd0689ef709f3ff6fdd2abc7e">Image::stride_x</a></div><div class="ttdeci">int stride_x</div><div class="ttdoc">Stride of the image in X dimension (in bytes) </div><div class="ttdef"><b>Definition:</b> <a href="helpers_8h_source.xhtml#l00099">helpers.h:99</a></div></div>
988 </div><!-- fragment -->
989 </div>
990 </div>
991 <a class="anchor" id="a8c233c75ee1010bcec8601d559f4be68"></a>
992 <div class="memitem">
993 <div class="memproto">
994       <table class="memname">
995         <tr>
996           <td class="memname">__kernel void suppress_non_maximum </td>
997           <td>(</td>
998           <td class="paramtype">__global uchar *&#160;</td>
999           <td class="paramname"><em>grad_ptr</em>, </td>
1000         </tr>
1001         <tr>
1002           <td class="paramkey"></td>
1003           <td></td>
1004           <td class="paramtype">uint&#160;</td>
1005           <td class="paramname"><em>grad_stride_x</em>, </td>
1006         </tr>
1007         <tr>
1008           <td class="paramkey"></td>
1009           <td></td>
1010           <td class="paramtype">uint&#160;</td>
1011           <td class="paramname"><em>grad_step_x</em>, </td>
1012         </tr>
1013         <tr>
1014           <td class="paramkey"></td>
1015           <td></td>
1016           <td class="paramtype">uint&#160;</td>
1017           <td class="paramname"><em>grad_stride_y</em>, </td>
1018         </tr>
1019         <tr>
1020           <td class="paramkey"></td>
1021           <td></td>
1022           <td class="paramtype">uint&#160;</td>
1023           <td class="paramname"><em>grad_step_y</em>, </td>
1024         </tr>
1025         <tr>
1026           <td class="paramkey"></td>
1027           <td></td>
1028           <td class="paramtype">uint&#160;</td>
1029           <td class="paramname"><em>grad_offset_first_element_in_bytes</em>, </td>
1030         </tr>
1031         <tr>
1032           <td class="paramkey"></td>
1033           <td></td>
1034           <td class="paramtype">__global uchar *&#160;</td>
1035           <td class="paramname"><em>angle_ptr</em>, </td>
1036         </tr>
1037         <tr>
1038           <td class="paramkey"></td>
1039           <td></td>
1040           <td class="paramtype">uint&#160;</td>
1041           <td class="paramname"><em>angle_stride_x</em>, </td>
1042         </tr>
1043         <tr>
1044           <td class="paramkey"></td>
1045           <td></td>
1046           <td class="paramtype">uint&#160;</td>
1047           <td class="paramname"><em>angle_step_x</em>, </td>
1048         </tr>
1049         <tr>
1050           <td class="paramkey"></td>
1051           <td></td>
1052           <td class="paramtype">uint&#160;</td>
1053           <td class="paramname"><em>angle_stride_y</em>, </td>
1054         </tr>
1055         <tr>
1056           <td class="paramkey"></td>
1057           <td></td>
1058           <td class="paramtype">uint&#160;</td>
1059           <td class="paramname"><em>angle_step_y</em>, </td>
1060         </tr>
1061         <tr>
1062           <td class="paramkey"></td>
1063           <td></td>
1064           <td class="paramtype">uint&#160;</td>
1065           <td class="paramname"><em>angle_offset_first_element_in_bytes</em>, </td>
1066         </tr>
1067         <tr>
1068           <td class="paramkey"></td>
1069           <td></td>
1070           <td class="paramtype">__global uchar *&#160;</td>
1071           <td class="paramname"><em>non_max_ptr</em>, </td>
1072         </tr>
1073         <tr>
1074           <td class="paramkey"></td>
1075           <td></td>
1076           <td class="paramtype">uint&#160;</td>
1077           <td class="paramname"><em>non_max_stride_x</em>, </td>
1078         </tr>
1079         <tr>
1080           <td class="paramkey"></td>
1081           <td></td>
1082           <td class="paramtype">uint&#160;</td>
1083           <td class="paramname"><em>non_max_step_x</em>, </td>
1084         </tr>
1085         <tr>
1086           <td class="paramkey"></td>
1087           <td></td>
1088           <td class="paramtype">uint&#160;</td>
1089           <td class="paramname"><em>non_max_stride_y</em>, </td>
1090         </tr>
1091         <tr>
1092           <td class="paramkey"></td>
1093           <td></td>
1094           <td class="paramtype">uint&#160;</td>
1095           <td class="paramname"><em>non_max_step_y</em>, </td>
1096         </tr>
1097         <tr>
1098           <td class="paramkey"></td>
1099           <td></td>
1100           <td class="paramtype">uint&#160;</td>
1101           <td class="paramname"><em>non_max_offset_first_element_in_bytes</em>, </td>
1102         </tr>
1103         <tr>
1104           <td class="paramkey"></td>
1105           <td></td>
1106           <td class="paramtype">uint&#160;</td>
1107           <td class="paramname"><em>lower_thr</em>&#160;</td>
1108         </tr>
1109         <tr>
1110           <td></td>
1111           <td>)</td>
1112           <td></td><td></td>
1113         </tr>
1114       </table>
1115 </div><div class="memdoc">
1116
1117 <p>Perform non maximum suppression. </p>
1118 <dl class="section attention"><dt>Attention</dt><dd>The input and output data types need to be passed at compile time using -DDATA_TYPE_IN and -DDATA_TYPE_OUT: e.g. -DDATA_TYPE_IN=uchar -DDATA_TYPE_OUT=short</dd></dl>
1119 <dl class="params"><dt>Parameters</dt><dd>
1120   <table class="params">
1121     <tr><td class="paramdir">[in]</td><td class="paramname">grad_ptr</td><td>Pointer to the gradient output. Supported data types: S16, S32 </td></tr>
1122     <tr><td class="paramdir">[in]</td><td class="paramname">grad_stride_x</td><td>Stride of the source image in X dimension (in bytes) </td></tr>
1123     <tr><td class="paramdir">[in]</td><td class="paramname">grad_step_x</td><td>grad_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
1124     <tr><td class="paramdir">[in]</td><td class="paramname">grad_stride_y</td><td>Stride of the source image in Y dimension (in bytes) </td></tr>
1125     <tr><td class="paramdir">[in]</td><td class="paramname">grad_step_y</td><td>grad_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
1126     <tr><td class="paramdir">[in]</td><td class="paramname">grad_offset_first_element_in_bytes</td><td>The offset of the first element of the output </td></tr>
1127     <tr><td class="paramdir">[in]</td><td class="paramname">angle_ptr</td><td>Pointer to the angle output. Supported data types: U8 </td></tr>
1128     <tr><td class="paramdir">[in]</td><td class="paramname">angle_stride_x</td><td>Stride of the source image in X dimension (in bytes) </td></tr>
1129     <tr><td class="paramdir">[in]</td><td class="paramname">angle_step_x</td><td>angle_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
1130     <tr><td class="paramdir">[in]</td><td class="paramname">angle_stride_y</td><td>Stride of the source image in Y dimension (in bytes) </td></tr>
1131     <tr><td class="paramdir">[in]</td><td class="paramname">angle_step_y</td><td>angle_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
1132     <tr><td class="paramdir">[in]</td><td class="paramname">angle_offset_first_element_in_bytes</td><td>TThe offset of the first element of the output </td></tr>
1133     <tr><td class="paramdir">[out]</td><td class="paramname">non_max_ptr</td><td>Pointer to the non maximum suppressed output. Supported data types: U16, U32 </td></tr>
1134     <tr><td class="paramdir">[in]</td><td class="paramname">non_max_stride_x</td><td>Stride of the source image in X dimension (in bytes) </td></tr>
1135     <tr><td class="paramdir">[in]</td><td class="paramname">non_max_step_x</td><td>non_max_stride_x * number of elements along X processed per workitem(in bytes) </td></tr>
1136     <tr><td class="paramdir">[in]</td><td class="paramname">non_max_stride_y</td><td>Stride of the source image in Y dimension (in bytes) </td></tr>
1137     <tr><td class="paramdir">[in]</td><td class="paramname">non_max_step_y</td><td>non_max_stride_y * number of elements along Y processed per workitem(in bytes) </td></tr>
1138     <tr><td class="paramdir">[in]</td><td class="paramname">non_max_offset_first_element_in_bytes</td><td>The offset of the first element of the output </td></tr>
1139     <tr><td class="paramdir">[in]</td><td class="paramname">lower_thr</td><td>The low threshold </td></tr>
1140   </table>
1141   </dd>
1142 </dl>
1143
1144 <p>Definition at line <a class="el" href="canny_8cl_source.xhtml#l00191">191</a> of file <a class="el" href="canny_8cl_source.xhtml">canny.cl</a>.</p>
1145
1146 <p>References <a class="el" href="helpers_8h_source.xhtml#l00073">CONVERT_TO_IMAGE_STRUCT</a>, <a class="el" href="convolution3x3_8cl_source.xhtml#l00031">DATA_TYPE_OUT</a>, <a class="el" href="helpers_8h_source.xhtml#l00201">offset()</a>, and <a class="el" href="helpers_8h_source.xhtml#l00097">Image::ptr</a>.</p>
1147 <div class="fragment"><div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;{</div><div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;    <span class="comment">// Construct images</span></div><div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;    <a class="code" href="struct_image.xhtml">Image</a> grad    = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(grad);</div><div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;    <a class="code" href="struct_image.xhtml">Image</a> angle   = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(angle);</div><div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;    <a class="code" href="struct_image.xhtml">Image</a> non_max = <a class="code" href="helpers_8h.xhtml#aebe814363556c244be043b13e7969197">CONVERT_TO_IMAGE_STRUCT</a>(non_max);</div><div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;</div><div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;    <span class="comment">// Get gradient and angle</span></div><div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;    DATA_TYPE_IN gradient = *((__global DATA_TYPE_IN *)grad.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>);</div><div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;    uchar an              = convert_ushort(*angle.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>);</div><div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;</div><div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;    <span class="keywordflow">if</span>(gradient &lt;= lower_thr)</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;        <span class="keywordflow">return</span>;</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;</div><div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;    <span class="comment">// Divide the whole round into 8 directions</span></div><div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;    uchar         ang  = 127 - an;</div><div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;    <a class="code" href="convolution3x3_8cl.xhtml#ac06f3e24d3fffd3c465d8b2a6e7c985e">DATA_TYPE_OUT</a> q_an = (ang + 16) &gt;&gt; 5;</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;    <span class="comment">// Find the two pixels in the perpendicular direction</span></div><div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;    short2       x_p = <a class="code" href="canny_8cl.xhtml#a65e45b2f8637f10dd14a427f37c2cd4c">neighbours_coords</a>[q_an].s02;</div><div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;    short2       y_p = <a class="code" href="canny_8cl.xhtml#a65e45b2f8637f10dd14a427f37c2cd4c">neighbours_coords</a>[q_an].s13;</div><div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;    DATA_TYPE_IN g1  = *((global DATA_TYPE_IN *)<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;grad, x_p.x, y_p.x));</div><div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;    DATA_TYPE_IN g2  = *((global DATA_TYPE_IN *)<a class="code" href="helpers_8h.xhtml#a009469e4d9b8fce3b6d5e97d2077827d">offset</a>(&amp;grad, x_p.y, y_p.y));</div><div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;</div><div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;    <span class="keywordflow">if</span>((gradient &gt; g1) &amp;&amp; (gradient &gt; g2))</div><div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;    {</div><div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;        *((global <a class="code" href="convolution3x3_8cl.xhtml#ac06f3e24d3fffd3c465d8b2a6e7c985e">DATA_TYPE_OUT</a> *)non_max.<a class="code" href="struct_image.xhtml#acf52c23cbd7424606c10a606524e3e32">ptr</a>) = gradient;</div><div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;    }</div><div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;}</div><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#l00201">helpers.h:201</a></div></div>
1148 <div class="ttc" id="canny_8cl_xhtml_a65e45b2f8637f10dd14a427f37c2cd4c"><div class="ttname"><a href="canny_8cl.xhtml#a65e45b2f8637f10dd14a427f37c2cd4c">neighbours_coords</a></div><div class="ttdeci">__constant short4 neighbours_coords[]</div><div class="ttdoc">Array that holds the relative coordinates offset for the neighbouring pixels. </div><div class="ttdef"><b>Definition:</b> <a href="canny_8cl_source.xhtml#l00153">canny.cl:153</a></div></div>
1149 <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#l00073">helpers.h:73</a></div></div>
1150 <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#l00095">helpers.h:95</a></div></div>
1151 <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#l00097">helpers.h:97</a></div></div>
1152 <div class="ttc" id="convolution3x3_8cl_xhtml_ac06f3e24d3fffd3c465d8b2a6e7c985e"><div class="ttname"><a href="convolution3x3_8cl.xhtml#ac06f3e24d3fffd3c465d8b2a6e7c985e">DATA_TYPE_OUT</a></div><div class="ttdeci">#define DATA_TYPE_OUT</div><div class="ttdef"><b>Definition:</b> <a href="convolution3x3_8cl_source.xhtml#l00031">convolution3x3.cl:31</a></div></div>
1153 </div><!-- fragment -->
1154 </div>
1155 </div>
1156 <h2 class="groupheader">Variable Documentation</h2>
1157 <a class="anchor" id="a65e45b2f8637f10dd14a427f37c2cd4c"></a>
1158 <div class="memitem">
1159 <div class="memproto">
1160       <table class="memname">
1161         <tr>
1162           <td class="memname">__constant short4 neighbours_coords[]</td>
1163         </tr>
1164       </table>
1165 </div><div class="memdoc">
1166 <b>Initial value:</b><div class="fragment"><div class="line">=</div><div class="line">{</div><div class="line">    { -1, 0, 1, 0 },  </div><div class="line">    { -1, 1, 1, -1 }, </div><div class="line">    { 0, 1, 0, -1 },  </div><div class="line">    { 1, 1, -1, -1 }, </div><div class="line">    { 1, 0, -1, 0 },  </div><div class="line">    { 1, -1, -1, 1 }, </div><div class="line">    { 0, 1, 0, -1 },  </div><div class="line">    { -1, -1, 1, 1 }, </div><div class="line">    { -1, 0, 1, 0 },  </div><div class="line">}</div></div><!-- fragment -->
1167 <p>Array that holds the relative coordinates offset for the neighbouring pixels. </p>
1168
1169 <p>Definition at line <a class="el" href="canny_8cl_source.xhtml#l00153">153</a> of file <a class="el" href="canny_8cl_source.xhtml">canny.cl</a>.</p>
1170
1171 </div>
1172 </div>
1173 </div><!-- contents -->
1174 </div><!-- doc-content -->
1175 <!-- start footer part -->
1176 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
1177   <ul>
1178     <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.xhtml">src</a></li><li class="navelem"><a class="el" href="dir_aebb8dcc11953d78e620bbef0b9e2183.xhtml">core</a></li><li class="navelem"><a class="el" href="dir_8c278f79c760e5c5fbd911f9870614c1.xhtml">CL</a></li><li class="navelem"><a class="el" href="dir_25885286e9dad4fa105b7b25a8031bbf.xhtml">cl_kernels</a></li><li class="navelem"><a class="el" href="canny_8cl.xhtml">canny.cl</a></li>
1179     <li class="footer">Generated on Wed Apr 12 2017 14:26:05 for ARM Compute Library by
1180     <a href="http://www.doxygen.org/index.html">
1181     <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
1182   </ul>
1183 </div>
1184 </body>
1185 </html>