aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/CL/functions/CLCannyEdge.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/CLCannyEdge.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/CLCannyEdge.cpp')
-rw-r--r--src/runtime/CL/functions/CLCannyEdge.cpp41
1 files changed, 35 insertions, 6 deletions
diff --git a/src/runtime/CL/functions/CLCannyEdge.cpp b/src/runtime/CL/functions/CLCannyEdge.cpp
index 448ca9289d..5acb8e7ddb 100644
--- a/src/runtime/CL/functions/CLCannyEdge.cpp
+++ b/src/runtime/CL/functions/CLCannyEdge.cpp
@@ -35,8 +35,9 @@
using namespace arm_compute;
-CLCannyEdge::CLCannyEdge() // NOLINT
- : _sobel(),
+CLCannyEdge::CLCannyEdge(std::shared_ptr<IMemoryManager> memory_manager) // NOLINT
+ : _memory_group(std::move(memory_manager)),
+ _sobel(),
_gradient(),
_border_mag_gradient(),
_non_max_suppr(),
@@ -96,6 +97,10 @@ void CLCannyEdge::configure(ICLTensor *input, ICLTensor *output, int32_t upper_t
TensorInfo info_s32(shape_l1_stack, 1, arm_compute::DataType::S32);
_l1_stack.allocator()->init(info_s32);
+ // Manage intermediate buffers
+ _memory_group.manage(&_gx);
+ _memory_group.manage(&_gy);
+
// Configure/Init sobelNxN
if(gradient_size == 3)
{
@@ -120,23 +125,43 @@ void CLCannyEdge::configure(ICLTensor *input, ICLTensor *output, int32_t upper_t
ARM_COMPUTE_ERROR("Gradient %d size not supported", gradient_size);
}
+ // Manage intermediate buffers
+ _memory_group.manage(&_mag);
+ _memory_group.manage(&_phase);
+
// Configure gradient
_gradient.configure(&_gx, &_gy, &_mag, &_phase, norm_type);
+ // Allocate intermediate buffers
+ _gx.allocator()->allocate();
+ _gy.allocator()->allocate();
+
+ // Manage intermediate buffers
+ _memory_group.manage(&_nonmax);
+
// Configure non-maxima suppression
_non_max_suppr.configure(&_mag, &_phase, &_nonmax, lower_thr, border_mode == BorderMode::UNDEFINED);
+ // Allocate intermediate buffers
+ _phase.allocator()->allocate();
+
// Fill border around magnitude image as non-maxima suppression will access
// it. If border mode is undefined filling the border is a nop.
_border_mag_gradient.configure(&_mag, _non_max_suppr.border_size(), border_mode, constant_border_value);
+ // Allocate intermediate buffers
+ _mag.allocator()->allocate();
+
+ // Manage intermediate buffers
+ _memory_group.manage(&_visited);
+ _memory_group.manage(&_recorded);
+ _memory_group.manage(&_l1_stack);
+ _memory_group.manage(&_l1_list_counter);
+
// Configure edge tracing
_edge_trace.configure(&_nonmax, output, upper_thr, lower_thr, &_visited, &_recorded, &_l1_stack, &_l1_list_counter);
- _gx.allocator()->allocate();
- _gy.allocator()->allocate();
- _phase.allocator()->allocate();
- _mag.allocator()->allocate();
+ // Allocate intermediate buffers
_visited.allocator()->allocate();
_recorded.allocator()->allocate();
_l1_stack.allocator()->allocate();
@@ -146,6 +171,8 @@ void CLCannyEdge::configure(ICLTensor *input, ICLTensor *output, int32_t upper_t
void CLCannyEdge::run()
{
+ _memory_group.acquire();
+
// Run sobel
_sobel->run();
@@ -165,4 +192,6 @@ void CLCannyEdge::run()
_l1_list_counter.clear(CLScheduler::get().queue());
_l1_stack.clear(CLScheduler::get().queue());
CLScheduler::get().enqueue(_edge_trace, true);
+
+ _memory_group.release();
}