aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/CL
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2021-03-30 10:03:01 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2021-03-31 11:44:07 +0000
commitc6f9510bcb754afaadfe9477ff85d6c55ffcf43b (patch)
treec1b08777a93ab9d2e334c71acf30f337bdb3feda /src/runtime/CL
parent2788609b8a10306e9eae47543b39812a7b075aaa (diff)
downloadComputeLibrary-c6f9510bcb754afaadfe9477ff85d6c55ffcf43b.tar.gz
Remove Computer Vision generic interfaces and types
Removes: - reference validation routines - CV related types and structures - CV related interfaces Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com> Change-Id: I3a203da12d9b04c154059b190aeba18a611149a9 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5340 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/runtime/CL')
-rw-r--r--src/runtime/CL/CLDistribution1D.cpp61
-rw-r--r--src/runtime/CL/CLHOG.cpp84
-rw-r--r--src/runtime/CL/CLLut.cpp99
-rw-r--r--src/runtime/CL/CLLutAllocator.cpp77
-rw-r--r--src/runtime/CL/CLMultiHOG.cpp52
-rw-r--r--src/runtime/CL/CLMultiImage.cpp172
-rw-r--r--src/runtime/CL/CLPyramid.cpp127
7 files changed, 0 insertions, 672 deletions
diff --git a/src/runtime/CL/CLDistribution1D.cpp b/src/runtime/CL/CLDistribution1D.cpp
deleted file mode 100644
index 91d67cbd0a..0000000000
--- a/src/runtime/CL/CLDistribution1D.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2016, 2017 Arm Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/runtime/CL/CLDistribution1D.h"
-
-#include "arm_compute/core/Error.h"
-#include "arm_compute/runtime/CL/CLScheduler.h"
-
-using namespace arm_compute;
-
-CLDistribution1D::CLDistribution1D(size_t num_bins, int32_t offset, uint32_t range)
- : ICLDistribution1D(num_bins, offset, range), _mem(CLScheduler::get().context(), CL_MEM_ALLOC_HOST_PTR | CL_MEM_READ_WRITE, num_bins * sizeof(int32_t))
-{
-}
-
-void CLDistribution1D::map(bool blocking)
-{
- ICLDistribution1D::map(CLScheduler::get().queue(), blocking);
-}
-
-void CLDistribution1D::unmap()
-{
- ICLDistribution1D::unmap(CLScheduler::get().queue());
-}
-
-uint32_t *CLDistribution1D::do_map(cl::CommandQueue &q, bool blocking)
-{
- ARM_COMPUTE_ERROR_ON(_mem.get() == nullptr);
- return static_cast<uint32_t *>(q.enqueueMapBuffer(_mem, blocking ? CL_TRUE : CL_FALSE, CL_MAP_READ | CL_MAP_WRITE, 0, size()));
-}
-
-void CLDistribution1D::do_unmap(cl::CommandQueue &q)
-{
- ARM_COMPUTE_ERROR_ON(_mem.get() == nullptr);
- q.enqueueUnmapMemObject(_mem, _mapping);
-}
-
-cl::Buffer &CLDistribution1D::cl_buffer()
-{
- return _mem;
-}
diff --git a/src/runtime/CL/CLHOG.cpp b/src/runtime/CL/CLHOG.cpp
deleted file mode 100644
index 6a02d8ff44..0000000000
--- a/src/runtime/CL/CLHOG.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2017-2018 Arm Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "arm_compute/runtime/CL/CLHOG.h"
-
-#include "arm_compute/core/CL/OpenCL.h"
-#include "arm_compute/core/Error.h"
-#include "arm_compute/runtime/CL/CLScheduler.h"
-
-using namespace arm_compute;
-
-CLHOG::CLHOG()
- : _info(), _buffer()
-{
-}
-
-void CLHOG::init(const HOGInfo &input)
-{
- ARM_COMPUTE_ERROR_ON(_buffer.get() != nullptr);
- _info = input;
- _buffer = cl::Buffer(CLScheduler::get().context(), CL_MEM_ALLOC_HOST_PTR | CL_MEM_READ_WRITE, info()->descriptor_size() * sizeof(float));
-}
-
-void CLHOG::free()
-{
- ARM_COMPUTE_ERROR_ON(_buffer.get() == nullptr);
-
- _buffer = cl::Buffer();
-}
-
-const HOGInfo *CLHOG::info() const
-{
- return &_info;
-}
-
-const cl::Buffer &CLHOG::cl_buffer() const
-{
- return _buffer;
-}
-
-void CLHOG::map(bool blocking)
-{
- ARM_COMPUTE_ERROR_ON(descriptor() != nullptr);
- ICLHOG::map(CLScheduler::get().queue(), blocking);
-}
-
-void CLHOG::unmap()
-{
- ARM_COMPUTE_ERROR_ON(descriptor() == nullptr);
- ICLHOG::unmap(CLScheduler::get().queue());
-}
-
-uint8_t *CLHOG::do_map(cl::CommandQueue &q, bool blocking)
-{
- ARM_COMPUTE_ERROR_ON(_buffer.get() == nullptr);
- return static_cast<uint8_t *>(q.enqueueMapBuffer(_buffer, blocking ? CL_TRUE : CL_FALSE, CL_MAP_READ | CL_MAP_WRITE, 0, info()->descriptor_size() * sizeof(float)));
-}
-
-void CLHOG::do_unmap(cl::CommandQueue &q)
-{
- ARM_COMPUTE_ERROR_ON(_buffer.get() == nullptr);
- q.enqueueUnmapMemObject(_buffer, descriptor());
-}
diff --git a/src/runtime/CL/CLLut.cpp b/src/runtime/CL/CLLut.cpp
deleted file mode 100644
index eb9422cc37..0000000000
--- a/src/runtime/CL/CLLut.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2016, 2017 Arm Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/runtime/CL/CLLut.h"
-
-#include "arm_compute/runtime/CL/CLScheduler.h"
-
-#include <cstring>
-
-using namespace arm_compute;
-
-CLLut::CLLut()
- : _allocator()
-{
-}
-
-CLLut::CLLut(size_t num_elements, DataType data_type)
- : _allocator()
-{
- _allocator.init(num_elements, data_type);
-}
-
-size_t CLLut::num_elements() const
-{
- return _allocator.num_elements();
-}
-
-uint32_t CLLut::index_offset() const
-{
- return (DataType::S16 == _allocator.type()) ? num_elements() / 2 : 0;
-}
-
-size_t CLLut::size_in_bytes() const
-{
- return _allocator.size();
-}
-
-DataType CLLut::type() const
-{
- return _allocator.type();
-}
-
-const cl::Buffer &CLLut::cl_buffer() const
-{
- return _allocator.cl_data();
-}
-
-void CLLut::clear()
-{
- cl::CommandQueue &q = CLScheduler::get().queue();
- uint8_t *data = _allocator.map(q, true /* blocking */);
- std::memset(data, 0, size_in_bytes());
- _allocator.unmap(q, data);
-}
-
-ILutAllocator *CLLut::allocator()
-{
- return &_allocator;
-}
-
-void CLLut::map(bool blocking)
-{
- ICLLut::map(CLScheduler::get().queue(), blocking);
-}
-
-void CLLut::unmap()
-{
- ICLLut::unmap(CLScheduler::get().queue());
-}
-
-uint8_t *CLLut::do_map(cl::CommandQueue &q, bool blocking)
-{
- return _allocator.map(q, blocking);
-}
-
-void CLLut::do_unmap(cl::CommandQueue &q)
-{
- _allocator.unmap(q, buffer());
-}
diff --git a/src/runtime/CL/CLLutAllocator.cpp b/src/runtime/CL/CLLutAllocator.cpp
deleted file mode 100644
index d690cf2f1d..0000000000
--- a/src/runtime/CL/CLLutAllocator.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2016, 2017 Arm Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/runtime/CL/CLLutAllocator.h"
-
-#include "arm_compute/core/Error.h"
-#include "arm_compute/runtime/CL/CLScheduler.h"
-
-using namespace arm_compute;
-
-CLLutAllocator::CLLutAllocator()
- : _buffer(), _mapping(nullptr)
-{
-}
-
-uint8_t *CLLutAllocator::data()
-{
- return _mapping;
-}
-
-const cl::Buffer &CLLutAllocator::cl_data() const
-{
- return _buffer;
-}
-
-uint8_t *CLLutAllocator::map(cl::CommandQueue &q, bool blocking)
-{
- ARM_COMPUTE_ERROR_ON(_buffer.get() == nullptr);
- return static_cast<uint8_t *>(q.enqueueMapBuffer(_buffer, blocking ? CL_TRUE : CL_FALSE, CL_MAP_READ | CL_MAP_WRITE, 0, size()));
-}
-
-void CLLutAllocator::unmap(cl::CommandQueue &q, uint8_t *mapping)
-{
- ARM_COMPUTE_ERROR_ON(_buffer.get() == nullptr);
- q.enqueueUnmapMemObject(_buffer, mapping);
-}
-
-void CLLutAllocator::allocate()
-{
- _buffer = cl::Buffer(CLScheduler::get().context(), CL_MEM_ALLOC_HOST_PTR | CL_MEM_READ_WRITE, size());
-}
-
-uint8_t *CLLutAllocator::lock()
-{
- ARM_COMPUTE_ERROR_ON(_mapping != nullptr);
- cl::CommandQueue q = CLScheduler::get().queue();
- _mapping = map(q, true);
- return _mapping;
-}
-
-void CLLutAllocator::unlock()
-{
- ARM_COMPUTE_ERROR_ON(_mapping == nullptr);
- cl::CommandQueue q = CLScheduler::get().queue();
- unmap(q, _mapping);
- _mapping = nullptr;
-}
diff --git a/src/runtime/CL/CLMultiHOG.cpp b/src/runtime/CL/CLMultiHOG.cpp
deleted file mode 100644
index 28a802ca1e..0000000000
--- a/src/runtime/CL/CLMultiHOG.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2017-2020 Arm Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/runtime/CL/CLMultiHOG.h"
-
-#include "arm_compute/core/CL/ICLHOG.h"
-#include "arm_compute/core/Error.h"
-
-using namespace arm_compute;
-
-CLMultiHOG::CLMultiHOG(size_t num_models)
- : _num_models(num_models), _model()
-{
- _model.resize(_num_models);
-}
-
-size_t CLMultiHOG::num_models() const
-{
- return _num_models;
-}
-
-ICLHOG *CLMultiHOG::cl_model(size_t index)
-{
- ARM_COMPUTE_ERROR_ON(index >= _num_models);
- return (&_model[index]);
-}
-
-const ICLHOG *CLMultiHOG::cl_model(size_t index) const
-{
- ARM_COMPUTE_ERROR_ON(index >= _num_models);
- return (&_model[index]);
-}
diff --git a/src/runtime/CL/CLMultiImage.cpp b/src/runtime/CL/CLMultiImage.cpp
deleted file mode 100644
index 28b3f854f2..0000000000
--- a/src/runtime/CL/CLMultiImage.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (c) 2016-2018 Arm Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/runtime/CL/CLMultiImage.h"
-
-#include "arm_compute/core/Error.h"
-#include "arm_compute/core/TensorInfo.h"
-#include "arm_compute/core/Utils.h"
-#include "arm_compute/runtime/ITensorAllocator.h"
-
-using namespace arm_compute;
-
-CLMultiImage::CLMultiImage()
- : _info(), _plane()
-{
-}
-
-const MultiImageInfo *CLMultiImage::info() const
-{
- return &_info;
-}
-
-void CLMultiImage::init(unsigned int width, unsigned int height, Format format)
-{
- internal_init(width, height, format, false);
-}
-
-void CLMultiImage::init_auto_padding(unsigned int width, unsigned int height, Format format)
-{
- internal_init(width, height, format, true);
-}
-
-void CLMultiImage::internal_init(unsigned int width, unsigned int height, Format format, bool auto_padding)
-{
- TensorShape shape = adjust_odd_shape(TensorShape{ width, height }, format);
- TensorInfo info(shape, Format::U8);
-
- if(auto_padding)
- {
- info.auto_padding();
- }
-
- switch(format)
- {
- case Format::U8:
- case Format::S16:
- case Format::U16:
- case Format::S32:
- case Format::F16:
- case Format::F32:
- case Format::U32:
- case Format::RGB888:
- case Format::RGBA8888:
- case Format::YUYV422:
- case Format::UYVY422:
- {
- TensorInfo info_full(shape, format);
-
- if(auto_padding)
- {
- info_full.auto_padding();
- }
-
- std::get<0>(_plane).allocator()->init(info_full);
- break;
- }
- case Format::NV12:
- case Format::NV21:
- {
- const TensorShape shape_uv88 = calculate_subsampled_shape(shape, Format::UV88);
- TensorInfo info_uv88(shape_uv88, Format::UV88);
-
- if(auto_padding)
- {
- info_uv88.auto_padding();
- }
-
- std::get<0>(_plane).allocator()->init(info);
- std::get<1>(_plane).allocator()->init(info_uv88);
- break;
- }
- case Format::IYUV:
- {
- const TensorShape shape_sub2 = calculate_subsampled_shape(shape, Format::IYUV);
- TensorInfo info_sub2(shape_sub2, Format::U8);
-
- if(auto_padding)
- {
- info_sub2.auto_padding();
- }
-
- std::get<0>(_plane).allocator()->init(info);
- std::get<1>(_plane).allocator()->init(info_sub2);
- std::get<2>(_plane).allocator()->init(info_sub2);
- break;
- }
- case Format::YUV444:
- std::get<0>(_plane).allocator()->init(info);
- std::get<1>(_plane).allocator()->init(info);
- std::get<2>(_plane).allocator()->init(info);
- break;
- default:
- ARM_COMPUTE_ERROR("Not supported");
- break;
- }
-
- _info.init(shape.x(), shape.y(), format);
-}
-
-void CLMultiImage::allocate()
-{
- switch(_info.format())
- {
- case Format::U8:
- case Format::S16:
- case Format::U16:
- case Format::S32:
- case Format::F16:
- case Format::F32:
- case Format::U32:
- case Format::RGB888:
- case Format::RGBA8888:
- case Format::YUYV422:
- case Format::UYVY422:
- std::get<0>(_plane).allocator()->allocate();
- break;
- case Format::NV12:
- case Format::NV21:
- std::get<0>(_plane).allocator()->allocate();
- std::get<1>(_plane).allocator()->allocate();
- break;
- case Format::IYUV:
- case Format::YUV444:
- std::get<0>(_plane).allocator()->allocate();
- std::get<1>(_plane).allocator()->allocate();
- std::get<2>(_plane).allocator()->allocate();
- break;
- default:
- ARM_COMPUTE_ERROR("Not supported");
- break;
- }
-}
-
-CLImage *CLMultiImage::cl_plane(unsigned int index)
-{
- return &_plane[index];
-}
-
-const CLImage *CLMultiImage::cl_plane(unsigned int index) const
-{
- return &_plane[index];
-}
diff --git a/src/runtime/CL/CLPyramid.cpp b/src/runtime/CL/CLPyramid.cpp
deleted file mode 100644
index dfa542e73c..0000000000
--- a/src/runtime/CL/CLPyramid.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2016-2020 Arm Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#include "arm_compute/runtime/CL/CLPyramid.h"
-
-#include "arm_compute/core/Error.h"
-#include "arm_compute/core/PyramidInfo.h"
-#include "arm_compute/core/TensorInfo.h"
-#include "arm_compute/core/TensorShape.h"
-
-#include <array>
-#include <cmath>
-
-using namespace arm_compute;
-
-CLPyramid::CLPyramid()
- : _info(), _pyramid()
-{
-}
-
-void CLPyramid::init(const PyramidInfo &info)
-{
- internal_init(info, false);
-}
-
-void CLPyramid::init_auto_padding(const PyramidInfo &info)
-{
- internal_init(info, true);
-}
-
-void CLPyramid::internal_init(const PyramidInfo &info, bool auto_padding)
-{
- _info = info;
- _pyramid.resize(_info.num_levels());
-
- size_t w = _info.width();
- size_t h = _info.height();
- size_t ref_w = w;
- size_t ref_h = h;
- const bool is_orb_scale = (SCALE_PYRAMID_ORB == _info.scale());
- TensorShape tensor_shape = _info.tensor_shape();
-
- // Note: Look-up table used by the OpenVX sample implementation
- const std::array<float, 4> c_orbscale =
- {
- {
- 0.5f,
- SCALE_PYRAMID_ORB,
- SCALE_PYRAMID_ORB * SCALE_PYRAMID_ORB,
- SCALE_PYRAMID_ORB *SCALE_PYRAMID_ORB * SCALE_PYRAMID_ORB
- }
- };
-
- for(size_t i = 0; i < _info.num_levels(); ++i)
- {
- TensorInfo tensor_info(tensor_shape, _info.format());
-
- if(auto_padding)
- {
- tensor_info.auto_padding();
- }
-
- _pyramid[i].allocator()->init(tensor_info);
-
- if(is_orb_scale)
- {
- const float orb_scale = c_orbscale[(i + 1) % 4];
- w = std::ceil(ref_w * orb_scale);
- h = std::ceil(ref_h * orb_scale);
-
- if(0 == ((i + 1) % 4))
- {
- ref_w = w;
- ref_h = h;
- }
- }
- else
- {
- w = (w + 1) * _info.scale();
- h = (h + 1) * _info.scale();
- }
-
- // Update tensor_shape
- tensor_shape.set(0, w);
- tensor_shape.set(1, h);
- }
-}
-
-void CLPyramid::allocate()
-{
- for(size_t i = 0; i < _info.num_levels(); ++i)
- {
- _pyramid[i].allocator()->allocate();
- }
-}
-
-const PyramidInfo *CLPyramid::info() const
-{
- return &_info;
-}
-
-CLTensor *CLPyramid::get_pyramid_level(size_t index) const
-{
- ARM_COMPUTE_ERROR_ON(index >= _info.num_levels());
-
- return &_pyramid[index];
-}