aboutsummaryrefslogtreecommitdiff
path: root/src/core/CL/kernels/CLGaussianPyramidKernel.cpp
diff options
context:
space:
mode:
authorSanghoon Lee <sanghoon.lee@arm.com>2018-03-15 11:48:48 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:49:37 +0000
commit1cd41495153c4e89d6195b42f870967339c1a13b (patch)
treeaf33572d72a3c1591148dbd6fc0fb9cf53a79ee3 /src/core/CL/kernels/CLGaussianPyramidKernel.cpp
parentc9c62c2fa1c80ba7f11b0d0732740460dfa00e74 (diff)
downloadComputeLibrary-1cd41495153c4e89d6195b42f870967339c1a13b.tar.gz
COMPMID-577: Implement CL validation for GaussianPyramid
Change-Id: If879cbe15b14d97818c24d44b29fc69b6c8cb686 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/127601 Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'src/core/CL/kernels/CLGaussianPyramidKernel.cpp')
-rw-r--r--src/core/CL/kernels/CLGaussianPyramidKernel.cpp39
1 files changed, 14 insertions, 25 deletions
diff --git a/src/core/CL/kernels/CLGaussianPyramidKernel.cpp b/src/core/CL/kernels/CLGaussianPyramidKernel.cpp
index 34a228c717..a4fda364e3 100644
--- a/src/core/CL/kernels/CLGaussianPyramidKernel.cpp
+++ b/src/core/CL/kernels/CLGaussianPyramidKernel.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -32,20 +32,19 @@
using namespace arm_compute;
CLGaussianPyramidHorKernel::CLGaussianPyramidHorKernel()
- : _border_size(0), _l2_load_offset(0)
+ : _l2_load_offset(0)
{
}
BorderSize CLGaussianPyramidHorKernel::border_size() const
{
- return _border_size;
+ return BorderSize(0, 2);
}
-void CLGaussianPyramidHorKernel::configure(const ICLTensor *input, ICLTensor *output, bool border_undefined)
+void CLGaussianPyramidHorKernel::configure(const ICLTensor *input, ICLTensor *output)
{
ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8);
ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, 1, DataType::U16);
- ARM_COMPUTE_ERROR_ON(input->info()->dimension(0) != 2 * output->info()->dimension(0));
ARM_COMPUTE_ERROR_ON(input->info()->dimension(1) != output->info()->dimension(1));
for(size_t i = 2; i < Coordinates::num_max_dimensions; ++i)
@@ -53,9 +52,8 @@ void CLGaussianPyramidHorKernel::configure(const ICLTensor *input, ICLTensor *ou
ARM_COMPUTE_ERROR_ON(input->info()->dimension(i) != output->info()->dimension(i));
}
- _input = input;
- _output = output;
- _border_size = BorderSize(border_undefined ? 0 : 2, 2);
+ _input = input;
+ _output = output;
// Create kernel
_kernel = static_cast<cl::Kernel>(CLKernelLibrary::get().create_kernel("gaussian1x5_sub_x"));
@@ -64,9 +62,9 @@ void CLGaussianPyramidHorKernel::configure(const ICLTensor *input, ICLTensor *ou
constexpr unsigned int num_elems_processed_per_iteration = 16;
constexpr unsigned int num_elems_read_per_iteration = 20;
constexpr unsigned int num_elems_written_per_iteration = 8;
- constexpr float scale_x = 0.5f;
+ const float scale_x = static_cast<float>(output->info()->dimension(0)) / input->info()->dimension(0);
- Window win = calculate_max_window_horizontal(*input->info(), Steps(num_elems_processed_per_iteration), border_undefined, border_size());
+ Window win = calculate_max_window_horizontal(*input->info(), Steps(num_elems_processed_per_iteration));
AccessWindowHorizontal output_access(output->info(), 0, num_elems_written_per_iteration, scale_x);
// Sub sampling selects odd pixels (1, 3, 5, ...) for images with even
@@ -95,11 +93,7 @@ void CLGaussianPyramidHorKernel::configure(const ICLTensor *input, ICLTensor *ou
AccessWindowHorizontal(input->info(), _l2_load_offset, num_elems_read_per_iteration),
output_access);
- ValidRegion valid_region = input->info()->valid_region();
- valid_region.anchor.set(0, std::ceil((valid_region.anchor[0] + (border_undefined ? border_size().left : 0)) / 2.f));
- valid_region.shape.set(0, (valid_region.shape[0] - (border_undefined ? border_size().right : 0)) / 2 - valid_region.anchor[0]);
-
- output_access.set_valid_region(win, valid_region);
+ output->info()->set_valid_region(ValidRegion(Coordinates(), output->info()->tensor_shape()));
ICLKernel::configure(win);
}
@@ -139,12 +133,11 @@ BorderSize CLGaussianPyramidVertKernel::border_size() const
return BorderSize(2, 0);
}
-void CLGaussianPyramidVertKernel::configure(const ICLTensor *input, ICLTensor *output, bool border_undefined)
+void CLGaussianPyramidVertKernel::configure(const ICLTensor *input, ICLTensor *output)
{
ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U16);
ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, 1, DataType::U8);
ARM_COMPUTE_ERROR_ON(input->info()->dimension(0) != output->info()->dimension(0));
- ARM_COMPUTE_ERROR_ON(input->info()->dimension(1) != 2 * output->info()->dimension(1));
for(size_t i = 2; i < Coordinates::num_max_dimensions; ++i)
{
@@ -163,10 +156,10 @@ void CLGaussianPyramidVertKernel::configure(const ICLTensor *input, ICLTensor *o
constexpr unsigned int num_elems_written_per_iteration = 8;
constexpr unsigned int num_elems_read_per_iteration = 8;
constexpr unsigned int num_rows_per_iteration = 5;
- constexpr float scale_y = 0.5f;
- Window win = calculate_max_window(*input->info(), Steps(num_elems_processed_per_iteration, num_rows_processed_per_iteration),
- border_undefined, border_size());
+ const float scale_y = static_cast<float>(output->info()->dimension(1)) / input->info()->dimension(1);
+
+ Window win = calculate_max_window(*input->info(), Steps(num_elems_processed_per_iteration, num_rows_processed_per_iteration));
AccessWindowRectangle output_access(output->info(), 0, 0, num_elems_written_per_iteration, num_rows_per_iteration, 1.f, scale_y);
// Determine whether we need to load even or odd rows. See above for a
@@ -182,11 +175,7 @@ void CLGaussianPyramidVertKernel::configure(const ICLTensor *input, ICLTensor *o
AccessWindowRectangle(input->info(), 0, _t2_load_offset, num_elems_read_per_iteration, num_rows_per_iteration),
output_access);
- ValidRegion valid_region = input->info()->valid_region();
- valid_region.anchor.set(1, std::ceil((valid_region.anchor[1] + (border_undefined ? border_size().top : 0)) / 2.f));
- valid_region.shape.set(1, (valid_region.shape[1] - (border_undefined ? border_size().bottom : 0)) / 2 - valid_region.anchor[1]);
-
- output_access.set_valid_region(win, valid_region);
+ output->info()->set_valid_region(ValidRegion(Coordinates(), output->info()->tensor_shape()));
ICLKernel::configure(win);
}