blob: 24c7af7af7b271bdced1e15ef45606ef15339172 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
2 * Copyright (c) 2016, 2017 ARM Limited.
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#include "arm_compute/core/NEON/kernels/NEMinMaxLocationKernel.h"
25
26#include "arm_compute/core/Coordinates.h"
27#include "arm_compute/core/Error.h"
28#include "arm_compute/core/Helpers.h"
29#include "arm_compute/core/IAccessWindow.h"
30#include "arm_compute/core/ITensor.h"
31#include "arm_compute/core/TensorInfo.h"
32#include "arm_compute/core/Types.h"
33#include "arm_compute/core/Validate.h"
steniu014c2938e2017-06-19 15:44:45 +010034#include "arm_compute/core/Window.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010035
steniu014c2938e2017-06-19 15:44:45 +010036#include <algorithm>
Anthony Barbier6ff3b192017-09-04 18:44:23 +010037#include <arm_neon.h>
38#include <climits>
39#include <cstddef>
40
41namespace arm_compute
42{
43NEMinMaxKernel::NEMinMaxKernel()
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +010044 : _func(), _input(nullptr), _min(), _max(), _mtx()
Anthony Barbier6ff3b192017-09-04 18:44:23 +010045{
46}
47
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +010048void NEMinMaxKernel::configure(const IImage *input, void *min, void *max)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010049{
50 ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(input);
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +010051 ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8, DataType::S16, DataType::F32);
Anthony Barbier6ff3b192017-09-04 18:44:23 +010052 ARM_COMPUTE_ERROR_ON(nullptr == min);
53 ARM_COMPUTE_ERROR_ON(nullptr == max);
54
55 _input = input;
56 _min = min;
57 _max = max;
58
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +010059 switch(_input->info()->data_type())
Anthony Barbier6ff3b192017-09-04 18:44:23 +010060 {
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +010061 case DataType::U8:
62 _func = &NEMinMaxKernel::minmax_U8;
Anthony Barbier6ff3b192017-09-04 18:44:23 +010063 break;
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +010064 case DataType::S16:
65 _func = &NEMinMaxKernel::minmax_S16;
66 break;
67 case DataType::F32:
68 _func = &NEMinMaxKernel::minmax_F32;
Anthony Barbier6ff3b192017-09-04 18:44:23 +010069 break;
70 default:
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +010071 ARM_COMPUTE_ERROR("Unsupported data type");
Anthony Barbier6ff3b192017-09-04 18:44:23 +010072 break;
73 }
74
Anthony Barbier6ff3b192017-09-04 18:44:23 +010075 // Configure kernel window
steniu014c2938e2017-06-19 15:44:45 +010076 constexpr unsigned int num_elems_processed_per_iteration = 1;
Anthony Barbier6ff3b192017-09-04 18:44:23 +010077
steniu014c2938e2017-06-19 15:44:45 +010078 Window win = calculate_max_window(*input->info(), Steps(num_elems_processed_per_iteration));
Anthony Barbier6ff3b192017-09-04 18:44:23 +010079
80 INEKernel::configure(win);
81}
82
83void NEMinMaxKernel::run(const Window &window)
84{
85 ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
86 ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(INEKernel::window(), window);
87 ARM_COMPUTE_ERROR_ON(_func == nullptr);
88
89 (this->*_func)(window);
90}
91
92void NEMinMaxKernel::reset()
93{
94 ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +010095 switch(_input->info()->data_type())
96 {
97 case DataType::U8:
98 *static_cast<int32_t *>(_min) = UCHAR_MAX;
99 *static_cast<int32_t *>(_max) = 0;
100 break;
101 case DataType::S16:
102 *static_cast<int32_t *>(_min) = SHRT_MAX;
103 *static_cast<int32_t *>(_max) = SHRT_MIN;
104 break;
105 case DataType::F32:
106 *static_cast<float *>(_min) = std::numeric_limits<float>::max();
107 *static_cast<float *>(_max) = std::numeric_limits<float>::lowest();
108 break;
109 default:
110 ARM_COMPUTE_ERROR("Unsupported data type");
111 break;
112 }
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100113}
114
115template <typename T>
116void NEMinMaxKernel::update_min_max(const T min, const T max)
117{
Michalis Spyrou07781ac2017-08-31 15:11:41 +0100118 std::lock_guard<arm_compute::Mutex> lock(_mtx);
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100119
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +0100120 using type = typename std::conditional<std::is_same<T, float>::value, float, int32_t>::type;
121
122 auto min_ptr = static_cast<type *>(_min);
123 auto max_ptr = static_cast<type *>(_max);
124
125 if(min < *min_ptr)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100126 {
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +0100127 *min_ptr = min;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100128 }
129
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +0100130 if(max > *max_ptr)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100131 {
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +0100132 *max_ptr = max;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100133 }
134}
135
steniu014c2938e2017-06-19 15:44:45 +0100136void NEMinMaxKernel::minmax_U8(Window win)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100137{
138 uint8x8_t carry_min = vdup_n_u8(UCHAR_MAX);
139 uint8x8_t carry_max = vdup_n_u8(0);
140
steniu014c2938e2017-06-19 15:44:45 +0100141 uint8_t carry_max_scalar = 0;
142 uint8_t carry_min_scalar = UCHAR_MAX;
143
144 const int x_start = win.x().start();
145 const int x_end = win.x().end();
146
147 // Handle X dimension manually to split into two loops
148 // First one will use vector operations, second one processes the left over pixels
149 win.set(Window::DimX, Window::Dimension(0, 1, 1));
150
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100151 Iterator input(_input, win);
152
153 execute_window_loop(win, [&](const Coordinates & id)
154 {
steniu014c2938e2017-06-19 15:44:45 +0100155 int x = x_start;
156
157 // Vector loop
158 for(; x <= x_end - 16; x += 16)
159 {
160 const uint8x16_t pixels = vld1q_u8(input.ptr() + x);
161 const uint8x8_t tmp_min = vmin_u8(vget_high_u8(pixels), vget_low_u8(pixels));
162 const uint8x8_t tmp_max = vmax_u8(vget_high_u8(pixels), vget_low_u8(pixels));
163 carry_min = vmin_u8(tmp_min, carry_min);
164 carry_max = vmax_u8(tmp_max, carry_max);
165 }
166
167 // Process leftover pixels
168 for(; x < x_end; ++x)
169 {
170 const uint8_t pixel = input.ptr()[x];
171 carry_min_scalar = std::min(pixel, carry_min_scalar);
172 carry_max_scalar = std::max(pixel, carry_max_scalar);
173 }
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100174 },
175 input);
176
177 // Reduce result
178 carry_min = vpmin_u8(carry_min, carry_min);
179 carry_max = vpmax_u8(carry_max, carry_max);
180 carry_min = vpmin_u8(carry_min, carry_min);
181 carry_max = vpmax_u8(carry_max, carry_max);
182 carry_min = vpmin_u8(carry_min, carry_min);
183 carry_max = vpmax_u8(carry_max, carry_max);
184
185 // Extract max/min values
steniu014c2938e2017-06-19 15:44:45 +0100186 const uint8_t min_i = std::min(vget_lane_u8(carry_min, 0), carry_min_scalar);
187 const uint8_t max_i = std::max(vget_lane_u8(carry_max, 0), carry_max_scalar);
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100188
189 // Perform reduction of local min/max values
190 update_min_max(min_i, max_i);
191}
192
steniu014c2938e2017-06-19 15:44:45 +0100193void NEMinMaxKernel::minmax_S16(Window win)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100194{
195 int16x4_t carry_min = vdup_n_s16(SHRT_MAX);
196 int16x4_t carry_max = vdup_n_s16(SHRT_MIN);
197
steniu014c2938e2017-06-19 15:44:45 +0100198 int16_t carry_max_scalar = SHRT_MIN;
199 int16_t carry_min_scalar = SHRT_MAX;
200
201 const int x_start = win.x().start();
202 const int x_end = win.x().end();
203
204 // Handle X dimension manually to split into two loops
205 // First one will use vector operations, second one processes the left over pixels
206 win.set(Window::DimX, Window::Dimension(0, 1, 1));
207
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100208 Iterator input(_input, win);
209
210 execute_window_loop(win, [&](const Coordinates & id)
211 {
steniu014c2938e2017-06-19 15:44:45 +0100212 int x = x_start;
213 const auto in_ptr = reinterpret_cast<const int16_t *const>(input.ptr());
214
215 // Vector loop
216 for(; x <= x_end - 16; x += 16)
217 {
218 const int16x8x2_t pixels = vld2q_s16(in_ptr + x);
219 const int16x8_t tmp_min1 = vminq_s16(pixels.val[0], pixels.val[1]);
220 const int16x8_t tmp_max1 = vmaxq_s16(pixels.val[0], pixels.val[1]);
221 const int16x4_t tmp_min2 = vmin_s16(vget_high_s16(tmp_min1), vget_low_s16(tmp_min1));
222 const int16x4_t tmp_max2 = vmax_s16(vget_high_s16(tmp_max1), vget_low_s16(tmp_max1));
223 carry_min = vmin_s16(tmp_min2, carry_min);
224 carry_max = vmax_s16(tmp_max2, carry_max);
225 }
226
227 // Process leftover pixels
228 for(; x < x_end; ++x)
229 {
230 const int16_t pixel = in_ptr[x];
231 carry_min_scalar = std::min(pixel, carry_min_scalar);
232 carry_max_scalar = std::max(pixel, carry_max_scalar);
233 }
234
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100235 },
236 input);
237
238 // Reduce result
239 carry_min = vpmin_s16(carry_min, carry_min);
240 carry_max = vpmax_s16(carry_max, carry_max);
241 carry_min = vpmin_s16(carry_min, carry_min);
242 carry_max = vpmax_s16(carry_max, carry_max);
243
244 // Extract max/min values
steniu014c2938e2017-06-19 15:44:45 +0100245 const int16_t min_i = std::min(vget_lane_s16(carry_min, 0), carry_min_scalar);
246 const int16_t max_i = std::max(vget_lane_s16(carry_max, 0), carry_max_scalar);
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100247
248 // Perform reduction of local min/max values
249 update_min_max(min_i, max_i);
250}
251
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +0100252void NEMinMaxKernel::minmax_F32(Window win)
253{
254 float32x2_t carry_min = vdup_n_f32(std::numeric_limits<float>::max());
255 float32x2_t carry_max = vdup_n_f32(std::numeric_limits<float>::lowest());
256
257 float carry_min_scalar = std::numeric_limits<float>::max();
258 float carry_max_scalar = std::numeric_limits<float>::lowest();
259
260 const int x_start = win.x().start();
261 const int x_end = win.x().end();
262
263 // Handle X dimension manually to split into two loops
264 // First one will use vector operations, second one processes the left over pixels
265 win.set(Window::DimX, Window::Dimension(0, 1, 1));
266
267 Iterator input(_input, win);
268
269 execute_window_loop(win, [&](const Coordinates & id)
270 {
271 int x = x_start;
272 const auto in_ptr = reinterpret_cast<const float *const>(input.ptr());
273
274 // Vector loop
275 for(; x <= x_end - 8; x += 8)
276 {
277 const float32x4x2_t pixels = vld2q_f32(in_ptr + x);
278 const float32x4_t tmp_min1 = vminq_f32(pixels.val[0], pixels.val[1]);
279 const float32x4_t tmp_max1 = vmaxq_f32(pixels.val[0], pixels.val[1]);
280 const float32x2_t tmp_min2 = vmin_f32(vget_high_f32(tmp_min1), vget_low_f32(tmp_min1));
281 const float32x2_t tmp_max2 = vmax_f32(vget_high_f32(tmp_max1), vget_low_f32(tmp_max1));
282 carry_min = vmin_f32(tmp_min2, carry_min);
283 carry_max = vmax_f32(tmp_max2, carry_max);
284 }
285
286 // Process leftover pixels
287 for(; x < x_end; ++x)
288 {
289 const float pixel = in_ptr[x];
290 carry_min_scalar = std::min(pixel, carry_min_scalar);
291 carry_max_scalar = std::max(pixel, carry_max_scalar);
292 }
293
294 },
295 input);
296
297 // Reduce result
298 carry_min = vpmin_f32(carry_min, carry_min);
299 carry_max = vpmax_f32(carry_max, carry_max);
300 carry_min = vpmin_f32(carry_min, carry_min);
301 carry_max = vpmax_f32(carry_max, carry_max);
302
303 // Extract max/min values
304 const float min_i = std::min(vget_lane_f32(carry_min, 0), carry_min_scalar);
305 const float max_i = std::max(vget_lane_f32(carry_max, 0), carry_max_scalar);
306
307 // Perform reduction of local min/max values
308 update_min_max(min_i, max_i);
309}
310
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100311NEMinMaxLocationKernel::NEMinMaxLocationKernel()
steniu014c2938e2017-06-19 15:44:45 +0100312 : _func(nullptr), _input(nullptr), _min(nullptr), _max(nullptr), _min_count(nullptr), _max_count(nullptr), _min_loc(nullptr), _max_loc(nullptr)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100313{
314}
315
316bool NEMinMaxLocationKernel::is_parallelisable() const
317{
318 return false;
319}
320
321template <unsigned int...>
322struct index_seq
323{
324 index_seq() = default;
325 index_seq(const index_seq &) = default;
326 index_seq &operator=(const index_seq &) = default;
327 index_seq(index_seq &&) noexcept = default;
328 index_seq &operator=(index_seq &&) noexcept = default;
329 virtual ~index_seq() = default;
330};
331template <unsigned int N, unsigned int... S>
332struct gen_index_seq : gen_index_seq < N - 1, N - 1, S... >
333{
334};
335template <unsigned int... S>
336struct gen_index_seq<0u, S...> : index_seq<S...>
337{
338 using type = index_seq<S...>;
339};
340
341template <class T, unsigned int... N>
342struct NEMinMaxLocationKernel::create_func_table<T, index_seq<N...>>
343{
344 static const NEMinMaxLocationKernel::MinMaxLocFunction func_table[sizeof...(N)];
345};
346
347template <class T, unsigned int... N>
348const NEMinMaxLocationKernel::MinMaxLocFunction NEMinMaxLocationKernel::create_func_table<T, index_seq<N...>>::func_table[sizeof...(N)] =
349{
350 &NEMinMaxLocationKernel::minmax_loc<T, bool(N & 8), bool(N & 4), bool(N & 2), bool(N & 1)>...
351};
352
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +0100353void NEMinMaxLocationKernel::configure(const IImage *input, void *min, void *max,
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100354 ICoordinates2DArray *min_loc, ICoordinates2DArray *max_loc,
355 uint32_t *min_count, uint32_t *max_count)
356{
357 ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(input);
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +0100358 ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8, DataType::S16, DataType::F32);
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100359 ARM_COMPUTE_ERROR_ON(nullptr == min);
360 ARM_COMPUTE_ERROR_ON(nullptr == max);
361
362 _input = input;
363 _min = min;
364 _max = max;
365 _min_count = min_count;
366 _max_count = max_count;
367 _min_loc = min_loc;
368 _max_loc = max_loc;
369
370 unsigned int count_min = (nullptr != min_count ? 1 : 0);
371 unsigned int count_max = (nullptr != max_count ? 1 : 0);
372 unsigned int loc_min = (nullptr != min_loc ? 1 : 0);
373 unsigned int loc_max = (nullptr != max_loc ? 1 : 0);
374
375 unsigned int table_idx = (count_min << 3) | (count_max << 2) | (loc_min << 1) | loc_max;
376
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +0100377 switch(input->info()->data_type())
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100378 {
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +0100379 case DataType::U8:
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100380 _func = create_func_table<uint8_t, gen_index_seq<16>::type>::func_table[table_idx];
381 break;
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +0100382 case DataType::S16:
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100383 _func = create_func_table<int16_t, gen_index_seq<16>::type>::func_table[table_idx];
384 break;
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +0100385 case DataType::F32:
386 _func = create_func_table<float, gen_index_seq<16>::type>::func_table[table_idx];
387 break;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100388 default:
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +0100389 ARM_COMPUTE_ERROR("Unsupported data type");
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100390 break;
391 }
392
steniu014c2938e2017-06-19 15:44:45 +0100393 constexpr unsigned int num_elems_processed_per_iteration = 1;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100394
395 // Configure kernel window
steniu014c2938e2017-06-19 15:44:45 +0100396 Window win = calculate_max_window(*input->info(), Steps(num_elems_processed_per_iteration));
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100397
steniu014c2938e2017-06-19 15:44:45 +0100398 update_window_and_padding(win, AccessWindowHorizontal(input->info(), 0, num_elems_processed_per_iteration));
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100399
400 INEKernel::configure(win);
401}
402
403void NEMinMaxLocationKernel::run(const Window &window)
404{
405 ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
406 ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(INEKernel::window(), window);
407 ARM_COMPUTE_ERROR_ON(_func == nullptr);
408
409 (this->*_func)(window);
410}
411
412template <class T, bool count_min, bool count_max, bool loc_min, bool loc_max>
413void NEMinMaxLocationKernel::minmax_loc(const Window &win)
414{
415 if(count_min || count_max || loc_min || loc_max)
416 {
417 Iterator input(_input, win);
418
steniu014c2938e2017-06-19 15:44:45 +0100419 size_t min_count = 0;
420 size_t max_count = 0;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100421
422 // Clear min location array
423 if(loc_min)
424 {
425 _min_loc->clear();
426 }
427
428 // Clear max location array
429 if(loc_max)
430 {
431 _max_loc->clear();
432 }
433
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +0100434 using type = typename std::conditional<std::is_same<T, float>::value, float, int32_t>::type;
435
436 auto min_ptr = static_cast<type *>(_min);
437 auto max_ptr = static_cast<type *>(_max);
438
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100439 execute_window_loop(win, [&](const Coordinates & id)
440 {
441 auto in_ptr = reinterpret_cast<const T *>(input.ptr());
442 int32_t idx = id.x();
443 int32_t idy = id.y();
444
steniu014c2938e2017-06-19 15:44:45 +0100445 const T pixel = *in_ptr;
446 Coordinates2D p{ idx, idy };
447
448 if(count_min || loc_min)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100449 {
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +0100450 if(*min_ptr == pixel)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100451 {
steniu014c2938e2017-06-19 15:44:45 +0100452 if(count_min)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100453 {
steniu014c2938e2017-06-19 15:44:45 +0100454 ++min_count;
455 }
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100456
steniu014c2938e2017-06-19 15:44:45 +0100457 if(loc_min)
458 {
459 _min_loc->push_back(p);
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100460 }
461 }
steniu014c2938e2017-06-19 15:44:45 +0100462 }
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100463
steniu014c2938e2017-06-19 15:44:45 +0100464 if(count_max || loc_max)
465 {
Michele Di Giorgioef4b4ae2017-07-04 17:19:43 +0100466 if(*max_ptr == pixel)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100467 {
steniu014c2938e2017-06-19 15:44:45 +0100468 if(count_max)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100469 {
steniu014c2938e2017-06-19 15:44:45 +0100470 ++max_count;
471 }
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100472
steniu014c2938e2017-06-19 15:44:45 +0100473 if(loc_max)
474 {
475 _max_loc->push_back(p);
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100476 }
477 }
478 }
479 },
480 input);
481
482 if(count_min)
483 {
484 *_min_count = min_count;
485 }
486
487 if(count_max)
488 {
489 *_max_count = max_count;
490 }
491 }
492}
493} // namespace arm_compute