diff options
author | Sanghoon Lee <sanghoon.lee@arm.com> | 2017-10-18 12:09:04 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:35:24 +0000 |
commit | fc35b51d598d12e2a0895ed82d2368f07df68829 (patch) | |
tree | cc1c1b58f7893f7ee248e6322f47004840341286 /src | |
parent | 37908d9e675a240f65e038796f44691c4c530229 (diff) | |
download | ComputeLibrary-fc35b51d598d12e2a0895ed82d2368f07df68829.tar.gz |
COMPMID-580 - Implement reference and CL/NEON validation for Remap
Change-Id: I8ae6b5111b594f224ad9b600cdf078459a8cac36
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/93281
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/CL/kernels/CLRemapKernel.cpp | 11 | ||||
-rw-r--r-- | src/core/NEON/kernels/NERemapKernel.cpp | 17 |
2 files changed, 20 insertions, 8 deletions
diff --git a/src/core/CL/kernels/CLRemapKernel.cpp b/src/core/CL/kernels/CLRemapKernel.cpp index e63a5ef7c6..b46bb30c59 100644 --- a/src/core/CL/kernels/CLRemapKernel.cpp +++ b/src/core/CL/kernels/CLRemapKernel.cpp @@ -54,6 +54,7 @@ void CLRemapKernel::configure(const ICLTensor *input, const ICLTensor *map_x, co ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(map_x, 1, DataType::F32); ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(map_y, 1, DataType::F32); ARM_COMPUTE_ERROR_ON_MSG(policy == InterpolationPolicy::AREA, "Area interpolation is not supported!"); + ARM_COMPUTE_UNUSED(border_undefined); _input = input; _output = output; @@ -69,12 +70,14 @@ void CLRemapKernel::configure(const ICLTensor *input, const ICLTensor *map_x, co // Configure window constexpr unsigned int num_elems_processed_per_iteration = 4; - const int border_offset = (border_undefined) ? 0 : border_size().left; + + const int total_right = ceil_to_multiple(input->info()->dimension(0), num_elems_processed_per_iteration); + const int access_right = total_right + (((total_right - input->info()->dimension(0)) == 0) ? border_size().right : 0); Window win = calculate_max_window(*_output->info(), Steps(num_elems_processed_per_iteration)); - AccessWindowStatic input_access(output->info(), -border_offset, -border_offset, - _output->info()->dimension(0) + border_offset, _output->info()->dimension(1) + border_offset); - AccessWindowHorizontal output_access(input->info(), 0, num_elems_processed_per_iteration); + AccessWindowStatic input_access(input->info(), -border_size().left, -border_size().top, access_right, input->info()->dimension(1) + border_size().bottom); + + AccessWindowHorizontal output_access(output->info(), 0, num_elems_processed_per_iteration); update_window_and_padding(win, input_access, output_access); diff --git a/src/core/NEON/kernels/NERemapKernel.cpp b/src/core/NEON/kernels/NERemapKernel.cpp index 83004aedc1..9b8d931b39 100644 --- a/src/core/NEON/kernels/NERemapKernel.cpp +++ b/src/core/NEON/kernels/NERemapKernel.cpp @@ -68,6 +68,11 @@ NERemapKernel::NERemapKernel() { } +BorderSize NERemapKernel::border_size() const +{ + return BorderSize(1); +} + void NERemapKernel::configure(const ITensor *input, const ITensor *map_x, const ITensor *map_y, ITensor *output, InterpolationPolicy policy) { ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8); @@ -102,15 +107,19 @@ void NERemapKernel::configure(const ITensor *input, const ITensor *map_x, const // Configure kernel window Window win = calculate_max_window(*output->info(), Steps(num_elems_processed_per_iteration)); - AccessWindowStatic output_access(output->info(), 0, 0, output->info()->dimension(0), output->info()->dimension(1)); + const int total_right = ceil_to_multiple(input->info()->dimension(0), num_elems_processed_per_iteration); + const int access_right = total_right + (((total_right - input->info()->dimension(0)) == 0) ? border_size().right : 0); + + AccessWindowStatic input_access(input->info(), -border_size().left, -border_size().top, access_right, input->info()->dimension(1) + border_size().bottom); + + AccessWindowHorizontal output_access(output->info(), 0, num_elems_processed_per_iteration); - update_window_and_padding(win, - AccessWindowRectangle(input->info(), 0, 0, num_elems_processed_per_iteration, 1), + update_window_and_padding(win, input_access, AccessWindowRectangle(map_x->info(), 0, 0, num_elems_processed_per_iteration, 1), AccessWindowRectangle(map_y->info(), 0, 0, num_elems_processed_per_iteration, 1), output_access); - output_access.set_valid_region(win, ValidRegion(Coordinates(0, 0), output->info()->tensor_shape())); + output_access.set_valid_region(win, ValidRegion(Coordinates(), output->info()->tensor_shape())); INEKernel::configure(win); } |