aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/CL/functions/CLHarrisCorners.cpp
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2017-09-18 17:43:33 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commit5701e2a41ddf0a12042ac648993fc39701961f66 (patch)
treedd66e82e7f7fdc30a636e748a774422bc1bec40d /src/runtime/CL/functions/CLHarrisCorners.cpp
parente938175997b973e1ea288f5b95cc8710e6abc7aa (diff)
downloadComputeLibrary-5701e2a41ddf0a12042ac648993fc39701961f66.tar.gz
COMPMID-534: Port MemoryManager to CL functions (Images)
Adds support for: -CLCannyEdge -CLFastCorners -CLGaussian5x5 -CLHarrisCorners -CLSobel3x3 -CLSobel5x5 Change-Id: I712a76d4ceda915b5cf85a4d12c1b7a059d4d909 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/88118 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Moritz Pflanzer <moritz.pflanzer@arm.com> Reviewed-by: Pablo Tello <pablo.tello@arm.com>
Diffstat (limited to 'src/runtime/CL/functions/CLHarrisCorners.cpp')
-rw-r--r--src/runtime/CL/functions/CLHarrisCorners.cpp35
1 files changed, 27 insertions, 8 deletions
diff --git a/src/runtime/CL/functions/CLHarrisCorners.cpp b/src/runtime/CL/functions/CLHarrisCorners.cpp
index 2140240753..059528fe30 100644
--- a/src/runtime/CL/functions/CLHarrisCorners.cpp
+++ b/src/runtime/CL/functions/CLHarrisCorners.cpp
@@ -42,8 +42,9 @@
using namespace arm_compute;
-CLHarrisCorners::CLHarrisCorners() // NOLINT
- : _sobel(nullptr),
+CLHarrisCorners::CLHarrisCorners(std::shared_ptr<IMemoryManager> memory_manager) // NOLINT
+ : _memory_group(std::move(memory_manager)),
+ _sobel(nullptr),
_harris_score(),
_non_max_suppr(),
_candidates(),
@@ -84,6 +85,10 @@ void CLHarrisCorners::configure(ICLImage *input, float threshold, float min_dist
_corners_list = arm_compute::support::cpp14::make_unique<InternalKeypoint[]>(shape.x() * shape.y());
+ // Manage intermediate buffers
+ _memory_group.manage(&_gx);
+ _memory_group.manage(&_gy);
+
/* Set/init Sobel kernel accordingly with gradient_size */
switch(gradient_size)
{
@@ -116,6 +121,9 @@ void CLHarrisCorners::configure(ICLImage *input, float threshold, float min_dist
const float norm_factor = 1.0f / (255.0f * pow(4.0f, gradient_size / 2) * block_size);
const float pow4_normalization_factor = pow(norm_factor, 4);
+ // Manage intermediate buffers
+ _memory_group.manage(&_score);
+
// Set/init Harris Score kernel accordingly with block_size
_harris_score.configure(&_gx, &_gy, &_score, block_size, pow4_normalization_factor, threshold, sensitivity, border_mode == BorderMode::UNDEFINED);
@@ -123,26 +131,35 @@ void CLHarrisCorners::configure(ICLImage *input, float threshold, float min_dist
_border_gx.configure(&_gx, _harris_score.border_size(), border_mode, PixelValue(constant_border_value));
_border_gy.configure(&_gy, _harris_score.border_size(), border_mode, PixelValue(constant_border_value));
+ // Allocate intermediate buffers
+ _gx.allocator()->allocate();
+ _gy.allocator()->allocate();
+
+ // Manage intermediate buffers
+ _memory_group.manage(&_nonmax);
+
// Init non-maxima suppression function
_non_max_suppr.configure(&_score, &_nonmax, border_mode);
+ // Allocate intermediate buffers
+ _score.allocator()->allocate();
+
// Init corner candidates kernel
_candidates.configure(&_nonmax, _corners_list.get(), &_num_corner_candidates);
- // Init euclidean distance
- _sort_euclidean.configure(_corners_list.get(), _corners, &_num_corner_candidates, min_dist);
-
// Allocate intermediate buffers
- _gx.allocator()->allocate();
- _gy.allocator()->allocate();
- _score.allocator()->allocate();
_nonmax.allocator()->allocate();
+
+ // Init euclidean distance
+ _sort_euclidean.configure(_corners_list.get(), _corners, &_num_corner_candidates, min_dist);
}
void CLHarrisCorners::run()
{
ARM_COMPUTE_ERROR_ON_MSG(_sobel == nullptr, "Unconfigured function");
+ _memory_group.acquire();
+
// Init to 0 number of corner candidates
_num_corner_candidates = 0;
@@ -167,4 +184,6 @@ void CLHarrisCorners::run()
_corners->map(CLScheduler::get().queue(), true);
Scheduler::get().schedule(&_sort_euclidean, Window::DimY);
_corners->unmap(CLScheduler::get().queue());
+
+ _memory_group.release();
}