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>
diff --git a/src/core/CL/CLKernels.h b/src/core/CL/CLKernels.h
index d81b60b..9676fa6 100644
--- a/src/core/CL/CLKernels.h
+++ b/src/core/CL/CLKernels.h
@@ -67,7 +67,6 @@
#include "src/core/CL/kernels/CLIm2ColKernel.h"
#include "src/core/CL/kernels/CLInstanceNormalizationLayerKernel.h"
#include "src/core/CL/kernels/CLL2NormalizeLayerKernel.h"
-#include "src/core/CL/kernels/CLLKTrackerKernel.h"
#include "src/core/CL/kernels/CLMaxUnpoolingLayerKernel.h"
#include "src/core/CL/kernels/CLMeanStdDevNormalizationKernel.h"
#include "src/core/CL/kernels/CLMinMaxLayerKernel.h"
diff --git a/src/core/CL/CLTracePoint.cpp b/src/core/CL/CLTracePoint.cpp
index c3d4899..c76eee7 100644
--- a/src/core/CL/CLTracePoint.cpp
+++ b/src/core/CL/CLTracePoint.cpp
@@ -23,13 +23,6 @@
*/
#include "arm_compute/core/TracePoint.h"
-#include "arm_compute/core/CL/CLTypes.h"
-#include "arm_compute/core/CL/ICLArray.h"
-#include "arm_compute/core/CL/ICLDistribution1D.h"
-#include "arm_compute/core/CL/ICLHOG.h"
-#include "arm_compute/core/CL/ICLLut.h"
-#include "arm_compute/core/CL/ICLMultiHOG.h"
-#include "arm_compute/core/CL/ICLMultiImage.h"
#include "arm_compute/core/CL/ICLTensor.h"
#include "utils/TypePrinter.h"
@@ -52,34 +45,16 @@
}
ARM_COMPUTE_TRACE_TO_STRING(std::vector<ICLTensor *>)
-ARM_COMPUTE_TRACE_TO_STRING(ICLMultiImage)
-ARM_COMPUTE_TRACE_TO_STRING(ICLDetectionWindowArray)
-ARM_COMPUTE_TRACE_TO_STRING(ICLKeyPointArray)
ARM_COMPUTE_TRACE_TO_STRING(ICLLKInternalKeypointArray)
ARM_COMPUTE_TRACE_TO_STRING(ICLCoefficientTableArray)
-ARM_COMPUTE_TRACE_TO_STRING(ICLCoordinates2DArray)
ARM_COMPUTE_TRACE_TO_STRING(ICLOldValArray)
ARM_COMPUTE_TRACE_TO_STRING(cl::Buffer)
-ARM_COMPUTE_TRACE_TO_STRING(ICLDistribution1D)
-ARM_COMPUTE_TRACE_TO_STRING(ICLMultiHOG)
-ARM_COMPUTE_TRACE_TO_STRING(ICLHOG)
-ARM_COMPUTE_TRACE_TO_STRING(ICLLut)
-ARM_COMPUTE_TRACE_TO_STRING(ICLSize2DArray)
ARM_COMPUTE_TRACE_TO_STRING(std::vector<const ICLTensor *>)
ARM_COMPUTE_CONST_PTR_CLASS(std::vector<ICLTensor *>)
-ARM_COMPUTE_CONST_PTR_CLASS(ICLMultiImage)
-ARM_COMPUTE_CONST_PTR_CLASS(ICLDetectionWindowArray)
-ARM_COMPUTE_CONST_PTR_CLASS(ICLKeyPointArray)
ARM_COMPUTE_CONST_PTR_CLASS(ICLLKInternalKeypointArray)
ARM_COMPUTE_CONST_PTR_CLASS(ICLCoefficientTableArray)
-ARM_COMPUTE_CONST_PTR_CLASS(ICLCoordinates2DArray)
ARM_COMPUTE_CONST_PTR_CLASS(ICLOldValArray)
ARM_COMPUTE_CONST_PTR_CLASS(cl::Buffer)
-ARM_COMPUTE_CONST_PTR_CLASS(ICLDistribution1D)
-ARM_COMPUTE_CONST_PTR_CLASS(ICLMultiHOG)
-ARM_COMPUTE_CONST_PTR_CLASS(ICLHOG)
-ARM_COMPUTE_CONST_PTR_CLASS(ICLLut)
-ARM_COMPUTE_CONST_PTR_CLASS(ICLSize2DArray)
ARM_COMPUTE_CONST_PTR_CLASS(std::vector<const ICLTensor *>)
} // namespace arm_compute
diff --git a/src/core/CL/ICLDistribution1D.cpp b/src/core/CL/ICLDistribution1D.cpp
deleted file mode 100644
index d185f13..0000000
--- a/src/core/CL/ICLDistribution1D.cpp
+++ /dev/null
@@ -1,51 +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/core/CL/ICLDistribution1D.h"
-
-#include "arm_compute/core/Error.h"
-
-using namespace arm_compute;
-
-ICLDistribution1D::ICLDistribution1D(size_t num_bins, int32_t offset, uint32_t range)
- : IDistribution1D(num_bins, offset, range), _mapping(nullptr)
-{
-}
-
-void ICLDistribution1D::map(cl::CommandQueue &q, bool blocking)
-{
- ARM_COMPUTE_ERROR_ON(_mapping != nullptr);
- _mapping = do_map(q, blocking);
-}
-
-void ICLDistribution1D::unmap(cl::CommandQueue &q)
-{
- ARM_COMPUTE_ERROR_ON(_mapping == nullptr);
- do_unmap(q);
- _mapping = nullptr;
-}
-
-uint32_t *ICLDistribution1D::buffer() const
-{
- return _mapping;
-}
diff --git a/src/core/CL/ICLHOG.cpp b/src/core/CL/ICLHOG.cpp
deleted file mode 100644
index aaabe86..0000000
--- a/src/core/CL/ICLHOG.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 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/core/CL/ICLHOG.h"
-
-using namespace arm_compute;
-
-ICLHOG::ICLHOG()
- : _mapping(nullptr)
-{
-}
-
-void ICLHOG::map(cl::CommandQueue &q, bool blocking)
-{
- _mapping = do_map(q, blocking);
-}
-
-void ICLHOG::unmap(cl::CommandQueue &q)
-{
- do_unmap(q);
- _mapping = nullptr;
-}
-
-float *ICLHOG::descriptor() const
-{
- return reinterpret_cast<float *>(_mapping);
-}
\ No newline at end of file
diff --git a/src/core/CL/ICLLut.cpp b/src/core/CL/ICLLut.cpp
deleted file mode 100644
index 007a524..0000000
--- a/src/core/CL/ICLLut.cpp
+++ /dev/null
@@ -1,47 +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/core/CL/ICLLut.h"
-
-using namespace arm_compute;
-
-ICLLut::ICLLut()
- : _mapping(nullptr)
-{
-}
-
-void ICLLut::map(cl::CommandQueue &q, bool blocking)
-{
- _mapping = do_map(q, blocking);
-}
-
-void ICLLut::unmap(cl::CommandQueue &q)
-{
- do_unmap(q);
- _mapping = nullptr;
-}
-
-uint8_t *ICLLut::buffer() const
-{
- return _mapping;
-}
diff --git a/src/core/CL/ICLMultiHOG.cpp b/src/core/CL/ICLMultiHOG.cpp
deleted file mode 100644
index 73bee39..0000000
--- a/src/core/CL/ICLMultiHOG.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 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/core/CL/ICLMultiHOG.h"
-
-#include "arm_compute/core/IHOG.h"
-
-using namespace arm_compute;
-
-IHOG *ICLMultiHOG::model(size_t index)
-{
- return cl_model(index);
-}
-
-const IHOG *ICLMultiHOG::model(size_t index) const
-{
- return cl_model(index);
-}
\ No newline at end of file
diff --git a/src/core/CL/ICLMultiImage.cpp b/src/core/CL/ICLMultiImage.cpp
deleted file mode 100644
index 01b05fc..0000000
--- a/src/core/CL/ICLMultiImage.cpp
+++ /dev/null
@@ -1,39 +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/core/CL/ICLMultiImage.h"
-
-#include "arm_compute/core/CL/ICLTensor.h"
-#include "arm_compute/core/ITensor.h"
-
-using namespace arm_compute;
-
-IImage *ICLMultiImage::plane(unsigned int index)
-{
- return cl_plane(index);
-}
-
-const IImage *ICLMultiImage::plane(unsigned int index) const
-{
- return cl_plane(index);
-}
diff --git a/src/core/CL/kernels/CLBoundingBoxTransformKernel.cpp b/src/core/CL/kernels/CLBoundingBoxTransformKernel.cpp
index 2c12275..4c20d93 100644
--- a/src/core/CL/kernels/CLBoundingBoxTransformKernel.cpp
+++ b/src/core/CL/kernels/CLBoundingBoxTransformKernel.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020 Arm Limited.
+ * Copyright (c) 2018-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -25,7 +25,6 @@
#include "arm_compute/core/CL/CLHelpers.h"
#include "arm_compute/core/CL/CLKernelLibrary.h"
-#include "arm_compute/core/CL/ICLArray.h"
#include "arm_compute/core/CL/ICLTensor.h"
#include "arm_compute/core/CL/OpenCL.h"
#include "arm_compute/core/Helpers.h"
diff --git a/src/core/CL/kernels/CLGenerateProposalsLayerKernel.cpp b/src/core/CL/kernels/CLGenerateProposalsLayerKernel.cpp
index 988bb39..8c94fb5 100644
--- a/src/core/CL/kernels/CLGenerateProposalsLayerKernel.cpp
+++ b/src/core/CL/kernels/CLGenerateProposalsLayerKernel.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020 Arm Limited.
+ * Copyright (c) 2019-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -25,7 +25,6 @@
#include "arm_compute/core/CL/CLHelpers.h"
#include "arm_compute/core/CL/CLKernelLibrary.h"
-#include "arm_compute/core/CL/ICLArray.h"
#include "arm_compute/core/CL/ICLTensor.h"
#include "arm_compute/core/CL/OpenCL.h"
#include "arm_compute/core/Helpers.h"
diff --git a/src/core/CL/kernels/CLLKTrackerKernel.cpp b/src/core/CL/kernels/CLLKTrackerKernel.cpp
deleted file mode 100644
index a439c24..0000000
--- a/src/core/CL/kernels/CLLKTrackerKernel.cpp
+++ /dev/null
@@ -1,314 +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 "src/core/CL/kernels/CLLKTrackerKernel.h"
-
-#include "arm_compute/core/CL/CLKernelLibrary.h"
-#include "arm_compute/core/CL/ICLArray.h"
-#include "arm_compute/core/CL/ICLTensor.h"
-#include "arm_compute/core/Coordinates.h"
-#include "arm_compute/core/Helpers.h"
-#include "arm_compute/core/TensorInfo.h"
-#include "arm_compute/core/Validate.h"
-#include "src/core/AccessWindowStatic.h"
-#include "src/core/helpers/WindowHelpers.h"
-
-#include <cmath>
-
-using namespace arm_compute;
-
-void CLLKTrackerInitKernel::configure(const ICLKeyPointArray *old_points, const ICLKeyPointArray *new_points_estimates,
- ICLLKInternalKeypointArray *old_points_internal, ICLLKInternalKeypointArray *new_points_internal,
- bool use_initial_estimate, size_t level, size_t num_levels, float pyramid_scale)
-{
- configure(CLKernelLibrary::get().get_compile_context(), old_points, new_points_estimates, old_points_internal, new_points_internal, use_initial_estimate, level, num_levels, pyramid_scale);
-}
-
-void CLLKTrackerInitKernel::configure(const CLCompileContext &compile_context, const ICLKeyPointArray *old_points, const ICLKeyPointArray *new_points_estimates,
- ICLLKInternalKeypointArray *old_points_internal, ICLLKInternalKeypointArray *new_points_internal,
- bool use_initial_estimate, size_t level, size_t num_levels, float pyramid_scale)
-
-{
- ARM_COMPUTE_ERROR_ON(old_points == nullptr);
- ARM_COMPUTE_ERROR_ON(old_points_internal == nullptr);
- ARM_COMPUTE_ERROR_ON(new_points_internal == nullptr);
-
- const float scale = std::pow(pyramid_scale, level);
-
- // Create kernel
- std::string kernel_name = "init_level";
- if(level == (num_levels - 1))
- {
- kernel_name += (use_initial_estimate) ? std::string("_max_initial_estimate") : std::string("_max");
- }
- _kernel = create_kernel(compile_context, kernel_name);
-
- // Set static kernel arguments
- unsigned int idx = 0;
- if(level == (num_levels - 1))
- {
- _kernel.setArg(idx++, old_points->cl_buffer());
- if(use_initial_estimate)
- {
- _kernel.setArg(idx++, new_points_estimates->cl_buffer());
- }
- }
- _kernel.setArg(idx++, old_points_internal->cl_buffer());
- _kernel.setArg(idx++, new_points_internal->cl_buffer());
- _kernel.setArg<cl_float>(idx++, scale);
-
- // Configure kernel window
- Window window;
- window.set(Window::DimX, Window::Dimension(0, old_points->num_values(), 1));
- window.set(Window::DimY, Window::Dimension(0, 1, 1));
- ICLKernel::configure_internal(window);
-}
-
-void CLLKTrackerInitKernel::run(const Window &window, cl::CommandQueue &queue)
-{
- ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
- ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(ICLKernel::window(), window);
-
- enqueue(queue, *this, window, lws_hint());
-}
-
-void CLLKTrackerFinalizeKernel::configure(ICLLKInternalKeypointArray *new_points_internal, ICLKeyPointArray *new_points)
-{
- configure(CLKernelLibrary::get().get_compile_context(), new_points_internal, new_points);
-}
-
-void CLLKTrackerFinalizeKernel::configure(const CLCompileContext &compile_context, ICLLKInternalKeypointArray *new_points_internal, ICLKeyPointArray *new_points)
-
-{
- ARM_COMPUTE_ERROR_ON(new_points_internal == nullptr);
- ARM_COMPUTE_ERROR_ON(new_points == nullptr);
-
- // Create kernel
- _kernel = create_kernel(compile_context, "finalize");
-
- // Set static kernel arguments
- unsigned int idx = 0;
- _kernel.setArg(idx++, new_points_internal->cl_buffer());
- _kernel.setArg(idx++, new_points->cl_buffer());
-
- // Configure kernel window
- Window window;
- window.set(Window::DimX, Window::Dimension(0, new_points_internal->num_values(), 1));
- window.set(Window::DimY, Window::Dimension(0, 1, 1));
- ICLKernel::configure_internal(window);
-}
-
-void CLLKTrackerFinalizeKernel::run(const Window &window, cl::CommandQueue &queue)
-{
- ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
- ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(ICLKernel::window(), window);
-
- enqueue(queue, *this, window, lws_hint());
-}
-
-CLLKTrackerStage0Kernel::CLLKTrackerStage0Kernel()
- : _old_input(nullptr), _old_scharr_gx(nullptr), _old_scharr_gy(nullptr)
-{
-}
-
-void CLLKTrackerStage0Kernel::configure(const ICLTensor *old_input, const ICLTensor *old_scharr_gx, const ICLTensor *old_scharr_gy,
- ICLLKInternalKeypointArray *old_points_internal, ICLLKInternalKeypointArray *new_points_internal,
- ICLCoefficientTableArray *coeff_table, ICLOldValArray *old_ival,
- size_t window_dimension, size_t level)
-{
- configure(CLKernelLibrary::get().get_compile_context(), old_input, old_scharr_gx, old_scharr_gy, old_points_internal, new_points_internal, coeff_table, old_ival, window_dimension, level);
-}
-
-void CLLKTrackerStage0Kernel::configure(const CLCompileContext &compile_context, const ICLTensor *old_input, const ICLTensor *old_scharr_gx, const ICLTensor *old_scharr_gy,
- ICLLKInternalKeypointArray *old_points_internal, ICLLKInternalKeypointArray *new_points_internal,
- ICLCoefficientTableArray *coeff_table, ICLOldValArray *old_ival,
- size_t window_dimension, size_t level)
-
-{
- ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(old_input, 1, DataType::U8);
- ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(old_scharr_gx, 1, DataType::S16);
- ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(old_scharr_gy, 1, DataType::S16);
- ARM_COMPUTE_ERROR_ON(old_points_internal == nullptr);
- ARM_COMPUTE_ERROR_ON(new_points_internal == nullptr);
- ARM_COMPUTE_ERROR_ON(coeff_table == nullptr);
- ARM_COMPUTE_ERROR_ON(old_ival == nullptr);
-
- _old_input = old_input;
- _old_scharr_gx = old_scharr_gx;
- _old_scharr_gy = old_scharr_gy;
-
- // Configure kernel window
- Window window;
- window.set(Window::DimX, Window::Dimension(0, new_points_internal->num_values(), 1));
- window.set(Window::DimY, Window::Dimension(0, 1, 1));
-
- const ValidRegion valid_region = intersect_valid_regions(
- old_input->info()->valid_region(),
- old_scharr_gx->info()->valid_region(),
- old_scharr_gy->info()->valid_region());
-
- update_window_and_padding(window,
- AccessWindowStatic(old_input->info(), valid_region.start(0), valid_region.start(1),
- valid_region.end(0), valid_region.end(1)),
- AccessWindowStatic(old_scharr_gx->info(), valid_region.start(0), valid_region.start(1),
- valid_region.end(0), valid_region.end(1)),
- AccessWindowStatic(old_scharr_gy->info(), valid_region.start(0), valid_region.start(1),
- valid_region.end(0), valid_region.end(1)));
-
- ICLKernel::configure_internal(window);
-
- // Initialize required variables
- const int level0 = (level == 0) ? 1 : 0;
- const int window_size = window_dimension;
- const int window_size_squared = window_dimension * window_dimension;
- const int window_size_half = window_dimension / 2;
- const float eig_const = 1.0f / (2.0f * window_size_squared);
- const cl_float3 border_limits =
- {
- {
- // -1 because we load 2 values at once for bilinear interpolation
- static_cast<cl_float>(valid_region.end(0) - window_size - 1),
- static_cast<cl_float>(valid_region.end(1) - window_size - 1),
- static_cast<cl_float>(valid_region.start(0))
- }
- };
-
- // Create kernel
- _kernel = create_kernel(compile_context, "lktracker_stage0");
-
- // Set arguments
- unsigned int idx = 3 * num_arguments_per_2D_tensor();
- _kernel.setArg(idx++, old_points_internal->cl_buffer());
- _kernel.setArg(idx++, new_points_internal->cl_buffer());
- _kernel.setArg(idx++, coeff_table->cl_buffer());
- _kernel.setArg(idx++, old_ival->cl_buffer());
- _kernel.setArg<cl_int>(idx++, window_size);
- _kernel.setArg<cl_int>(idx++, window_size_squared);
- _kernel.setArg<cl_int>(idx++, window_size_half);
- _kernel.setArg<cl_float3>(idx++, border_limits);
- _kernel.setArg<cl_float>(idx++, eig_const);
- _kernel.setArg<cl_int>(idx++, level0);
-}
-
-void CLLKTrackerStage0Kernel::run(const Window &window, cl::CommandQueue &queue)
-{
- ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
- ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(ICLKernel::window(), window);
-
- // Set static tensor arguments. Setting here as allocation might be deferred.
- unsigned int idx = 0;
- add_2D_tensor_argument(idx, _old_input, window);
- add_2D_tensor_argument(idx, _old_scharr_gx, window);
- add_2D_tensor_argument(idx, _old_scharr_gy, window);
-
- enqueue(queue, *this, window, lws_hint());
-}
-
-CLLKTrackerStage1Kernel::CLLKTrackerStage1Kernel()
- : _new_input(nullptr)
-{
-}
-
-void CLLKTrackerStage1Kernel::configure(const ICLTensor *new_input, ICLLKInternalKeypointArray *new_points_internal, ICLCoefficientTableArray *coeff_table, ICLOldValArray *old_ival,
- Termination termination, float epsilon, size_t num_iterations, size_t window_dimension, size_t level)
-{
- configure(CLKernelLibrary::get().get_compile_context(), new_input, new_points_internal, coeff_table, old_ival, termination, epsilon, num_iterations, window_dimension, level);
-}
-
-void CLLKTrackerStage1Kernel::configure(const CLCompileContext &compile_context, const ICLTensor *new_input, ICLLKInternalKeypointArray *new_points_internal, ICLCoefficientTableArray *coeff_table,
- ICLOldValArray *old_ival,
- Termination termination, float epsilon, size_t num_iterations, size_t window_dimension, size_t level)
-
-{
- ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(new_input, 1, DataType::U8);
- ARM_COMPUTE_ERROR_ON(new_points_internal == nullptr);
- ARM_COMPUTE_ERROR_ON(coeff_table == nullptr);
- ARM_COMPUTE_ERROR_ON(old_ival == nullptr);
-
- _new_input = new_input;
-
- // Configure kernel window
- Window window;
- window.set(Window::DimX, Window::Dimension(0, new_points_internal->num_values(), 1));
- window.set(Window::DimY, Window::Dimension(0, 1, 1));
-
- const ValidRegion &valid_region = new_input->info()->valid_region();
-
- update_window_and_padding(window,
- AccessWindowStatic(new_input->info(), valid_region.start(0), valid_region.start(1),
- valid_region.end(0), valid_region.end(1)));
-
- ICLKernel::configure_internal(window);
-
- // Initialize required variables
- const int level0 = (level == 0) ? 1 : 0;
- const int window_size = window_dimension;
- const int window_size_squared = window_dimension * window_dimension;
- const int window_size_half = window_dimension / 2;
- const float eig_const = 1.0f / (2.0f * window_size_squared);
- const cl_float3 border_limits =
- {
- {
- // -1 because we load 2 values at once for bilinear interpolation
- static_cast<cl_float>(valid_region.end(0) - window_size - 1),
- static_cast<cl_float>(valid_region.end(1) - window_size - 1),
- static_cast<cl_float>(valid_region.start(0))
- }
- };
-
- // Set maximum number of iterations used for convergence
- const size_t max_iterations = 1000;
- num_iterations = (termination == Termination::TERM_CRITERIA_EPSILON) ? max_iterations : num_iterations;
-
- const int term_epsilon = (termination == Termination::TERM_CRITERIA_EPSILON || termination == Termination::TERM_CRITERIA_BOTH) ? 1 : 0;
-
- // Create kernel
- _kernel = create_kernel(compile_context, "lktracker_stage1");
-
- // Set static kernel arguments
- unsigned int idx = num_arguments_per_2D_tensor();
- _kernel.setArg(idx++, new_points_internal->cl_buffer());
- _kernel.setArg(idx++, coeff_table->cl_buffer());
- _kernel.setArg(idx++, old_ival->cl_buffer());
- _kernel.setArg<cl_int>(idx++, window_size);
- _kernel.setArg<cl_int>(idx++, window_size_squared);
- _kernel.setArg<cl_int>(idx++, window_size_half);
- _kernel.setArg<cl_int>(idx++, num_iterations);
- _kernel.setArg<cl_float>(idx++, epsilon);
- _kernel.setArg<cl_float3>(idx++, border_limits);
- _kernel.setArg<cl_float>(idx++, eig_const);
- _kernel.setArg<cl_int>(idx++, level0);
- _kernel.setArg<cl_int>(idx++, term_epsilon);
-}
-
-void CLLKTrackerStage1Kernel::run(const Window &window, cl::CommandQueue &queue)
-{
- ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
- ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(ICLKernel::window(), window);
-
- // Set static tensor arguments. Setting here as allocation might be deferred.
- unsigned int idx = 0;
- add_2D_tensor_argument(idx, _new_input, window);
-
- enqueue(queue, *this, window, lws_hint());
-}
diff --git a/src/core/CL/kernels/CLLKTrackerKernel.h b/src/core/CL/kernels/CLLKTrackerKernel.h
deleted file mode 100644
index 2d29668..0000000
--- a/src/core/CL/kernels/CLLKTrackerKernel.h
+++ /dev/null
@@ -1,206 +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.
- */
-#ifndef ARM_COMPUTE_CLLKTRACKERKERNEL_H
-#define ARM_COMPUTE_CLLKTRACKERKERNEL_H
-
-#include "arm_compute/core/CL/ICLArray.h"
-#include "arm_compute/core/Types.h"
-#include "src/core/CL/ICLKernel.h"
-
-#include <cstddef>
-#include <cstdint>
-
-namespace arm_compute
-{
-class ICLTensor;
-
-/** Interface to run the initialization step of LKTracker */
-class CLLKTrackerInitKernel : public ICLKernel
-{
-public:
- /** Initialise the kernel input and output
- *
- * @param[in] old_points Pointer to the @ref ICLKeyPointArray storing old key points
- * @param[in] new_points_estimates Pointer to the @ref ICLKeyPointArray storing new estimates key points
- * @param[out] old_points_internal Pointer to the array of internal @ref CLLKInternalKeypoint old points
- * @param[out] new_points_internal Pointer to the array of internal @ref CLLKInternalKeypoint new points
- * @param[in] use_initial_estimate The flag to indicate whether the initial estimated position should be used
- * @param[in] level The pyramid level
- * @param[in] num_levels The number of pyramid levels
- * @param[in] pyramid_scale Scale factor used for generating the pyramid
- */
- void configure(const ICLKeyPointArray *old_points, const ICLKeyPointArray *new_points_estimates,
- ICLLKInternalKeypointArray *old_points_internal, ICLLKInternalKeypointArray *new_points_internal,
- bool use_initial_estimate, size_t level, size_t num_levels, float pyramid_scale);
- /** Initialise the kernel input and output
- *
- * @param[in] compile_context The compile context to be used.
- * @param[in] old_points Pointer to the @ref ICLKeyPointArray storing old key points
- * @param[in] new_points_estimates Pointer to the @ref ICLKeyPointArray storing new estimates key points
- * @param[out] old_points_internal Pointer to the array of internal @ref CLLKInternalKeypoint old points
- * @param[out] new_points_internal Pointer to the array of internal @ref CLLKInternalKeypoint new points
- * @param[in] use_initial_estimate The flag to indicate whether the initial estimated position should be used
- * @param[in] level The pyramid level
- * @param[in] num_levels The number of pyramid levels
- * @param[in] pyramid_scale Scale factor used for generating the pyramid
- */
- void configure(const CLCompileContext &compile_context, const ICLKeyPointArray *old_points, const ICLKeyPointArray *new_points_estimates,
- ICLLKInternalKeypointArray *old_points_internal, ICLLKInternalKeypointArray *new_points_internal,
- bool use_initial_estimate, size_t level, size_t num_levels, float pyramid_scale);
-
- // Inherited methods overridden:
- void run(const Window &window, cl::CommandQueue &queue) override;
-};
-
-/** Interface to run the finalize step of LKTracker, where it truncates the coordinates stored in new_points array */
-class CLLKTrackerFinalizeKernel : public ICLKernel
-{
-public:
- /** Initialise the kernel input and output
- *
- * @param[in] new_points_internal Pointer to the array of internal @ref CLLKInternalKeypoint new points
- * @param[out] new_points Pointer to the @ref ICLKeyPointArray storing new key points
- */
- void configure(ICLLKInternalKeypointArray *new_points_internal, ICLKeyPointArray *new_points);
- /** Initialise the kernel input and output
- *
- * @param[in] compile_context The compile context to be used.
- * @param[in] new_points_internal Pointer to the array of internal @ref CLLKInternalKeypoint new points
- * @param[out] new_points Pointer to the @ref ICLKeyPointArray storing new key points
- */
- void configure(const CLCompileContext &compile_context, ICLLKInternalKeypointArray *new_points_internal, ICLKeyPointArray *new_points);
-
- // Inherited methods overridden:
- void run(const Window &window, cl::CommandQueue &queue) override;
-};
-
-/** Interface to run the first stage of LKTracker, where A11, A12, A22, min_eig, ival, ixval and iyval are computed */
-class CLLKTrackerStage0Kernel : public ICLKernel
-{
-public:
- /** Default constructor */
- CLLKTrackerStage0Kernel();
- /** Prevent instances of this class from being copied (As this class contains pointers) */
- CLLKTrackerStage0Kernel(const CLLKTrackerStage0Kernel &) = delete;
- /** Prevent instances of this class from being copied (As this class contains pointers) */
- CLLKTrackerStage0Kernel &operator=(const CLLKTrackerStage0Kernel &) = delete;
- /** Allow instances of this class to be moved */
- CLLKTrackerStage0Kernel(CLLKTrackerStage0Kernel &&) = default;
- /** Allow instances of this class to be moved */
- CLLKTrackerStage0Kernel &operator=(CLLKTrackerStage0Kernel &&) = default;
- /** Initialise the kernel input and output
- *
- * @param[in] old_input Pointer to the input old tensor. Data types supported: U8
- * @param[in] old_scharr_gx Pointer to the input scharr X tensor. Data types supported: S16
- * @param[in] old_scharr_gy Pointer to the input scharr Y tensor. Data types supported: S16
- * @param[in] old_points_internal Pointer to the array of CLLKInternalKeypoint old points
- * @param[in, out] new_points_internal Pointer to the array of CLLKInternalKeypoint new points
- * @param[out] coeff_table Pointer to the array holding the Spatial Gradient coefficients
- * @param[out] old_ival Pointer to the array holding internal values
- * @param[in] window_dimension The size of the window on which to perform the algorithm
- * @param[in] level The pyramid level
- */
- void configure(const ICLTensor *old_input, const ICLTensor *old_scharr_gx, const ICLTensor *old_scharr_gy,
- ICLLKInternalKeypointArray *old_points_internal, ICLLKInternalKeypointArray *new_points_internal,
- ICLCoefficientTableArray *coeff_table, ICLOldValArray *old_ival,
- size_t window_dimension, size_t level);
- /** Initialise the kernel input and output
- *
- * @param[in] compile_context The compile context to be used.
- * @param[in] old_input Pointer to the input old tensor. Data types supported: U8
- * @param[in] old_scharr_gx Pointer to the input scharr X tensor. Data types supported: S16
- * @param[in] old_scharr_gy Pointer to the input scharr Y tensor. Data types supported: S16
- * @param[in] old_points_internal Pointer to the array of CLLKInternalKeypoint old points
- * @param[in, out] new_points_internal Pointer to the array of CLLKInternalKeypoint new points
- * @param[out] coeff_table Pointer to the array holding the Spatial Gradient coefficients
- * @param[out] old_ival Pointer to the array holding internal values
- * @param[in] window_dimension The size of the window on which to perform the algorithm
- * @param[in] level The pyramid level
- */
- void configure(const CLCompileContext &compile_context, const ICLTensor *old_input, const ICLTensor *old_scharr_gx, const ICLTensor *old_scharr_gy,
- ICLLKInternalKeypointArray *old_points_internal, ICLLKInternalKeypointArray *new_points_internal,
- ICLCoefficientTableArray *coeff_table, ICLOldValArray *old_ival,
- size_t window_dimension, size_t level);
-
- // Inherited methods overridden:
- void run(const Window &window, cl::CommandQueue &queue) override;
-
-private:
- const ICLTensor *_old_input;
- const ICLTensor *_old_scharr_gx;
- const ICLTensor *_old_scharr_gy;
-};
-
-/** Interface to run the second stage of LKTracker, where the motion vectors of the given points are computed */
-class CLLKTrackerStage1Kernel : public ICLKernel
-{
-public:
- /** Default constructor */
- CLLKTrackerStage1Kernel();
- /** Prevent instances of this class from being copied (As this class contains pointers) */
- CLLKTrackerStage1Kernel(const CLLKTrackerStage1Kernel &) = delete;
- /** Prevent instances of this class from being copied (As this class contains pointers) */
- CLLKTrackerStage1Kernel &operator=(const CLLKTrackerStage1Kernel &) = delete;
- /** Allow instances of this class to be moved */
- CLLKTrackerStage1Kernel(CLLKTrackerStage1Kernel &&) = default;
- /** Allow instances of this class to be moved */
- CLLKTrackerStage1Kernel &operator=(CLLKTrackerStage1Kernel &&) = default;
- /** Initialise the kernel input and output
- *
- * @param[in] new_input Pointer to the input new tensor. Data types supported: U8
- * @param[in, out] new_points_internal Pointer to the array of CLLKInternalKeypoint for new points
- * @param[in] coeff_table Pointer to the array holding the Spatial Gradient coefficients
- * @param[in] old_ival Pointer to the array holding internal values
- * @param[in] termination The criteria to terminate the search of each keypoint.
- * @param[in] epsilon The error for terminating the algorithm
- * @param[in] num_iterations The maximum number of iterations before terminating the algorithm
- * @param[in] window_dimension The size of the window on which to perform the algorithm
- * @param[in] level The pyramid level
- */
- void configure(const ICLTensor *new_input, ICLLKInternalKeypointArray *new_points_internal, ICLCoefficientTableArray *coeff_table, ICLOldValArray *old_ival,
- Termination termination, float epsilon, size_t num_iterations, size_t window_dimension, size_t level);
- /** Initialise the kernel input and output
- *
- * @param[in] compile_context The compile context to be used.
- * @param[in] new_input Pointer to the input new tensor. Data types supported: U8
- * @param[in, out] new_points_internal Pointer to the array of CLLKInternalKeypoint for new points
- * @param[in] coeff_table Pointer to the array holding the Spatial Gradient coefficients
- * @param[in] old_ival Pointer to the array holding internal values
- * @param[in] termination The criteria to terminate the search of each keypoint.
- * @param[in] epsilon The error for terminating the algorithm
- * @param[in] num_iterations The maximum number of iterations before terminating the algorithm
- * @param[in] window_dimension The size of the window on which to perform the algorithm
- * @param[in] level The pyramid level
- */
- void configure(const CLCompileContext &compile_context, const ICLTensor *new_input, ICLLKInternalKeypointArray *new_points_internal, ICLCoefficientTableArray *coeff_table, ICLOldValArray *old_ival,
- Termination termination, float epsilon, size_t num_iterations, size_t window_dimension, size_t level);
-
- // Inherited methods overridden:
- void run(const Window &window, cl::CommandQueue &queue) override;
-
-private:
- const ICLTensor *_new_input;
-};
-} // namespace arm_compute
-#endif /*ARM_COMPUTE_CLLKTRACKERKERNEL_H */
diff --git a/src/core/CL/kernels/CLROIAlignLayerKernel.cpp b/src/core/CL/kernels/CLROIAlignLayerKernel.cpp
index 87f4a5d..fdaa86c 100644
--- a/src/core/CL/kernels/CLROIAlignLayerKernel.cpp
+++ b/src/core/CL/kernels/CLROIAlignLayerKernel.cpp
@@ -25,7 +25,6 @@
#include "arm_compute/core/CL/CLHelpers.h"
#include "arm_compute/core/CL/CLKernelLibrary.h"
-#include "arm_compute/core/CL/ICLArray.h"
#include "arm_compute/core/CL/ICLTensor.h"
#include "arm_compute/core/CL/OpenCL.h"
#include "arm_compute/core/Helpers.h"
diff --git a/src/core/CL/kernels/CLROIAlignLayerKernel.h b/src/core/CL/kernels/CLROIAlignLayerKernel.h
index cbf0e00..5284a59 100644
--- a/src/core/CL/kernels/CLROIAlignLayerKernel.h
+++ b/src/core/CL/kernels/CLROIAlignLayerKernel.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020 Arm Limited.
+ * Copyright (c) 2018-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -24,9 +24,7 @@
#ifndef ARM_COMPUTE_CLROIALIGNLAYERKERNEL_H
#define ARM_COMPUTE_CLROIALIGNLAYERKERNEL_H
-#include "arm_compute/core/CL/ICLArray.h"
#include "src/core/CL/ICLKernel.h"
-
namespace arm_compute
{
class ICLTensor;
diff --git a/src/core/CL/kernels/CLROIPoolingLayerKernel.cpp b/src/core/CL/kernels/CLROIPoolingLayerKernel.cpp
index 175691a..5867cde 100644
--- a/src/core/CL/kernels/CLROIPoolingLayerKernel.cpp
+++ b/src/core/CL/kernels/CLROIPoolingLayerKernel.cpp
@@ -25,7 +25,6 @@
#include "arm_compute/core/CL/CLHelpers.h"
#include "arm_compute/core/CL/CLKernelLibrary.h"
-#include "arm_compute/core/CL/ICLArray.h"
#include "arm_compute/core/CL/ICLTensor.h"
#include "arm_compute/core/CL/OpenCL.h"
#include "arm_compute/core/Helpers.h"
diff --git a/src/core/CL/kernels/CLROIPoolingLayerKernel.h b/src/core/CL/kernels/CLROIPoolingLayerKernel.h
index 35f42a9..124ae3f 100644
--- a/src/core/CL/kernels/CLROIPoolingLayerKernel.h
+++ b/src/core/CL/kernels/CLROIPoolingLayerKernel.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2020 Arm Limited.
+ * Copyright (c) 2017-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -25,9 +25,6 @@
#define ARM_COMPUTE_CLROIPOOLINGLAYERKERNEL_H
#include "src/core/CL/ICLKernel.h"
-
-#include "arm_compute/core/CL/ICLArray.h"
-
namespace arm_compute
{
class ICLTensor;
diff --git a/src/core/CPP/kernels/CPPCornerCandidatesKernel.cpp b/src/core/CPP/kernels/CPPCornerCandidatesKernel.cpp
deleted file mode 100644
index a134e3e..0000000
--- a/src/core/CPP/kernels/CPPCornerCandidatesKernel.cpp
+++ /dev/null
@@ -1,102 +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/core/CPP/kernels/CPPCornerCandidatesKernel.h"
-
-#include "arm_compute/core/Helpers.h"
-#include "arm_compute/core/TensorInfo.h"
-#include "src/core/helpers/WindowHelpers.h"
-
-using namespace arm_compute;
-
-namespace
-{
-inline void check_corner(float x, float y, float strength, InternalKeypoint *output, int32_t *num_corner_candidates, arm_compute::Mutex *corner_candidates_mutex)
-{
- if(strength != 0.0f)
- {
- /* Set index and update num_corner_candidate */
- arm_compute::unique_lock<arm_compute::Mutex> lock(*corner_candidates_mutex);
-
- const int32_t idx = *num_corner_candidates;
-
- *num_corner_candidates += 1;
-
- lock.unlock();
-
- /* Add keypoint */
- output[idx] = std::make_tuple(x, y, strength);
- }
-}
-
-inline void corner_candidates(const float *__restrict input, InternalKeypoint *__restrict output, int32_t x, int32_t y, int32_t *num_corner_candidates, arm_compute::Mutex *corner_candidates_mutex)
-{
- check_corner(x, y, *input, output, num_corner_candidates, corner_candidates_mutex);
-}
-} // namespace
-
-bool keypoint_compare(const InternalKeypoint &lhs, const InternalKeypoint &rhs)
-{
- return std::get<2>(lhs) > std::get<2>(rhs);
-}
-
-CPPCornerCandidatesKernel::CPPCornerCandidatesKernel()
- : _num_corner_candidates(nullptr), _corner_candidates_mutex(), _input(nullptr), _output(nullptr)
-{
-}
-
-void CPPCornerCandidatesKernel::configure(const IImage *input, InternalKeypoint *output, int32_t *num_corner_candidates)
-{
- ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(input);
- ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::F32);
- ARM_COMPUTE_ERROR_ON(nullptr == output);
- ARM_COMPUTE_ERROR_ON(nullptr == num_corner_candidates);
- ARM_COMPUTE_ERROR_ON(*num_corner_candidates != 0);
-
- _input = input;
- _output = output;
- _num_corner_candidates = num_corner_candidates;
-
- const unsigned int num_elems_processed_per_iteration = 1;
-
- // Configure kernel window
- Window win = calculate_max_window(*input->info(), Steps(num_elems_processed_per_iteration));
-
- update_window_and_padding(win, AccessWindowHorizontal(input->info(), 0, num_elems_processed_per_iteration));
-
- ICPPKernel::configure(win);
-}
-
-void CPPCornerCandidatesKernel::run(const Window &window, const ThreadInfo &info)
-{
- ARM_COMPUTE_UNUSED(info);
- ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
- ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(ICPPKernel::window(), window);
- Iterator input(_input, window);
-
- execute_window_loop(window, [&](const Coordinates & id)
- {
- corner_candidates(reinterpret_cast<float *>(input.ptr()), &_output[0], id.x(), id.y(), _num_corner_candidates, &_corner_candidates_mutex);
- },
- input);
-}
diff --git a/src/core/CPP/kernels/CPPDetectionWindowNonMaximaSuppressionKernel.cpp b/src/core/CPP/kernels/CPPDetectionWindowNonMaximaSuppressionKernel.cpp
deleted file mode 100644
index 3166fab..0000000
--- a/src/core/CPP/kernels/CPPDetectionWindowNonMaximaSuppressionKernel.cpp
+++ /dev/null
@@ -1,140 +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/core/CPP/kernels/CPPDetectionWindowNonMaximaSuppressionKernel.h"
-
-#include "arm_compute/core/Helpers.h"
-
-#include <algorithm>
-#include <cmath>
-
-using namespace arm_compute;
-
-namespace
-{
-bool compare_detection_window(const DetectionWindow &lhs, const DetectionWindow &rhs)
-{
- if(lhs.idx_class < rhs.idx_class)
- {
- return true;
- }
- if(rhs.idx_class < lhs.idx_class)
- {
- return false;
- }
-
- // idx_classes are equal so compare by score
- if(lhs.score > rhs.score)
- {
- return true;
- }
- if(rhs.score > lhs.score)
- {
- return false;
- }
-
- return false;
-}
-} // namespace
-
-CPPDetectionWindowNonMaximaSuppressionKernel::CPPDetectionWindowNonMaximaSuppressionKernel()
- : _input_output(nullptr), _min_distance(0.0f)
-{
-}
-
-bool CPPDetectionWindowNonMaximaSuppressionKernel::is_parallelisable() const
-{
- return false;
-}
-
-void CPPDetectionWindowNonMaximaSuppressionKernel::configure(IDetectionWindowArray *input_output, float min_distance)
-{
- ARM_COMPUTE_ERROR_ON(nullptr == input_output);
-
- _input_output = input_output;
- _min_distance = min_distance;
-
- IKernel::configure(Window()); // Default 1 iteration window
-}
-
-void CPPDetectionWindowNonMaximaSuppressionKernel::run(const Window &window, const ThreadInfo &info)
-{
- ARM_COMPUTE_UNUSED(info);
- ARM_COMPUTE_UNUSED(window);
- ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
- ARM_COMPUTE_ERROR_ON_MISMATCHING_WINDOWS(IKernel::window(), window);
- ARM_COMPUTE_ERROR_ON(_input_output->buffer() == nullptr);
-
- const size_t num_candidates = _input_output->num_values();
- size_t num_detections = 0;
-
- // Sort list of candidates by idx_class and then score
- std::sort(_input_output->buffer(), _input_output->buffer() + num_candidates, compare_detection_window);
-
- const float min_distance_pow2 = _min_distance * _min_distance;
-
- // Euclidean distance
- for(size_t i = 0; i < num_candidates; ++i)
- {
- if(0.0f != _input_output->at(i).score)
- {
- DetectionWindow cur;
- cur.x = _input_output->at(i).x;
- cur.y = _input_output->at(i).y;
- cur.width = _input_output->at(i).width;
- cur.height = _input_output->at(i).height;
- cur.idx_class = _input_output->at(i).idx_class;
- cur.score = _input_output->at(i).score;
-
- // Store window
- _input_output->at(num_detections) = cur;
-
- ++num_detections;
-
- const float xc = cur.x + cur.width * 0.5f;
- const float yc = cur.y + cur.height * 0.5f;
-
- for(size_t k = i + 1; k < (num_candidates) && (cur.idx_class == _input_output->at(k).idx_class); ++k)
- {
- const float xn = _input_output->at(k).x + _input_output->at(k).width * 0.5f;
- const float yn = _input_output->at(k).y + _input_output->at(k).height * 0.5f;
-
- const float dx = std::fabs(xn - xc);
- const float dy = std::fabs(yn - yc);
-
- if(dx < _min_distance && dy < _min_distance)
- {
- const float d = dx * dx + dy * dy;
-
- if(d < min_distance_pow2)
- {
- // Invalidate detection window
- _input_output->at(k).score = 0.0f;
- }
- }
- }
- }
- }
-
- _input_output->resize(num_detections);
-}
diff --git a/src/core/CPP/kernels/CPPSortEuclideanDistanceKernel.cpp b/src/core/CPP/kernels/CPPSortEuclideanDistanceKernel.cpp
deleted file mode 100644
index 603b05e..0000000
--- a/src/core/CPP/kernels/CPPSortEuclideanDistanceKernel.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 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/core/CPP/kernels/CPPSortEuclideanDistanceKernel.h"
-
-#include "arm_compute/core/Coordinates.h"
-#include "arm_compute/core/Error.h"
-#include "arm_compute/core/Helpers.h"
-#include "arm_compute/core/TensorInfo.h"
-#include "arm_compute/core/Types.h"
-#include "arm_compute/core/Utils.h"
-#include "arm_compute/core/Validate.h"
-#include "arm_compute/core/Window.h"
-
-#include <cmath>
-
-using namespace arm_compute;
-
-namespace
-{
-bool keypoint_compare(const InternalKeypoint &lhs, const InternalKeypoint &rhs)
-{
- return std::get<2>(lhs) > std::get<2>(rhs);
-}
-} // namespace
-
-CPPSortEuclideanDistanceKernel::CPPSortEuclideanDistanceKernel()
- : _num_corner_candidates(), _min_distance(0.0f), _in_out(nullptr), _output(nullptr)
-{
-}
-
-void CPPSortEuclideanDistanceKernel::configure(InternalKeypoint *in_out, IKeyPointArray *output, const int32_t *num_corner_candidates, float min_distance)
-{
- ARM_COMPUTE_ERROR_ON(nullptr == in_out);
- ARM_COMPUTE_ERROR_ON(nullptr == output);
- ARM_COMPUTE_ERROR_ON(nullptr == num_corner_candidates);
- ARM_COMPUTE_ERROR_ON(!((min_distance > 0) && (min_distance <= 30)));
-
- _in_out = in_out;
- _output = output;
- _min_distance = min_distance * min_distance; // We compare squares of distances
- _num_corner_candidates = num_corner_candidates;
- ICPPKernel::configure(Window()); // Default 1 iteration window
-}
-
-bool CPPSortEuclideanDistanceKernel::is_parallelisable() const
-{
- return false;
-}
-
-void CPPSortEuclideanDistanceKernel::run(const Window &window, const ThreadInfo &info)
-{
- ARM_COMPUTE_UNUSED(info);
- ARM_COMPUTE_UNUSED(window);
- ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
- ARM_COMPUTE_ERROR_ON_MISMATCHING_WINDOWS(ICPPKernel::window(), window);
-
- const int32_t num_corner_candidates = *_num_corner_candidates;
-
- /* Sort list of corner candidates */
- std::sort(_in_out, _in_out + num_corner_candidates, keypoint_compare);
-
- /* Euclidean distance */
- for(int32_t i = 0; i < num_corner_candidates; ++i)
- {
- if(std::get<2>(_in_out[i]) != 0.0f)
- {
- KeyPoint keypt;
- const auto xc = std::get<0>(_in_out[i]);
- const auto yc = std::get<1>(_in_out[i]);
-
- keypt.x = xc;
- keypt.y = yc;
- keypt.strength = std::get<2>(_in_out[i]);
- keypt.tracking_status = 1;
-
- /* Store corner */
- _output->push_back(keypt);
- for(int32_t k = i + 1; k < num_corner_candidates; ++k)
- {
- const float dx = std::fabs(std::get<0>(_in_out[k]) - xc);
- const float dy = std::fabs(std::get<1>(_in_out[k]) - yc);
-
- if((dx < _min_distance) && (dy < _min_distance))
- {
- const float d = (dx * dx + dy * dy);
-
- if(d < _min_distance)
- {
- /* Invalidate keypoint */
- std::get<2>(_in_out[k]) = 0.0f;
- }
- }
- }
- }
- }
-}
diff --git a/src/core/HOGInfo.cpp b/src/core/HOGInfo.cpp
deleted file mode 100644
index 1c27585..0000000
--- a/src/core/HOGInfo.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 2016-2019 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/core/HOGInfo.h"
-
-#include "arm_compute/core/Error.h"
-#include "arm_compute/core/Validate.h"
-
-using namespace arm_compute;
-
-HOGInfo::HOGInfo()
- : _cell_size(), _block_size(), _detection_window_size(), _block_stride(), _num_bins(0), _normalization_type(HOGNormType::L2HYS_NORM), _l2_hyst_threshold(0.0f), _phase_type(PhaseType::UNSIGNED),
- _descriptor_size(0)
-{
-}
-
-HOGInfo::HOGInfo(const Size2D &cell_size, const Size2D &block_size, const Size2D &detection_window_size, const Size2D &block_stride, size_t num_bins,
- HOGNormType normalization_type, float l2_hyst_threshold, PhaseType phase_type)
- : HOGInfo()
-{
- init(cell_size, block_size, detection_window_size, block_stride, num_bins, normalization_type, l2_hyst_threshold, phase_type);
-}
-
-void HOGInfo::init(const Size2D &cell_size, const Size2D &block_size, const Size2D &detection_window_size, const Size2D &block_stride, size_t num_bins,
- HOGNormType normalization_type, float l2_hyst_threshold, PhaseType phase_type)
-{
- ARM_COMPUTE_ERROR_ON_MSG((block_size.width % cell_size.width), "The block width must be multiple of cell width");
- ARM_COMPUTE_ERROR_ON_MSG((block_size.height % cell_size.height), "Block height must be multiple of cell height");
- ARM_COMPUTE_ERROR_ON_MSG((block_stride.width % cell_size.width), "Block stride width must be multiple of cell width");
- ARM_COMPUTE_ERROR_ON_MSG((block_stride.height % cell_size.height), "Block stride height must be multiple of cell height");
- ARM_COMPUTE_ERROR_ON_MSG(((detection_window_size.width - block_size.width) % block_stride.width), "Window width must be multiple of block width and block stride width");
- ARM_COMPUTE_ERROR_ON_MSG(((detection_window_size.height - block_size.height) % block_stride.height), "Window height must be multiple of block height and block stride height");
-
- _cell_size = cell_size;
- _block_size = block_size;
- _detection_window_size = detection_window_size;
- _block_stride = block_stride;
- _num_bins = num_bins;
- _normalization_type = normalization_type;
- _l2_hyst_threshold = l2_hyst_threshold;
- _phase_type = phase_type;
-
- // Compute descriptor size. +1 takes into account of the bias
- _descriptor_size = num_cells_per_block().area() * num_block_positions_per_image(_detection_window_size).area() * _num_bins + 1;
-}
-
-Size2D HOGInfo::num_cells_per_block() const
-{
- ARM_COMPUTE_ERROR_ON(_cell_size.width == 0 || _cell_size.height == 0);
-
- return Size2D{ _block_size.width / _cell_size.width,
- _block_size.height / _cell_size.height };
-}
-
-Size2D HOGInfo::num_cells_per_block_stride() const
-{
- ARM_COMPUTE_ERROR_ON(_cell_size.width == 0 || _cell_size.height == 0);
-
- return Size2D{ _block_stride.width / _cell_size.width,
- _block_stride.height / _cell_size.height };
-}
-
-Size2D HOGInfo::num_block_positions_per_image(const Size2D &image_size) const
-{
- ARM_COMPUTE_ERROR_ON(_block_stride.width == 0 || _block_stride.height == 0);
-
- return Size2D{ ((image_size.width - _block_size.width) / _block_stride.width) + 1,
- ((image_size.height - _block_size.height) / _block_stride.height) + 1 };
-}
-
-const Size2D &HOGInfo::cell_size() const
-{
- return _cell_size;
-}
-
-const Size2D &HOGInfo::block_size() const
-{
- return _block_size;
-}
-
-const Size2D &HOGInfo::detection_window_size() const
-{
- return _detection_window_size;
-}
-
-const Size2D &HOGInfo::block_stride() const
-{
- return _block_stride;
-}
-
-size_t HOGInfo::num_bins() const
-{
- return _num_bins;
-}
-
-HOGNormType HOGInfo::normalization_type() const
-{
- return _normalization_type;
-}
-
-float HOGInfo::l2_hyst_threshold() const
-{
- return _l2_hyst_threshold;
-}
-
-PhaseType HOGInfo::phase_type() const
-{
- return _phase_type;
-}
-
-size_t HOGInfo::descriptor_size() const
-{
- return _descriptor_size;
-}
diff --git a/src/core/IDistribution.cpp b/src/core/IDistribution.cpp
deleted file mode 100644
index c7e7346..0000000
--- a/src/core/IDistribution.cpp
+++ /dev/null
@@ -1,36 +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/core/IDistribution.h"
-
-#include "arm_compute/core/Error.h"
-
-#include <cstring>
-
-using namespace arm_compute;
-
-void IDistribution::clear() const
-{
- ARM_COMPUTE_ERROR_ON(nullptr == buffer());
- std::memset(buffer(), 0, size());
-}
diff --git a/src/core/IDistribution1D.cpp b/src/core/IDistribution1D.cpp
deleted file mode 100644
index 4dbb081..0000000
--- a/src/core/IDistribution1D.cpp
+++ /dev/null
@@ -1,69 +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/core/IDistribution1D.h"
-
-#include "arm_compute/core/Error.h"
-
-using namespace arm_compute;
-
-IDistribution1D::IDistribution1D(size_t num_bins, int32_t offset, uint32_t range)
- : _num_bins(num_bins), _offset(offset), _range(range)
-{
- ARM_COMPUTE_ERROR_ON_MSG(0 == _num_bins, "Invalid number of bins, it should be greater than 0");
-}
-
-size_t IDistribution1D::num_bins() const
-{
- return _num_bins;
-}
-
-int32_t IDistribution1D::offset() const
-{
- return _offset;
-}
-
-uint32_t IDistribution1D::range() const
-{
- return _range;
-}
-
-uint32_t IDistribution1D::window() const
-{
- return _range / _num_bins;
-}
-
-size_t IDistribution1D::size() const
-{
- return _num_bins * sizeof(uint32_t);
-}
-
-void IDistribution1D::set_range(uint32_t range)
-{
- _range = range;
-}
-
-size_t IDistribution1D::dimensions() const
-{
- return 1;
-}
diff --git a/src/core/MultiImageInfo.cpp b/src/core/MultiImageInfo.cpp
deleted file mode 100644
index 9ec1e1d..0000000
--- a/src/core/MultiImageInfo.cpp
+++ /dev/null
@@ -1,53 +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/core/MultiImageInfo.h"
-
-using namespace arm_compute;
-
-MultiImageInfo::MultiImageInfo()
- : _width(0), _height(0), _format(Format::UNKNOWN)
-{
-}
-
-void MultiImageInfo::init(unsigned int width, unsigned int height, Format format)
-{
- _format = format;
- _width = width;
- _height = height;
-}
-
-Format MultiImageInfo::format() const
-{
- return _format;
-}
-
-unsigned int MultiImageInfo::width() const
-{
- return _width;
-}
-
-unsigned int MultiImageInfo::height() const
-{
- return _height;
-}
diff --git a/src/core/NEON/NEKernels.h b/src/core/NEON/NEKernels.h
index 0acaebb..59884e2 100644
--- a/src/core/NEON/NEKernels.h
+++ b/src/core/NEON/NEKernels.h
@@ -36,7 +36,6 @@
#include "src/core/NEON/kernels/NEConvertFullyConnectedWeightsKernel.h"
#include "src/core/NEON/kernels/NEConvertQuantizedSignednessKernel.h"
#include "src/core/NEON/kernels/NECropKernel.h"
-#include "src/core/NEON/kernels/NECumulativeDistributionKernel.h"
#include "src/core/NEON/kernels/NEDepthConvertLayerKernel.h"
#include "src/core/NEON/kernels/NEDepthToSpaceLayerKernel.h"
#include "src/core/NEON/kernels/NEDepthwiseConvolutionLayerNativeKernel.h"
@@ -45,7 +44,6 @@
#include "src/core/NEON/kernels/NEFFTDigitReverseKernel.h"
#include "src/core/NEON/kernels/NEFFTRadixStageKernel.h"
#include "src/core/NEON/kernels/NEFFTScaleKernel.h"
-#include "src/core/NEON/kernels/NEFillArrayKernel.h"
#include "src/core/NEON/kernels/NEFillBorderKernel.h"
#include "src/core/NEON/kernels/NEFuseBatchNormalizationKernel.h"
#include "src/core/NEON/kernels/NEGEMMInterleave4x4Kernel.h"
@@ -65,7 +63,6 @@
#include "src/core/NEON/kernels/NEIm2ColKernel.h"
#include "src/core/NEON/kernels/NEInstanceNormalizationLayerKernel.h"
#include "src/core/NEON/kernels/NEL2NormalizeLayerKernel.h"
-#include "src/core/NEON/kernels/NELKTrackerKernel.h"
#include "src/core/NEON/kernels/NELogicalKernel.h"
#include "src/core/NEON/kernels/NEMaxUnpoolingLayerKernel.h"
#include "src/core/NEON/kernels/NEMeanStdDevNormalizationKernel.h"
diff --git a/src/core/NEON/kernels/NECumulativeDistributionKernel.cpp b/src/core/NEON/kernels/NECumulativeDistributionKernel.cpp
deleted file mode 100644
index 58a9a2f..0000000
--- a/src/core/NEON/kernels/NECumulativeDistributionKernel.cpp
+++ /dev/null
@@ -1,114 +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 "src/core/NEON/kernels/NECumulativeDistributionKernel.h"
-
-#include "arm_compute/core/Error.h"
-#include "arm_compute/core/Helpers.h"
-#include "arm_compute/core/IDistribution1D.h"
-#include "arm_compute/core/ILut.h"
-#include "arm_compute/core/ITensor.h"
-#include "arm_compute/core/Types.h"
-#include "arm_compute/core/Validate.h"
-#include "src/core/helpers/AutoConfiguration.h"
-#include "src/core/helpers/WindowHelpers.h"
-
-#include <algorithm>
-#include <cmath>
-#include <numeric>
-
-using namespace arm_compute;
-
-NECumulativeDistributionKernel::NECumulativeDistributionKernel()
- : _input(nullptr), _distribution(nullptr), _cumulative_sum(nullptr), _output(nullptr)
-{
-}
-
-bool NECumulativeDistributionKernel::is_parallelisable() const
-{
- return false;
-}
-
-void NECumulativeDistributionKernel::configure(const IImage *input, const IDistribution1D *distribution, IDistribution1D *cumulative_sum, ILut *output)
-{
- ARM_COMPUTE_ERROR_ON_NULLPTR(input, distribution, cumulative_sum, output);
- ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(input);
-
- set_format_if_unknown(*input->info(), Format::U8);
-
- ARM_COMPUTE_ERROR_ON(distribution->num_bins() != cumulative_sum->num_bins());
- ARM_COMPUTE_ERROR_ON(distribution->num_bins() != output->num_elements());
- ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8);
- ARM_COMPUTE_ERROR_ON(input->info()->data_type() != output->type());
-
- _input = input;
- _distribution = distribution;
- _cumulative_sum = cumulative_sum;
- _output = output;
-
- INEKernel::configure(calculate_max_window(*input->info()));
-}
-
-void NECumulativeDistributionKernel::run(const Window &window, const ThreadInfo &info)
-{
- ARM_COMPUTE_UNUSED(info);
- ARM_COMPUTE_UNUSED(window);
- ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
- ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(INEKernel::window(), window);
- ARM_COMPUTE_ERROR_ON(_distribution->buffer() == nullptr);
- ARM_COMPUTE_ERROR_ON(_cumulative_sum->buffer() == nullptr);
- ARM_COMPUTE_ERROR_ON(_output->buffer() == nullptr);
- ARM_COMPUTE_ERROR_ON_MSG(_distribution->num_bins() < 256, "Distribution must have 256 bins");
-
- // Calculate the cumulative distribution (summed histogram).
- const uint32_t *hist = _distribution->buffer();
- uint32_t *cumulative_sum = _cumulative_sum->buffer();
- uint8_t *output = _output->buffer();
-
- // Calculate cumulative distribution
- std::partial_sum(hist, hist + _histogram_size, cumulative_sum);
-
- // Get the number of pixels that have the lowest value in the input image
- const uint32_t cd_min = *std::find_if(hist, hist + _histogram_size, [](const uint32_t &v)
- {
- return v > 0;
- });
- const uint32_t image_size = cumulative_sum[_histogram_size - 1];
-
- ARM_COMPUTE_ERROR_ON(cd_min > image_size);
-
- // Create mapping lookup table
- if(image_size == cd_min)
- {
- std::iota(output, output + _histogram_size, 0);
- }
- else
- {
- const float diff = image_size - cd_min;
-
- for(unsigned int x = 0; x < _histogram_size; ++x)
- {
- output[x] = lround((cumulative_sum[x] - cd_min) / diff * 255.0f);
- }
- }
-}
diff --git a/src/core/NEON/kernels/NECumulativeDistributionKernel.h b/src/core/NEON/kernels/NECumulativeDistributionKernel.h
deleted file mode 100644
index 1f8c65b..0000000
--- a/src/core/NEON/kernels/NECumulativeDistributionKernel.h
+++ /dev/null
@@ -1,85 +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.
- */
-#ifndef ARM_COMPUTE_NECUMULATIVEDISTRIBUTIONKERNEL_H
-#define ARM_COMPUTE_NECUMULATIVEDISTRIBUTIONKERNEL_H
-
-#include "src/core/NEON/INEKernel.h"
-
-#include <cstdint>
-
-namespace arm_compute
-{
-class IDistribution1D;
-class ILut;
-class ITensor;
-using IImage = ITensor;
-
-/** Interface for the cumulative distribution (cummulative summmation) calculation kernel.
- *
- * This kernel calculates the cumulative sum of a given distribution (meaning that each output element
- * is the sum of all its previous elements including itself) and creates a lookup table with the normalized
- * pixel intensities which is used for improve the constrast of the image.
- */
-class NECumulativeDistributionKernel : public INEKernel
-{
-public:
- const char *name() const override
- {
- return "NECumulativeDistributionKernel";
- }
- /** Default constructor */
- NECumulativeDistributionKernel();
- /** Prevent instances of this class from being copied (As this class contains pointers) */
- NECumulativeDistributionKernel(const NECumulativeDistributionKernel &) = delete;
- /** Prevent instances of this class from being copied (As this class contains pointers) */
- NECumulativeDistributionKernel &operator=(const NECumulativeDistributionKernel &) = delete;
- /** Allow instances of this class to be moved */
- NECumulativeDistributionKernel(NECumulativeDistributionKernel &&) = default;
- /** Allow instances of this class to be moved */
- NECumulativeDistributionKernel &operator=(NECumulativeDistributionKernel &&) = default;
- /** Default destructor */
- ~NECumulativeDistributionKernel() = default;
- /** Set the input and output distribution.
- *
- * @param[in] input Input image. Data type supported: U8
- * @param[in] distribution Unnormalized 256-bin distribution of the input image.
- * @param[out] cumulative_sum Cummulative distribution (Summed histogram). Should be same size as @p distribution.
- * @param[out] output Equalization lookup table. Should consist of 256 entries of U8 elements.
- */
- void configure(const IImage *input, const IDistribution1D *distribution, IDistribution1D *cumulative_sum, ILut *output);
-
- // Inherited methods overridden:
- void run(const Window &window, const ThreadInfo &info) override;
- bool is_parallelisable() const override;
-
-private:
- const IImage *_input; /**< Input image. */
- const IDistribution1D *_distribution; /**< Input histogram of the input image. */
- IDistribution1D *_cumulative_sum; /**< The cummulative distribution. */
- ILut *_output; /**< Output with the equalization lookup table. */
-private:
- static const uint32_t _histogram_size = 256; /**< Default histogram size of 256. */
-};
-} // namespace arm_compute
-#endif /*ARM_COMPUTE_NECUMULATIVEDISTRIBUTIONKERNEL_H */
diff --git a/src/core/NEON/kernels/NEFillArrayKernel.cpp b/src/core/NEON/kernels/NEFillArrayKernel.cpp
deleted file mode 100644
index e8ae926..0000000
--- a/src/core/NEON/kernels/NEFillArrayKernel.cpp
+++ /dev/null
@@ -1,92 +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 "src/core/NEON/kernels/NEFillArrayKernel.h"
-
-#include "arm_compute/core/Coordinates.h"
-#include "arm_compute/core/Error.h"
-#include "arm_compute/core/Helpers.h"
-#include "arm_compute/core/IAccessWindow.h"
-#include "arm_compute/core/Validate.h"
-#include "src/core/helpers/WindowHelpers.h"
-
-using namespace arm_compute;
-
-NEFillArrayKernel::NEFillArrayKernel()
- : _input(nullptr), _output(nullptr), _threshold(0)
-{
-}
-
-void NEFillArrayKernel::configure(const IImage *input, uint8_t threshold, IKeyPointArray *output)
-{
- ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(input);
- ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8);
- ARM_COMPUTE_ERROR_ON(nullptr == output);
-
- _input = input;
- _output = output;
- _threshold = threshold;
-
- constexpr unsigned int num_elems_processed_per_iteration = 1;
-
- // Configure kernel window
- Window win = calculate_max_window(*input->info(), Steps(num_elems_processed_per_iteration));
- INEKernel::configure(win);
-}
-
-bool NEFillArrayKernel::is_parallelisable() const
-{
- return false;
-}
-
-void NEFillArrayKernel::run(const Window &window, const ThreadInfo &info)
-{
- ARM_COMPUTE_UNUSED(info);
- ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
- ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(INEKernel::window(), window);
-
- Iterator input(_input, window);
-
- execute_window_loop(window, [&](const Coordinates & id)
- {
- const uint8_t value = *input.ptr();
-
- if(value >= _threshold)
- {
- KeyPoint p;
- p.x = id.x();
- p.y = id.y();
- p.strength = value;
- p.tracking_status = 1;
- p.scale = 0.f;
- p.orientation = 0.f;
- p.error = 0.f;
-
- if(!_output->push_back(p))
- {
- return; //Overflowed: stop trying to add more points
- }
- }
- },
- input);
-}
diff --git a/src/core/NEON/kernels/NEFillArrayKernel.h b/src/core/NEON/kernels/NEFillArrayKernel.h
deleted file mode 100644
index c984167..0000000
--- a/src/core/NEON/kernels/NEFillArrayKernel.h
+++ /dev/null
@@ -1,77 +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.
- */
-#ifndef ARM_COMPUTE_NEFILLARRAYKERNEL_H
-#define ARM_COMPUTE_NEFILLARRAYKERNEL_H
-
-#include "arm_compute/core/IArray.h"
-#include "arm_compute/core/Types.h"
-#include "src/core/NEON/INEKernel.h"
-
-#include <cstdint>
-
-namespace arm_compute
-{
-class ITensor;
-using IImage = ITensor;
-
-/** This kernel adds all texels greater than or equal to the threshold value to the keypoint array. */
-class NEFillArrayKernel : public INEKernel
-{
-public:
- const char *name() const override
- {
- return "NEFillArrayKernel";
- }
- /** Default contructor */
- NEFillArrayKernel();
- /** Prevent instances of this class from being copied (As this class contains pointers) */
- NEFillArrayKernel(const NEFillArrayKernel &) = delete;
- /** Prevent instances of this class from being copied (As this class contains pointers) */
- NEFillArrayKernel &operator=(const NEFillArrayKernel &) = delete;
- /** Allow instances of this class to be moved */
- NEFillArrayKernel(NEFillArrayKernel &&) = default;
- /** Allow instances of this class to be moved */
- NEFillArrayKernel &operator=(NEFillArrayKernel &&) = default;
- /** Default detructor */
- ~NEFillArrayKernel() = default;
-
- /** Initialise the kernel.
- *
- * @param[in] input Source image. Data type supported: U8.
- * @param[in] threshold Texels greater than the threshold will be added to the array.
- * @param[out] output Arrays of keypoints to store the results.
- */
- void configure(const IImage *input, uint8_t threshold, IKeyPointArray *output);
-
- // Inherited methods overridden:
- void run(const Window &window, const ThreadInfo &info) override;
- bool is_parallelisable() const override;
-
-private:
- const IImage *_input;
- IKeyPointArray *_output;
- uint8_t _threshold;
-};
-} // namespace arm_compute
-#endif /* ARM_COMPUTE_NEFILLARRAYKERNEL_H*/
diff --git a/src/core/NEON/kernels/NELKTrackerKernel.cpp b/src/core/NEON/kernels/NELKTrackerKernel.cpp
deleted file mode 100644
index 442f001..0000000
--- a/src/core/NEON/kernels/NELKTrackerKernel.cpp
+++ /dev/null
@@ -1,540 +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 "src/core/NEON/kernels/NELKTrackerKernel.h"
-
-#include "arm_compute/core/Coordinates.h"
-#include "arm_compute/core/Error.h"
-#include "arm_compute/core/Helpers.h"
-#include "arm_compute/core/ITensor.h"
-#include "arm_compute/core/TensorInfo.h"
-#include "arm_compute/core/Validate.h"
-#include "arm_compute/core/Window.h"
-#include "src/core/AccessWindowStatic.h"
-#include "src/core/helpers/AutoConfiguration.h"
-#include "src/core/helpers/WindowHelpers.h"
-
-#include <arm_neon.h>
-#include <cmath>
-
-using namespace arm_compute;
-
-/** Constants used for Lucas-Kanade Algorithm */
-constexpr int W_BITS = 14;
-constexpr float D0 = 1 << W_BITS;
-constexpr float DETERMINANT_THRESHOLD = 1.0e-07f; // Threshold for the determinant. Used for lost tracking criteria
-constexpr float EIGENVALUE_THRESHOLD = 1.0e-04f; // Thresholds for minimum eigenvalue. Used for lost tracking criteria
-constexpr float FLT_SCALE = 1.0f / (1 << 20);
-
-namespace
-{
-enum class BilinearInterpolation
-{
- BILINEAR_OLD_NEW,
- BILINEAR_SCHARR
-};
-
-template <typename T>
-constexpr int INT_ROUND(T x, int n)
-{
- return (x + (1 << (n - 1))) >> n;
-}
-
-template <typename T>
-inline int get_pixel(const ITensor *tensor, int xi, int yi, int iw00, int iw01, int iw10, int iw11, int scale)
-{
- const auto px00 = *reinterpret_cast<const T *>(tensor->buffer() + tensor->info()->offset_element_in_bytes(Coordinates(xi, yi)));
- const auto px01 = *reinterpret_cast<const T *>(tensor->buffer() + tensor->info()->offset_element_in_bytes(Coordinates(xi + 1, yi)));
- const auto px10 = *reinterpret_cast<const T *>(tensor->buffer() + tensor->info()->offset_element_in_bytes(Coordinates(xi, yi + 1)));
- const auto px11 = *reinterpret_cast<const T *>(tensor->buffer() + tensor->info()->offset_element_in_bytes(Coordinates(xi + 1, yi + 1)));
-
- return INT_ROUND(px00 * iw00 + px01 * iw01 + px10 * iw10 + px11 * iw11, scale);
-}
-
-inline int32x4_t compute_bilinear_interpolation(int16x8_t top_row, int16x8_t bottom_row, int16x4_t w00, int16x4_t w01, int16x4_t w10, int16x4_t w11, int32x4_t shift)
-{
- // Get the left column of upper row
- const int16x4_t px00 = vget_low_s16(top_row);
-
- // Get the right column of upper row
- const int16x4_t px01 = vext_s16(px00, vget_high_s16(top_row), 1);
-
- // Get the left column of lower row
- const int16x4_t px10 = vget_low_s16(bottom_row);
-
- // Get the right column of right row
- const int16x4_t px11 = vext_s16(px10, vget_high_s16(bottom_row), 1);
-
- // Apply the bilinear filter
- return vqrshlq_s32(vmull_s16(px00, w00) + vmull_s16(px01, w01) + vmull_s16(px10, w10) + vmull_s16(px11, w11), shift);
-}
-} // namespace
-
-void NELKTrackerKernel::init_keypoints(int start, int end)
-{
- if(_level == _num_levels - 1)
- {
- const float level_scale = pow(_pyramid_scale, _level);
-
- for(int i = start; i < end; ++i)
- {
- _old_points_internal->at(i).x = _old_points->at(i).x * level_scale;
- _old_points_internal->at(i).y = _old_points->at(i).y * level_scale;
- _old_points_internal->at(i).tracking_status = true;
-
- NELKInternalKeypoint keypoint_to_track;
-
- if(_use_initial_estimate)
- {
- keypoint_to_track.x = _new_points_estimates->at(i).x * level_scale;
- keypoint_to_track.y = _new_points_estimates->at(i).y * level_scale;
- keypoint_to_track.tracking_status = (_new_points_estimates->at(i).tracking_status == 1);
- }
- else
- {
- keypoint_to_track.x = _old_points_internal->at(i).x;
- keypoint_to_track.y = _old_points_internal->at(i).y;
- keypoint_to_track.tracking_status = true;
- }
-
- _new_points_internal->at(i) = keypoint_to_track;
- }
- }
- else
- {
- for(int i = start; i < end; ++i)
- {
- _old_points_internal->at(i).x /= _pyramid_scale;
- _old_points_internal->at(i).y /= _pyramid_scale;
- _new_points_internal->at(i).x /= _pyramid_scale;
- _new_points_internal->at(i).y /= _pyramid_scale;
- }
- }
-}
-
-std::tuple<int, int, int> NELKTrackerKernel::compute_spatial_gradient_matrix(const NELKInternalKeypoint &keypoint, int32_t *bilinear_ix, int32_t *bilinear_iy)
-{
- int iA11 = 0;
- int iA12 = 0;
- int iA22 = 0;
-
- int32x4_t nA11 = vdupq_n_s32(0);
- int32x4_t nA12 = vdupq_n_s32(0);
- int32x4_t nA22 = vdupq_n_s32(0);
-
- float keypoint_int_x = 0;
- float keypoint_int_y = 0;
-
- const float wx = std::modf(keypoint.x, &keypoint_int_x);
- const float wy = std::modf(keypoint.y, &keypoint_int_y);
-
- const int iw00 = roundf((1.0f - wx) * (1.0f - wy) * D0);
- const int iw01 = roundf(wx * (1.0f - wy) * D0);
- const int iw10 = roundf((1.0f - wx) * wy * D0);
- const int iw11 = D0 - iw00 - iw01 - iw10;
-
- const int16x4_t nw00 = vdup_n_s16(iw00);
- const int16x4_t nw01 = vdup_n_s16(iw01);
- const int16x4_t nw10 = vdup_n_s16(iw10);
- const int16x4_t nw11 = vdup_n_s16(iw11);
-
- // Convert stride from uint_t* to int16_t*
- const size_t row_stride = _old_scharr_gx->info()->strides_in_bytes()[1] / 2;
- const Coordinates top_left_window_corner(static_cast<int>(keypoint_int_x) - _window_dimension / 2, static_cast<int>(keypoint_int_y) - _window_dimension / 2);
- auto idx = reinterpret_cast<const int16_t *>(_old_scharr_gx->buffer() + _old_scharr_gx->info()->offset_element_in_bytes(top_left_window_corner));
- auto idy = reinterpret_cast<const int16_t *>(_old_scharr_gy->buffer() + _old_scharr_gy->info()->offset_element_in_bytes(top_left_window_corner));
- static const int32x4_t nshifter_scharr = vdupq_n_s32(-W_BITS);
-
- for(int ky = 0; ky < _window_dimension; ++ky, idx += row_stride, idy += row_stride)
- {
- int kx = 0;
-
- // Calculate elements in blocks of four as long as possible
- for(; kx <= _window_dimension - 4; kx += 4)
- {
- // Interpolation X
- const int16x8_t ndx_row1 = vld1q_s16(idx + kx);
- const int16x8_t ndx_row2 = vld1q_s16(idx + kx + row_stride);
-
- const int32x4_t nxval = compute_bilinear_interpolation(ndx_row1, ndx_row2, nw00, nw01, nw10, nw11, nshifter_scharr);
-
- // Interpolation Y
- const int16x8_t ndy_row1 = vld1q_s16(idy + kx);
- const int16x8_t ndy_row2 = vld1q_s16(idy + kx + row_stride);
-
- const int32x4_t nyval = compute_bilinear_interpolation(ndy_row1, ndy_row2, nw00, nw01, nw10, nw11, nshifter_scharr);
-
- // Store the intermediate data so that we don't need to recalculate them in later stage
- vst1q_s32(bilinear_ix + kx + ky * _window_dimension, nxval);
- vst1q_s32(bilinear_iy + kx + ky * _window_dimension, nyval);
-
- // Accumulate Ix^2
- nA11 = vmlaq_s32(nA11, nxval, nxval);
- // Accumulate Ix * Iy
- nA12 = vmlaq_s32(nA12, nxval, nyval);
- // Accumulate Iy^2
- nA22 = vmlaq_s32(nA22, nyval, nyval);
- }
-
- // Calculate the leftover elements
- for(; kx < _window_dimension; ++kx)
- {
- const int32_t ixval = get_pixel<int16_t>(_old_scharr_gx, top_left_window_corner.x() + kx, top_left_window_corner.y() + ky,
- iw00, iw01, iw10, iw11, W_BITS);
- const int32_t iyval = get_pixel<int16_t>(_old_scharr_gy, top_left_window_corner.x() + kx, top_left_window_corner.y() + ky,
- iw00, iw01, iw10, iw11, W_BITS);
-
- iA11 += ixval * ixval;
- iA12 += ixval * iyval;
- iA22 += iyval * iyval;
-
- bilinear_ix[kx + ky * _window_dimension] = ixval;
- bilinear_iy[kx + ky * _window_dimension] = iyval;
- }
- }
-
- iA11 += vgetq_lane_s32(nA11, 0) + vgetq_lane_s32(nA11, 1) + vgetq_lane_s32(nA11, 2) + vgetq_lane_s32(nA11, 3);
- iA12 += vgetq_lane_s32(nA12, 0) + vgetq_lane_s32(nA12, 1) + vgetq_lane_s32(nA12, 2) + vgetq_lane_s32(nA12, 3);
- iA22 += vgetq_lane_s32(nA22, 0) + vgetq_lane_s32(nA22, 1) + vgetq_lane_s32(nA22, 2) + vgetq_lane_s32(nA22, 3);
-
- return std::make_tuple(iA11, iA12, iA22);
-}
-
-std::pair<int, int> NELKTrackerKernel::compute_image_mismatch_vector(const NELKInternalKeypoint &old_keypoint, const NELKInternalKeypoint &new_keypoint, const int32_t *bilinear_ix,
- const int32_t *bilinear_iy)
-{
- int ib1 = 0;
- int ib2 = 0;
-
- int32x4_t nb1 = vdupq_n_s32(0);
- int32x4_t nb2 = vdupq_n_s32(0);
-
- // Compute weights for the old keypoint
- float old_keypoint_int_x = 0;
- float old_keypoint_int_y = 0;
-
- const float old_wx = std::modf(old_keypoint.x, &old_keypoint_int_x);
- const float old_wy = std::modf(old_keypoint.y, &old_keypoint_int_y);
-
- const int iw00_old = roundf((1.0f - old_wx) * (1.0f - old_wy) * D0);
- const int iw01_old = roundf(old_wx * (1.0f - old_wy) * D0);
- const int iw10_old = roundf((1.0f - old_wx) * old_wy * D0);
- const int iw11_old = D0 - iw00_old - iw01_old - iw10_old;
-
- const int16x4_t nw00_old = vdup_n_s16(iw00_old);
- const int16x4_t nw01_old = vdup_n_s16(iw01_old);
- const int16x4_t nw10_old = vdup_n_s16(iw10_old);
- const int16x4_t nw11_old = vdup_n_s16(iw11_old);
-
- // Compute weights for the new keypoint
- float new_keypoint_int_x = 0;
- float new_keypoint_int_y = 0;
-
- const float new_wx = std::modf(new_keypoint.x, &new_keypoint_int_x);
- const float new_wy = std::modf(new_keypoint.y, &new_keypoint_int_y);
-
- const int iw00_new = roundf((1.0f - new_wx) * (1.0f - new_wy) * D0);
- const int iw01_new = roundf(new_wx * (1.0f - new_wy) * D0);
- const int iw10_new = roundf((1.0f - new_wx) * new_wy * D0);
- const int iw11_new = D0 - iw00_new - iw01_new - iw10_new;
-
- const int16x4_t nw00_new = vdup_n_s16(iw00_new);
- const int16x4_t nw01_new = vdup_n_s16(iw01_new);
- const int16x4_t nw10_new = vdup_n_s16(iw10_new);
- const int16x4_t nw11_new = vdup_n_s16(iw11_new);
-
- const int row_stride = _input_new->info()->strides_in_bytes()[1];
- const Coordinates top_left_window_corner_old(static_cast<int>(old_keypoint_int_x) - _window_dimension / 2, static_cast<int>(old_keypoint_int_y) - _window_dimension / 2);
- const Coordinates top_left_window_corner_new(static_cast<int>(new_keypoint_int_x) - _window_dimension / 2, static_cast<int>(new_keypoint_int_y) - _window_dimension / 2);
- const uint8_t *old_ptr = _input_old->buffer() + _input_old->info()->offset_element_in_bytes(top_left_window_corner_old);
- const uint8_t *new_ptr = _input_new->buffer() + _input_new->info()->offset_element_in_bytes(top_left_window_corner_new);
- static const int32x4_t nshifter_tensor = vdupq_n_s32(-(W_BITS - 5));
-
- for(int ky = 0; ky < _window_dimension; ++ky, new_ptr += row_stride, old_ptr += row_stride)
- {
- int kx = 0;
-
- // Calculate elements in blocks of four as long as possible
- for(; kx <= _window_dimension - 4; kx += 4)
- {
- // Interpolation old tensor
- const int16x8_t nold_row1 = vreinterpretq_s16_u16(vmovl_u8(vld1_u8(old_ptr + kx)));
- const int16x8_t nold_row2 = vreinterpretq_s16_u16(vmovl_u8(vld1_u8(old_ptr + kx + row_stride)));
-
- const int32x4_t noldval = compute_bilinear_interpolation(nold_row1, nold_row2, nw00_old, nw01_old, nw10_old, nw11_old, nshifter_tensor);
-
- // Interpolation new tensor
- const int16x8_t nnew_row1 = vreinterpretq_s16_u16(vmovl_u8(vld1_u8(new_ptr + kx)));
- const int16x8_t nnew_row2 = vreinterpretq_s16_u16(vmovl_u8(vld1_u8(new_ptr + kx + row_stride)));
-
- const int32x4_t nnewval = compute_bilinear_interpolation(nnew_row1, nnew_row2, nw00_new, nw01_new, nw10_new, nw11_new, nshifter_tensor);
-
- // Calculate It gradient, i.e. pixelwise difference between old and new tensor
- const int32x4_t diff = vsubq_s32(nnewval, noldval);
-
- // Load the Ix and Iy gradient computed in the previous stage
- const int32x4_t nxval = vld1q_s32(bilinear_ix + kx + ky * _window_dimension);
- const int32x4_t nyval = vld1q_s32(bilinear_iy + kx + ky * _window_dimension);
-
- // Caculate Ix * It and Iy * It, and accumulate the results
- nb1 = vmlaq_s32(nb1, diff, nxval);
- nb2 = vmlaq_s32(nb2, diff, nyval);
- }
-
- // Calculate the leftover elements
- for(; kx < _window_dimension; ++kx)
- {
- const int32_t ival = get_pixel<uint8_t>(_input_old, top_left_window_corner_old.x() + kx, top_left_window_corner_old.y() + ky,
- iw00_old, iw01_old, iw10_old, iw11_old, W_BITS - 5);
- const int32_t jval = get_pixel<uint8_t>(_input_new, top_left_window_corner_new.x() + kx, top_left_window_corner_new.y() + ky,
- iw00_new, iw01_new, iw10_new, iw11_new, W_BITS - 5);
-
- const int32_t diff = jval - ival;
-
- ib1 += diff * bilinear_ix[kx + ky * _window_dimension];
- ib2 += diff * bilinear_iy[kx + ky * _window_dimension];
- }
- }
-
- ib1 += vgetq_lane_s32(nb1, 0) + vgetq_lane_s32(nb1, 1) + vgetq_lane_s32(nb1, 2) + vgetq_lane_s32(nb1, 3);
- ib2 += vgetq_lane_s32(nb2, 0) + vgetq_lane_s32(nb2, 1) + vgetq_lane_s32(nb2, 2) + vgetq_lane_s32(nb2, 3);
-
- return std::make_pair(ib1, ib2);
-}
-
-NELKTrackerKernel::NELKTrackerKernel()
- : _input_old(nullptr), _input_new(nullptr), _old_scharr_gx(nullptr), _old_scharr_gy(nullptr), _new_points(nullptr), _new_points_estimates(nullptr), _old_points(nullptr), _old_points_internal(),
- _new_points_internal(), _termination(Termination::TERM_CRITERIA_EPSILON), _use_initial_estimate(false), _pyramid_scale(0.0f), _epsilon(0.0f), _num_iterations(0), _window_dimension(0), _level(0),
- _num_levels(0), _valid_region()
-{
-}
-
-BorderSize NELKTrackerKernel::border_size() const
-{
- return BorderSize(1);
-}
-
-void NELKTrackerKernel::configure(const ITensor *input_old, const ITensor *input_new, const ITensor *old_scharr_gx, const ITensor *old_scharr_gy,
- const IKeyPointArray *old_points, const IKeyPointArray *new_points_estimates, IKeyPointArray *new_points,
- INELKInternalKeypointArray *old_points_internal, INELKInternalKeypointArray *new_points_internal,
- Termination termination, bool use_initial_estimate, float epsilon, unsigned int num_iterations, size_t window_dimension,
- size_t level, size_t num_levels, float pyramid_scale)
-
-{
- ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input_old, 1, DataType::U8);
- ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input_new, 1, DataType::U8);
- ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(old_scharr_gx, 1, DataType::S16);
- ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(old_scharr_gy, 1, DataType::S16);
-
- _input_old = input_old;
- _input_new = input_new;
- _old_scharr_gx = old_scharr_gx;
- _old_scharr_gy = old_scharr_gy;
- _old_points = old_points;
- _new_points_estimates = new_points_estimates;
- _new_points = new_points;
- _old_points_internal = old_points_internal;
- _new_points_internal = new_points_internal;
- _termination = termination;
- _use_initial_estimate = use_initial_estimate;
- _epsilon = epsilon;
- _window_dimension = window_dimension;
- _level = level;
- _num_levels = num_levels;
- _pyramid_scale = pyramid_scale;
- _num_levels = num_levels;
-
- // Set maximum number of iterations used for convergence
- const size_t max_iterations = 1000;
- _num_iterations = (termination == Termination::TERM_CRITERIA_EPSILON) ? max_iterations : num_iterations;
-
- Window window;
- window.set(Window::DimX, Window::Dimension(0, old_points->num_values()));
- window.set(Window::DimY, Window::Dimension(0, 1));
-
- _valid_region = intersect_valid_regions(
- input_old->info()->valid_region(),
- input_new->info()->valid_region(),
- old_scharr_gx->info()->valid_region(),
- old_scharr_gy->info()->valid_region());
-
- update_window_and_padding(window,
- AccessWindowStatic(input_old->info(), _valid_region.start(0), _valid_region.start(1),
- _valid_region.end(0), _valid_region.end(1)),
- AccessWindowStatic(input_new->info(), _valid_region.start(0), _valid_region.start(1),
- _valid_region.end(0), _valid_region.end(1)),
- AccessWindowStatic(old_scharr_gx->info(), _valid_region.start(0), _valid_region.start(1),
- _valid_region.end(0), _valid_region.end(1)),
- AccessWindowStatic(old_scharr_gy->info(), _valid_region.start(0), _valid_region.start(1),
- _valid_region.end(0), _valid_region.end(1)));
-
- INEKernel::configure(window);
-}
-
-void NELKTrackerKernel::run(const Window &window, const ThreadInfo &info)
-{
- ARM_COMPUTE_UNUSED(info);
- ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
- ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(INEKernel::window(), window);
-
- ARM_COMPUTE_ERROR_ON(_input_old->buffer() == nullptr);
- ARM_COMPUTE_ERROR_ON(_input_new->buffer() == nullptr);
- ARM_COMPUTE_ERROR_ON(_old_scharr_gx->buffer() == nullptr);
- ARM_COMPUTE_ERROR_ON(_old_scharr_gy->buffer() == nullptr);
-
- const int list_end = window.x().end();
- const int list_start = window.x().start();
-
- init_keypoints(list_start, list_end);
-
- const int buffer_size = _window_dimension * _window_dimension;
- std::vector<int32_t> bilinear_ix(buffer_size);
- std::vector<int32_t> bilinear_iy(buffer_size);
-
- const int half_window = _window_dimension / 2;
-
- auto is_invalid_keypoint = [&](const NELKInternalKeypoint & keypoint)
- {
- const int x = std::floor(keypoint.x);
- const int y = std::floor(keypoint.y);
-
- return (x - half_window < _valid_region.start(0)) || (x + half_window >= _valid_region.end(0) - 1) || (y - half_window < _valid_region.start(1)) || (y + half_window >= _valid_region.end(1) - 1);
- };
-
- for(int list_indx = list_start; list_indx < list_end; ++list_indx)
- {
- NELKInternalKeypoint &old_keypoint = _old_points_internal->at(list_indx);
- NELKInternalKeypoint &new_keypoint = _new_points_internal->at(list_indx);
-
- if(!old_keypoint.tracking_status)
- {
- continue;
- }
-
- if(is_invalid_keypoint(old_keypoint))
- {
- if(_level == 0)
- {
- new_keypoint.tracking_status = false;
- }
-
- continue;
- }
-
- // Compute spatial gradient matrix
- int iA11 = 0;
- int iA12 = 0;
- int iA22 = 0;
-
- std::tie(iA11, iA12, iA22) = compute_spatial_gradient_matrix(old_keypoint, bilinear_ix.data(), bilinear_iy.data());
-
- const float A11 = iA11 * FLT_SCALE;
- const float A12 = iA12 * FLT_SCALE;
- const float A22 = iA22 * FLT_SCALE;
-
- // Calculate minimum eigenvalue
- const float sum_A11_A22 = A11 + A22;
- const float discriminant = sum_A11_A22 * sum_A11_A22 - 4.0f * (A11 * A22 - A12 * A12);
- // Divide by _window_dimension^2 to reduce the floating point accummulation error
- const float minimum_eigenvalue = (sum_A11_A22 - std::sqrt(discriminant)) / (2.0f * _window_dimension * _window_dimension);
-
- // Determinant
- const double D = A11 * A22 - A12 * A12;
-
- // Check if it is a good point to track
- if(minimum_eigenvalue < EIGENVALUE_THRESHOLD || D < DETERMINANT_THRESHOLD)
- {
- // Invalidate tracked point
- if(_level == 0)
- {
- new_keypoint.tracking_status = false;
- }
-
- continue;
- }
-
- float prev_delta_x = 0.0f;
- float prev_delta_y = 0.0f;
-
- for(unsigned int j = 0; j < _num_iterations; ++j)
- {
- if(is_invalid_keypoint(new_keypoint))
- {
- if(_level == 0)
- {
- new_keypoint.tracking_status = false;
- }
-
- break;
- }
-
- // Compute image mismatch vector
- int ib1 = 0;
- int ib2 = 0;
-
- std::tie(ib1, ib2) = compute_image_mismatch_vector(old_keypoint, new_keypoint, bilinear_ix.data(), bilinear_iy.data());
-
- double b1 = ib1 * FLT_SCALE;
- double b2 = ib2 * FLT_SCALE;
-
- // Compute motion vector -> A^-1 * -b
- const float delta_x = (A12 * b2 - A22 * b1) / D;
- const float delta_y = (A12 * b1 - A11 * b2) / D;
-
- // Update the new position
- new_keypoint.x += delta_x;
- new_keypoint.y += delta_y;
-
- const float mag2 = delta_x * delta_x + delta_y * delta_y;
-
- // Check if termination criteria is EPSILON and if it is satisfied
- if(mag2 <= _epsilon && (_termination == Termination::TERM_CRITERIA_EPSILON || _termination == Termination::TERM_CRITERIA_BOTH))
- {
- break;
- }
-
- // Check convergence analyzing the previous delta
- if(j > 0 && std::fabs(delta_x + prev_delta_x) < 0.01f && std::fabs(delta_y + prev_delta_y) < 0.01f)
- {
- new_keypoint.x -= delta_x * _pyramid_scale;
- new_keypoint.y -= delta_y * _pyramid_scale;
- break;
- }
-
- prev_delta_x = delta_x;
- prev_delta_y = delta_y;
- }
- }
-
- if(_level == 0)
- {
- for(int list_indx = list_start; list_indx < list_end; ++list_indx)
- {
- const NELKInternalKeypoint &new_keypoint = _new_points_internal->at(list_indx);
-
- _new_points->at(list_indx).x = roundf(new_keypoint.x);
- _new_points->at(list_indx).y = roundf(new_keypoint.y);
- _new_points->at(list_indx).tracking_status = new_keypoint.tracking_status ? 1 : 0;
- }
- }
-}
diff --git a/src/core/NEON/kernels/NELKTrackerKernel.h b/src/core/NEON/kernels/NELKTrackerKernel.h
deleted file mode 100644
index bc4f6ce..0000000
--- a/src/core/NEON/kernels/NELKTrackerKernel.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2016-2021 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.
- */
-#ifndef ARM_COMPUTE_LKTRACKERKERNEL_H
-#define ARM_COMPUTE_LKTRACKERKERNEL_H
-
-#include "arm_compute/core/IArray.h"
-#include "arm_compute/core/Types.h"
-#include "src/core/NEON/INEKernel.h"
-
-#include <cstddef>
-#include <cstdint>
-#include <tuple>
-#include <utility>
-
-namespace arm_compute
-{
-class ITensor;
-
-/** Interface for Neon Array of Internal Key Points. */
-using INELKInternalKeypointArray = IArray<NELKInternalKeypoint>;
-
-/** Interface for the Lucas-Kanade tracker kernel */
-class NELKTrackerKernel : public INEKernel
-{
-public:
- const char *name() const override
- {
- return "NELKTrackerKernel";
- }
- /** Default constructor */
- NELKTrackerKernel();
- /** Prevent instances of this class from being copied (As this class contains pointers) */
- NELKTrackerKernel(const NELKTrackerKernel &) = delete;
- /** Prevent instances of this class from being copied (As this class contains pointers) */
- NELKTrackerKernel &operator=(const NELKTrackerKernel &) = delete;
- /** Allow instances of this class to be moved */
- NELKTrackerKernel(NELKTrackerKernel &&) = default;
- /** Allow instances of this class to be moved */
- NELKTrackerKernel &operator=(NELKTrackerKernel &&) = default;
- /** Default destructor */
- ~NELKTrackerKernel() = default;
-
- /** Initialise the kernel input and output
- *
- * @param[in] input_old Pointer to the input old tensor. Data type supported: U8
- * @param[in] input_new Pointer to the input new tensor. Data type supported. U8
- * @param[in] old_scharr_gx Pointer to the input scharr X tensor. Data type supported: S16
- * @param[in] old_scharr_gy Pointer to the input scharr Y tensor. Data type supported: S16
- * @param[in] old_points Pointer to the IKeyPointArray storing old key points
- * @param[in] new_points_estimates Pointer to the IKeyPointArray storing new estimates key points
- * @param[out] new_points Pointer to the IKeyPointArray storing new key points
- * @param[in, out] old_points_internal Pointer to the array of NELKInternalKeypoint for old points
- * @param[out] new_points_internal Pointer to the array of NELKInternalKeypoint for new points
- * @param[in] termination The criteria to terminate the search of each keypoint.
- * @param[in] use_initial_estimate The flag to indicate whether the initial estimated position should be used
- * @param[in] epsilon The error for terminating the algorithm
- * @param[in] num_iterations The maximum number of iterations before terminate the algorithm
- * @param[in] window_dimension The size of the window on which to perform the algorithm
- * @param[in] level The pyramid level
- * @param[in] num_levels The number of pyramid levels
- * @param[in] pyramid_scale Scale factor used for generating the pyramid
- */
- void configure(const ITensor *input_old, const ITensor *input_new, const ITensor *old_scharr_gx, const ITensor *old_scharr_gy,
- const IKeyPointArray *old_points, const IKeyPointArray *new_points_estimates, IKeyPointArray *new_points,
- INELKInternalKeypointArray *old_points_internal, INELKInternalKeypointArray *new_points_internal,
- Termination termination, bool use_initial_estimate, float epsilon, unsigned int num_iterations, size_t window_dimension,
- size_t level, size_t num_levels, float pyramid_scale);
-
- // Inherited methods overridden:
- void run(const Window &window, const ThreadInfo &info) override;
- BorderSize border_size() const override;
-
-private:
- /** Initialise the array of keypoints in the provide range
- *
- * @param[in] start Index of first element in the keypoints array to be initialised
- * @param[in] end Index after last elelemnt in the keypoints array to be initialised
- */
- void init_keypoints(int start, int end);
- /** Compute the structure tensor A^T * A based on the scharr gradients I_x and I_y
- *
- * @param[in] keypoint Keypoint for which gradients are computed
- * @param[out] bilinear_ix Intermediate interpolated data for X gradient
- * @param[out] bilinear_iy Intermediate interpolated data for Y gradient
- *
- * @return Values A11, A12, A22
- */
- std::tuple<int, int, int> compute_spatial_gradient_matrix(const NELKInternalKeypoint &keypoint, int32_t *bilinear_ix, int32_t *bilinear_iy);
- /** Compute the vector A^T * b, i.e. -sum(I_d * I_t) for d in {x,y}
- *
- * @param[in] old_keypoint Old keypoint for which gradient is computed
- * @param[in] new_keypoint New keypoint for which gradient is computed
- * @param[in] bilinear_ix Intermediate interpolated data for X gradient
- * @param[in] bilinear_iy Intermediate interpolated data for Y gradient
- *
- * @return Values b1, b2
- */
- std::pair<int, int> compute_image_mismatch_vector(const NELKInternalKeypoint &old_keypoint, const NELKInternalKeypoint &new_keypoint, const int32_t *bilinear_ix, const int32_t *bilinear_iy);
-
- const ITensor *_input_old;
- const ITensor *_input_new;
- const ITensor *_old_scharr_gx;
- const ITensor *_old_scharr_gy;
- IKeyPointArray *_new_points;
- const IKeyPointArray *_new_points_estimates;
- const IKeyPointArray *_old_points;
- INELKInternalKeypointArray *_old_points_internal;
- INELKInternalKeypointArray *_new_points_internal;
- Termination _termination;
- bool _use_initial_estimate;
- float _pyramid_scale;
- float _epsilon;
- unsigned int _num_iterations;
- int _window_dimension;
- unsigned int _level;
- unsigned int _num_levels;
- ValidRegion _valid_region;
-};
-} // namespace arm_compute
-#endif /*ARM_COMPUTE_NELKTRACKERKERNEL_H */
diff --git a/src/core/NEON/kernels/NEROIPoolingLayerKernel.h b/src/core/NEON/kernels/NEROIPoolingLayerKernel.h
index 2fcdb81..e7a7e90 100644
--- a/src/core/NEON/kernels/NEROIPoolingLayerKernel.h
+++ b/src/core/NEON/kernels/NEROIPoolingLayerKernel.h
@@ -25,9 +25,6 @@
#define ARM_COMPUTE_NEROIPOOLINGLAYERKERNEL_H
#include "src/core/NEON/INEKernel.h"
-
-#include "arm_compute/core/IArray.h"
-
namespace arm_compute
{
class ITensor;
@@ -90,7 +87,7 @@
private:
const ITensor *_input;
const ITensor *_rois;
- const ITensor *_output;
+ const ITensor *_output;
ROIPoolingLayerInfo _pool_info;
};
} // namespace arm_compute
diff --git a/src/core/PyramidInfo.cpp b/src/core/PyramidInfo.cpp
deleted file mode 100644
index 7a8fa0b..0000000
--- a/src/core/PyramidInfo.cpp
+++ /dev/null
@@ -1,105 +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/core/PyramidInfo.h"
-
-#include "arm_compute/core/Error.h"
-#include "arm_compute/core/TensorShape.h"
-
-#include <cmath>
-
-using namespace arm_compute;
-
-PyramidInfo::PyramidInfo()
- : _num_levels(0), _tensor_shape(), _format(Format::UNKNOWN), _scale(0.0f)
-{
-}
-
-PyramidInfo::PyramidInfo(size_t num_levels, float scale, size_t width, size_t height, Format format)
- : PyramidInfo()
-{
- init(num_levels, scale, width, height, format);
-}
-
-PyramidInfo::PyramidInfo(size_t num_levels, float scale, const TensorShape &tensor_shape, Format format)
- : PyramidInfo()
-{
- init(num_levels, scale, tensor_shape, format);
-}
-
-void PyramidInfo::init(size_t num_levels, float scale, size_t width, size_t height, Format format)
-{
- init(num_levels, scale, TensorShape(width, height), format);
-}
-
-void PyramidInfo::init(size_t num_levels, float scale, const TensorShape &tensor_shape, Format format)
-{
- ARM_COMPUTE_ERROR_ON(0 == num_levels);
- ARM_COMPUTE_ERROR_ON(0.0f == scale);
- ARM_COMPUTE_ERROR_ON(0 == tensor_shape.x());
- ARM_COMPUTE_ERROR_ON(0 == tensor_shape.y());
- ARM_COMPUTE_ERROR_ON(Format::IYUV == format);
- ARM_COMPUTE_ERROR_ON(Format::NV12 == format);
- ARM_COMPUTE_ERROR_ON(Format::NV21 == format);
- ARM_COMPUTE_ERROR_ON(Format::UYVY422 == format);
- ARM_COMPUTE_ERROR_ON(Format::YUV444 == format);
- ARM_COMPUTE_ERROR_ON(Format::YUYV422 == format);
- ARM_COMPUTE_ERROR_ON_MSG(0 != _num_levels, "PyramidInfo already initialized");
- ARM_COMPUTE_ERROR_ON(0 == (tensor_shape.x() * pow(scale, num_levels)));
- ARM_COMPUTE_ERROR_ON(0 == (tensor_shape.y() * pow(scale, num_levels)));
-
- _num_levels = num_levels;
- _format = format;
- _scale = scale;
- _tensor_shape = tensor_shape;
-}
-
-size_t PyramidInfo::num_levels() const
-{
- return _num_levels;
-}
-
-size_t PyramidInfo::width() const
-{
- return _tensor_shape.x();
-}
-
-size_t PyramidInfo::height() const
-{
- return _tensor_shape.y();
-}
-
-const TensorShape &PyramidInfo::tensor_shape() const
-{
- return _tensor_shape;
-}
-
-Format PyramidInfo::format() const
-{
- return _format;
-}
-
-float PyramidInfo::scale() const
-{
- return _scale;
-}
diff --git a/src/core/TensorInfo.cpp b/src/core/TensorInfo.cpp
index bedfe14..c471615 100644
--- a/src/core/TensorInfo.cpp
+++ b/src/core/TensorInfo.cpp
@@ -24,7 +24,6 @@
#include "arm_compute/core/TensorInfo.h"
#include "arm_compute/core/Error.h"
-#include "arm_compute/core/HOGInfo.h"
#include "arm_compute/core/Helpers.h"
#include "arm_compute/core/TensorInfo.h"
#include "arm_compute/core/Validate.h"
@@ -100,12 +99,6 @@
_data_layout = data_layout;
}
-TensorInfo::TensorInfo(const HOGInfo &hog_info, unsigned int width, unsigned int height)
- : TensorInfo()
-{
- init(hog_info, width, height);
-}
-
void TensorInfo::init(Format format)
{
init(TensorShape(), format);
@@ -166,20 +159,6 @@
_valid_region = ValidRegion{ Coordinates(), _tensor_shape };
}
-void TensorInfo::init(const HOGInfo &hog_info, unsigned int width, unsigned int height)
-{
- // Number of cells for each block
- const Size2D num_cells_per_block = hog_info.num_cells_per_block();
-
- // Tensor Size = (Number of horizontal block positions) * (Number of vertical block positions)
- const Size2D num_block_positions_per_img = hog_info.num_block_positions_per_image(Size2D(width, height));
-
- // Number of tensor channels = (Number of cells per block) * (Number of bins per cell)
- const size_t num_channels = num_cells_per_block.area() * hog_info.num_bins();
-
- init(TensorShape(num_block_positions_per_img.width, num_block_positions_per_img.height), num_channels, DataType::F32);
-}
-
size_t TensorInfo::init_auto_padding(const TensorShape &tensor_shape, Format format)
{
const size_t num_channels = num_channels_from_format(format);
@@ -207,20 +186,6 @@
return _total_size;
}
-size_t TensorInfo::init_auto_padding(const HOGInfo &hog_info, unsigned int width, unsigned int height)
-{
- // Number of cells for each block
- const Size2D num_cells_per_block = hog_info.num_cells_per_block();
-
- // Tensor Size = (Number of horizontal block positions) * (Number of vertical block positions)
- const Size2D num_block_positions_per_img = hog_info.num_block_positions_per_image(Size2D(width, height));
-
- // Number of tensor channels = (Number of cells per block) * (Number of bins per cell)
- const size_t num_channels = num_cells_per_block.area() * hog_info.num_bins();
-
- return init_auto_padding(TensorShape(num_block_positions_per_img.width, num_block_positions_per_img.height), num_channels, DataType::F32);
-}
-
bool TensorInfo::auto_padding()
{
ARM_COMPUTE_ERROR_ON(!_is_resizable);
diff --git a/src/core/TracePoint.cpp b/src/core/TracePoint.cpp
index 69374fb..c72c15f 100644
--- a/src/core/TracePoint.cpp
+++ b/src/core/TracePoint.cpp
@@ -23,14 +23,6 @@
*/
#include "arm_compute/core/TracePoint.h"
-#include "arm_compute/core/HOGInfo.h"
-#include "arm_compute/core/IArray.h"
-#include "arm_compute/core/IDistribution1D.h"
-#include "arm_compute/core/IHOG.h"
-#include "arm_compute/core/ILut.h"
-#include "arm_compute/core/IMultiHOG.h"
-#include "arm_compute/core/IMultiImage.h"
-#include "arm_compute/core/IPyramid.h"
#include "arm_compute/core/ITensor.h"
#include "arm_compute/core/KernelDescriptors.h"
#include "arm_compute/core/PixelValue.h"
@@ -124,18 +116,8 @@
}
ARM_COMPUTE_TRACE_TO_STRING(ThresholdType)
-ARM_COMPUTE_TRACE_TO_STRING(IDetectionWindowArray)
-ARM_COMPUTE_TRACE_TO_STRING(ICoordinates2DArray)
-ARM_COMPUTE_TRACE_TO_STRING(IMultiImage)
using pair_uint = std::pair<unsigned int, unsigned int>;
ARM_COMPUTE_TRACE_TO_STRING(pair_uint)
-ARM_COMPUTE_TRACE_TO_STRING(IKeyPointArray)
-ARM_COMPUTE_TRACE_TO_STRING(IDistribution1D)
-ARM_COMPUTE_TRACE_TO_STRING(IHOG)
-ARM_COMPUTE_TRACE_TO_STRING(ILut)
-ARM_COMPUTE_TRACE_TO_STRING(IPyramid)
-ARM_COMPUTE_TRACE_TO_STRING(IMultiHOG)
-ARM_COMPUTE_TRACE_TO_STRING(ISize2DArray)
ARM_COMPUTE_TRACE_TO_STRING(MemoryGroup)
ARM_COMPUTE_TRACE_TO_STRING(BoxNMSLimitInfo)
ARM_COMPUTE_TRACE_TO_STRING(DepthwiseConvolutionReshapeInfo)
@@ -236,18 +218,8 @@
ARM_COMPUTE_CONST_PTR_CLASS(ITensorInfo)
ARM_COMPUTE_CONST_PTR_CLASS(IWeightsManager)
ARM_COMPUTE_CONST_PTR_CLASS(InternalKeypoint)
-ARM_COMPUTE_CONST_PTR_CLASS(IDetectionWindowArray)
-ARM_COMPUTE_CONST_PTR_CLASS(ICoordinates2DArray)
-ARM_COMPUTE_CONST_PTR_CLASS(IMultiImage)
ARM_COMPUTE_CONST_PTR_CLASS(Window)
-ARM_COMPUTE_CONST_PTR_CLASS(IKeyPointArray)
ARM_COMPUTE_CONST_PTR_CLASS(HOGInfo)
-ARM_COMPUTE_CONST_PTR_CLASS(IDistribution1D)
-ARM_COMPUTE_CONST_PTR_CLASS(IHOG)
-ARM_COMPUTE_CONST_PTR_CLASS(ILut)
-ARM_COMPUTE_CONST_PTR_CLASS(IPyramid)
-ARM_COMPUTE_CONST_PTR_CLASS(IMultiHOG)
-ARM_COMPUTE_CONST_PTR_CLASS(ISize2DArray)
ARM_COMPUTE_CONST_PTR_CLASS(std::allocator<ITensor const *>)
ARM_COMPUTE_CONST_PTR_CLASS(std::vector<unsigned int>)
diff --git a/src/core/Utils.cpp b/src/core/Utils.cpp
index 8deb597..e44c86d 100644
--- a/src/core/Utils.cpp
+++ b/src/core/Utils.cpp
@@ -184,31 +184,6 @@
return act_map[act];
}
-const std::string &string_from_matrix_pattern(MatrixPattern pattern)
-{
- static std::map<MatrixPattern, const std::string> pattern_map =
- {
- { MatrixPattern::BOX, "BOX" },
- { MatrixPattern::CROSS, "CROSS" },
- { MatrixPattern::DISK, "DISK" },
- { MatrixPattern::OTHER, "OTHER" },
- };
-
- return pattern_map[pattern];
-}
-
-const std::string &string_from_non_linear_filter_function(NonLinearFilterFunction function)
-{
- static std::map<NonLinearFilterFunction, const std::string> func_map =
- {
- { NonLinearFilterFunction::MAX, "MAX" },
- { NonLinearFilterFunction::MEDIAN, "MEDIAN" },
- { NonLinearFilterFunction::MIN, "MIN" },
- };
-
- return func_map[function];
-}
-
const std::string &string_from_interpolation_policy(InterpolationPolicy policy)
{
static std::map<InterpolationPolicy, const std::string> interpolation_policy_map =
diff --git a/src/core/Validate.cpp b/src/core/Validate.cpp
index 8bb5079..5a6486e 100644
--- a/src/core/Validate.cpp
+++ b/src/core/Validate.cpp
@@ -141,28 +141,6 @@
return arm_compute::Status{};
}
-arm_compute::Status arm_compute::error_on_invalid_multi_hog(const char *function, const char *file, const int line,
- const arm_compute::IMultiHOG *multi_hog)
-{
- ARM_COMPUTE_RETURN_ERROR_ON_LOC(nullptr == multi_hog, function, file, line);
- ARM_COMPUTE_RETURN_ERROR_ON_LOC(0 == multi_hog->num_models(), function, file, line);
-
- for(size_t i = 1; i < multi_hog->num_models(); ++i)
- {
- ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(multi_hog->model(0)->info()->phase_type() != multi_hog->model(i)->info()->phase_type(),
- function, file, line,
- "All HOG parameters must have the same phase type");
- ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(multi_hog->model(0)->info()->normalization_type() != multi_hog->model(i)->info()->normalization_type(),
- function, file, line,
- "All HOG parameters must have the same normalization type");
- ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG((multi_hog->model(0)->info()->l2_hyst_threshold() != multi_hog->model(i)->info()->l2_hyst_threshold())
- && (multi_hog->model(0)->info()->normalization_type() == arm_compute::HOGNormType::L2HYS_NORM),
- function, file, line,
- "All HOG parameters must have the same l2 hysteresis threshold if you use L2 hysteresis normalization type");
- }
- return arm_compute::Status{};
-}
-
arm_compute::Status arm_compute::error_on_unconfigured_kernel(const char *function, const char *file, const int line,
const arm_compute::IKernel *kernel)
{