From c70f8b1a544fe3341310b7b329f37e885fdd0cdc Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Sun, 15 Nov 2020 04:12:37 +0000 Subject: COMPMID-3967: Fix NEColorConvert segfault Force odd tensor shape adjustment in case of multi-planar images to closest even towards infinity instead of zero. This avoids issues when width or height are 1, which used to round down to zero. Signed-off-by: Georgios Pinitas Change-Id: Ia52380ae8941ed83128fb8a2351d7a2e9f4421d9 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4412 Tested-by: Arm Jenkins Reviewed-by: Michele Di Giorgio Comments-Addressed: Arm Jenkins --- arm_compute/core/Utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arm_compute/core/Utils.h b/arm_compute/core/Utils.h index 1c02e89ab6..e2c1ba938b 100644 --- a/arm_compute/core/Utils.h +++ b/arm_compute/core/Utils.h @@ -751,13 +751,13 @@ inline TensorShape adjust_odd_shape(const TensorShape &shape, Format format) // Force width to be even for formats which require subsampling of the U and V channels if(has_format_horizontal_subsampling(format)) { - output.set(0, output.x() & ~1U); + output.set(0, (output.x() + 1) & ~1U); } // Force height to be even for formats which require subsampling of the U and V channels if(has_format_vertical_subsampling(format)) { - output.set(1, output.y() & ~1U); + output.set(1, (output.y() + 1) & ~1U); } return output; -- cgit v1.2.1