From b3e0d61903386a42e2fa126634cfcf09ba738437 Mon Sep 17 00:00:00 2001 From: Mark Horvath Date: Wed, 24 Jan 2024 18:07:18 +0100 Subject: [PATCH 1/2] Fix zip_parallel_rows function for odd heights --- intrinsiccv/include/types.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/intrinsiccv/include/types.h b/intrinsiccv/include/types.h index f6703c738..a21bba919 100644 --- a/intrinsiccv/include/types.h +++ b/intrinsiccv/include/types.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023 Arm Limited and/or its affiliates +// SPDX-FileCopyrightText: 2023 - 2024 Arm Limited and/or its affiliates // // SPDX-License-Identifier: Apache-2.0 @@ -541,13 +541,14 @@ template void zip_parallel_rows(OperationType &operation, Rectangle rect, RowTypes... rows) INTRINSICCV_STREAMING_COMPATIBLE { for (size_t row_index = 0; row_index < rect.height(); row_index += 2) { - operation.process_row(rect.width(), rows.as_columns()...); - // Call pre-increment operator on all elements in the parameter pack. - ((++rows), ...); // Handle the last odd row in a special way. if (INTRINSICCV_UNLIKELY(row_index == (rect.height() - 1))) { ((rows.make_single_row(), ...)); } + + operation.process_row(rect.width(), rows.as_columns()...); + // Call pre-increment operator on all elements in the parameter pack. + ((++rows), ...); } } -- GitLab From d6262cc58b4953fb8fc1a57c6856710e92627369 Mon Sep 17 00:00:00 2001 From: Mark Horvath Date: Wed, 24 Jan 2024 18:10:09 +0100 Subject: [PATCH 2/2] [tests] Fix heights for YUV2RGB tests Padding version of test cases also added. --- test/api/test_yuv_to_rgb.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/test/api/test_yuv_to_rgb.cpp b/test/api/test_yuv_to_rgb.cpp index 876e4dce5..931695a9a 100644 --- a/test/api/test_yuv_to_rgb.cpp +++ b/test/api/test_yuv_to_rgb.cpp @@ -16,34 +16,44 @@ class YuvTest final { template void execute_scalar_test(F impl, bool is_nv21) { size_t scalar_path_width = 5; - execute_test(impl, scalar_path_width, is_nv21); + execute_test(impl, scalar_path_width, is_nv21, 0); + // Padding version + execute_test(impl, scalar_path_width, is_nv21, + test::Options::vector_length()); } template void execute_vector_test(F impl, bool is_nv21) { size_t vector_path_width = (2 * test::Options::vector_lanes()) - 3; - execute_test(impl, vector_path_width, is_nv21); + execute_test(impl, vector_path_width, is_nv21, 0); + // Padding version + execute_test(impl, vector_path_width, is_nv21, + test::Options::vector_length()); } private: template - void execute_test(F impl, size_t logical_width, bool is_nv21) { - test::Array2D input_y{logical_width, 7}; + void execute_test(F impl, size_t logical_width, bool is_nv21, + size_t padding) { + test::Array2D input_y{logical_width, 5, padding}; input_y.set(0, 0, {10, 20, 255, 199}); input_y.set(1, 0, {1, 120, 0, 17}); input_y.set(2, 0, {2, 3, 240, 228}); - input_y.set(6, 0, {7, 11, 128, 129}); + input_y.set(4, 0, {7, 11, 128, 129}); // the width of the UV input must be even - test::Array2D input_uv{__builtin_align_up(logical_width, 2), 3}; + test::Array2D input_uv{__builtin_align_up(logical_width, 2), 3, + padding}; input_uv.set(0, 0, {100, 130, 255, 255}); input_uv.set(1, 0, {0, 1, 3, 4}); input_uv.set(2, 0, {7, 8, 9, 10}); - test::Array2D expected{logical_width * channel_number_, 6}; + test::Array2D expected{logical_width * channel_number_, + input_y.height(), padding}; calculate_expected(input_y, input_uv, expected, is_nv21); - test::Array2D actual{logical_width * channel_number_, 6}; + test::Array2D actual{logical_width * channel_number_, + input_y.height(), padding}; impl(input_y.data(), input_y.stride(), input_uv.data(), input_uv.stride(), actual.data(), actual.stride(), expected.width() / channel_number_, -- GitLab