From e1651a55c637708347c9adda4a77f1deffacf7d2 Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Thu, 11 Jul 2019 15:00:49 +0100 Subject: COMPMID-2414 Add add_2D_tensor_argument_if for OpenCL Change-Id: I8675b4b4face0be9416ae6c7a7023234d50fc0cb Signed-off-by: Michalis Spyrou Reviewed-on: https://review.mlplatform.org/c/1524 Comments-Addressed: Arm Jenkins Reviewed-by: Michele Di Giorgio Tested-by: Arm Jenkins --- src/core/CL/kernels/CLSobel7x7Kernel.cpp | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) (limited to 'src/core/CL/kernels/CLSobel7x7Kernel.cpp') diff --git a/src/core/CL/kernels/CLSobel7x7Kernel.cpp b/src/core/CL/kernels/CLSobel7x7Kernel.cpp index 8c0b6a239f..6d65ed9e38 100644 --- a/src/core/CL/kernels/CLSobel7x7Kernel.cpp +++ b/src/core/CL/kernels/CLSobel7x7Kernel.cpp @@ -129,16 +129,8 @@ void CLSobel7x7HorKernel::run(const Window &window, cl::CommandQueue &queue) { unsigned int idx = 0; add_2D_tensor_argument(idx, _input, slice); - - if(_run_sobel_x) - { - add_2D_tensor_argument(idx, _output_x, slice); - } - - if(_run_sobel_y) - { - add_2D_tensor_argument(idx, _output_y, slice); - } + add_2D_tensor_argument_if((_run_sobel_x), idx, _output_x, slice); + add_2D_tensor_argument_if((_run_sobel_y), idx, _output_y, slice); enqueue(queue, *this, slice, lws_hint()); } @@ -241,17 +233,10 @@ void CLSobel7x7VertKernel::run(const Window &window, cl::CommandQueue &queue) { unsigned int idx = 0; - if(_run_sobel_x) - { - add_2D_tensor_argument(idx, _input_x, slice); - add_2D_tensor_argument(idx, _output_x, slice); - } - - if(_run_sobel_y) - { - add_2D_tensor_argument(idx, _input_y, slice); - add_2D_tensor_argument(idx, _output_y, slice); - } + add_2D_tensor_argument_if((_run_sobel_x), idx, _input_x, slice); + add_2D_tensor_argument_if((_run_sobel_x), idx, _output_x, slice); + add_2D_tensor_argument_if((_run_sobel_y), idx, _input_y, slice); + add_2D_tensor_argument_if((_run_sobel_y), idx, _output_y, slice); _kernel.setArg(idx++, 0 /*dummy*/); -- cgit v1.2.1