From 0d0673dc5b1e3fcbb1c396f31e5d83326cebfafa Mon Sep 17 00:00:00 2001 From: Michael Platings Date: Mon, 3 Jun 2024 14:25:12 +0000 Subject: [PATCH] Ignore stride for single-row images If the image is a single row then the stride will not be used. In that case allow stride to be misaligned. In some cases OpenCV will pass a hard-coded stride of 1 when the height of the image is known to be 1, so we must allow such cases. --- kleidicv/include/kleidicv/kleidicv.h | 331 ++++++++++-------- kleidicv/include/kleidicv/utils.h | 21 +- kleidicv/src/analysis/canny_neon.cpp | 4 +- kleidicv/src/analysis/count_nonzeros_neon.cpp | 2 +- kleidicv/src/analysis/min_max_loc_neon.cpp | 2 +- kleidicv/src/analysis/min_max_neon.cpp | 2 +- kleidicv/src/analysis/min_max_sc.h | 2 +- kleidicv/src/arithmetics/absdiff_neon.cpp | 6 +- kleidicv/src/arithmetics/absdiff_sme2.cpp | 6 +- kleidicv/src/arithmetics/absdiff_sve2.cpp | 6 +- .../add_abs_with_threshold_neon.cpp | 6 +- .../arithmetics/add_abs_with_threshold_sc.h | 6 +- kleidicv/src/arithmetics/add_neon.cpp | 6 +- kleidicv/src/arithmetics/add_sme2.cpp | 6 +- kleidicv/src/arithmetics/add_sve2.cpp | 6 +- kleidicv/src/arithmetics/compare_neon.cpp | 6 +- kleidicv/src/arithmetics/compare_sc.h | 6 +- kleidicv/src/arithmetics/exp_neon.cpp | 4 +- kleidicv/src/arithmetics/multiply_neon.cpp | 6 +- kleidicv/src/arithmetics/multiply_sve2.cpp | 6 +- kleidicv/src/arithmetics/scale_neon.cpp | 4 +- kleidicv/src/arithmetics/sub_neon.cpp | 6 +- kleidicv/src/arithmetics/sub_sme2.cpp | 6 +- kleidicv/src/arithmetics/sub_sve2.cpp | 6 +- kleidicv/src/arithmetics/threshold_neon.cpp | 4 +- kleidicv/src/arithmetics/threshold_sc.h | 4 +- kleidicv/src/arithmetics/transpose_neon.cpp | 4 +- kleidicv/src/conversions/gray_to_rgb_neon.cpp | 8 +- kleidicv/src/conversions/gray_to_rgb_sc.h | 8 +- kleidicv/src/conversions/merge_neon.cpp | 12 +- kleidicv/src/conversions/rgb_to_rgb_api.cpp | 8 +- kleidicv/src/conversions/rgb_to_rgb_neon.cpp | 24 +- kleidicv/src/conversions/rgb_to_rgb_sc.h | 24 +- kleidicv/src/conversions/rgb_to_yuv_neon.cpp | 4 +- kleidicv/src/conversions/split_neon.cpp | 12 +- kleidicv/src/conversions/yuv_to_rgb_neon.cpp | 6 +- kleidicv/src/conversions/yuv_to_rgb_sc.h | 6 +- kleidicv/src/filters/gaussian_blur_neon.cpp | 4 +- kleidicv/src/filters/gaussian_blur_sc.h | 4 +- kleidicv/src/filters/sobel_neon.cpp | 8 +- kleidicv/src/filters/sobel_sc.h | 8 +- kleidicv/src/logical/bitwise_and_neon.cpp | 6 +- kleidicv/src/logical/bitwise_and_sc.h | 6 +- kleidicv/src/morphology/morphology_neon.cpp | 8 +- kleidicv/src/morphology/morphology_sc.h | 8 +- kleidicv/src/resize/resize_linear_neon.cpp | 8 +- kleidicv/src/resize/resize_linear_sc.h | 8 +- kleidicv/src/resize/resize_neon.cpp | 4 +- kleidicv/src/resize/resize_sc.h | 4 +- test/api/test_add_abs_with_threshold.cpp | 8 +- test/api/test_bitwise_and.cpp | 8 +- test/api/test_canny.cpp | 6 +- test/api/test_compare.cpp | 12 +- test/api/test_count_nonzeros.cpp | 4 +- test/api/test_merge.cpp | 4 +- test/api/test_min_max.cpp | 4 +- test/api/test_morphology.cpp | 12 +- test/api/test_saturating_absdiff.cpp | 8 +- test/api/test_saturating_add.cpp | 8 +- test/api/test_saturating_multiply.cpp | 8 +- test/api/test_saturating_sub.cpp | 8 +- test/api/test_scale.cpp | 6 +- test/api/test_sobel.cpp | 16 +- test/api/test_split.cpp | 4 +- test/api/test_transpose.cpp | 6 +- 65 files changed, 416 insertions(+), 368 deletions(-) diff --git a/kleidicv/include/kleidicv/kleidicv.h b/kleidicv/include/kleidicv/kleidicv.h index c04dfb170..88dfdc6bd 100644 --- a/kleidicv/include/kleidicv/kleidicv.h +++ b/kleidicv/include/kleidicv/kleidicv.h @@ -78,18 +78,18 @@ extern "C" { /// @param src_a Pointer to the first source data. Must be non-null. /// @param src_a_stride Distance in bytes from the start of one row to the /// start of the next row for the first source data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param src_b Pointer to the second source data. Must be non-null. /// @param src_b_stride Distance in bytes from the start of one row to the /// start of the next row for the second source data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param width Number of elements in a row. /// @param height Number of rows in the data. /// @@ -121,18 +121,18 @@ KLEIDICV_BINARY_OP(kleidicv_saturating_add_u64, uint64_t); /// @param src_a Pointer to the first source data. Must be non-null. /// @param src_a_stride Distance in bytes from the start of one row to the /// start of the next row for the first source data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param src_b Pointer to the second source data. Must be non-null. /// @param src_b_stride Distance in bytes from the start of one row to the /// start of the next row for the second source data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param width Number of elements in a row. /// @param height Number of rows in the data. /// @@ -164,18 +164,18 @@ KLEIDICV_BINARY_OP(kleidicv_saturating_sub_u64, uint64_t); /// @param src_a Pointer to the first source data. Must be non-null. /// @param src_a_stride Distance in bytes from the start of one row to the /// start of the next row for the first source data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param src_b Pointer to the second source data. Must be non-null. /// @param src_b_stride Distance in bytes from the start of one row to the /// start of the next row for the second source data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param width Number of elements in a row. /// @param height Number of rows in the data. /// @@ -201,18 +201,18 @@ KLEIDICV_BINARY_OP(kleidicv_saturating_absdiff_s32, int32_t); /// @param src_a Pointer to the first source data. Must be non-null. /// @param src_a_stride Distance in bytes from the start of one row to the /// start of the next row for the first source data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param src_b Pointer to the second source data. Must be non-null. /// @param src_b_stride Distance in bytes from the start of one row to the /// start of the next row for the second source data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param width Number of elements in a row. /// @param height Number of rows in the data. /// @param scale Currently unused parameter. @@ -241,18 +241,18 @@ KLEIDICV_BINARY_OP_SCALE(kleidicv_saturating_multiply_s32, int32_t, double); /// @param src_a Pointer to the first source data. Must be non-null. /// @param src_a_stride Distance in bytes from the start of one row to the /// start of the next row for the first source data. -/// Must not be less than width * sizeof(type). -/// Must be a multiple of sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param src_b Pointer to the second source data. Must be non-null. /// @param src_b_stride Distance in bytes from the start of one row to the /// start of the next row for the second source data. -/// Must not be less than width * sizeof(type). -/// Must be a multiple of sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must not be less than width * sizeof(type). -/// Must be a multiple of sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param width Number of elements in a row. /// @param height Number of rows in the data. /// @param threshold The value that the elements of the addition result @@ -272,20 +272,20 @@ KLEIDICV_API_DECLARATION(kleidicv_saturating_add_abs_with_threshold_s16, /// limited to @ref KLEIDICV_MAX_IMAGE_PIXELS. /// /// @param src_a Pointer to the first source data. Must be non-null. -/// @param src_b Pointer to the second source data. Must be non-null. /// @param src_a_stride Distance in bytes from the start of one row to the /// start of the next row for the first source data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. +/// @param src_b Pointer to the second source data. Must be non-null. /// @param src_b_stride Distance in bytes from the start of one row to the /// start of the next row for the second source data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param width Number of elements in a row. /// @param height Number of rows in the data. /// @@ -304,11 +304,13 @@ KLEIDICV_BINARY_OP(kleidicv_bitwise_and, uint8_t); /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the /// start of the next row for the source data. -/// Must not be less than width * sizeof(uint8). +/// Must not be less than width, except for single-row +/// images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must not be less than width * 3 * sizeof(uint8). +/// Must not be less than 3*width, except for single-row +/// images. /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// @@ -329,11 +331,13 @@ KLEIDICV_API_DECLARATION(kleidicv_gray_to_rgb_u8, const uint8_t *src, /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the /// start of the next row for the source data. -/// Must not be less than width * sizeof(uint8). +/// Must not be less than width, except for single-row +/// images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must not be less than width * 4 * sizeof(uint8). +/// Must not be less than 4*width, except for single-row +/// images. /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// @@ -354,11 +358,13 @@ KLEIDICV_API_DECLARATION(kleidicv_gray_to_rgba_u8, const uint8_t *src, /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the /// start of the next row for the source data. -/// Must not be less than width * 3 * sizeof(uint8). +/// Must not be less than 3*width, except for single-row +/// images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must not be less than width * 3 * sizeof(uint8). +/// Must not be less than 3*width, except for single-row +/// images. /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// @@ -375,11 +381,13 @@ KLEIDICV_API_DECLARATION(kleidicv_rgb_to_bgr_u8, const uint8_t *src, /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the /// start of the next row for the source data. -/// Must not be less than width * 3 * sizeof(uint8). +/// Must not be less than 3*width, except for single-row +/// images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must not be less than width * 3 * sizeof(uint8). +/// Must not be less than 3*width, except for single-row +/// images. /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// @@ -400,11 +408,13 @@ KLEIDICV_API_DECLARATION(kleidicv_rgb_to_rgb_u8, const uint8_t *src, /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the /// start of the next row for the source data. -/// Must not be less than width * 4 * sizeof(uint8). +/// Must not be less than 4*width, except for single-row +/// images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must not be less than width * 4 * sizeof(uint8). +/// Must not be less than 4*width, except for single-row +/// images. /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// @@ -421,11 +431,13 @@ KLEIDICV_API_DECLARATION(kleidicv_rgba_to_bgra_u8, const uint8_t *src, /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the /// start of the next row for the source data. -/// Must not be less than width * 4 * sizeof(uint8). +/// Must not be less than 4*width, except for single-row +/// images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must not be less than width * 4 * sizeof(uint8). +/// Must not be less than 4*width, except for single-row +/// images. /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// @@ -447,11 +459,13 @@ KLEIDICV_API_DECLARATION(kleidicv_rgba_to_rgba_u8, const uint8_t *src, /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the /// start of the next row for the source data. -/// Must not be less than width * 3 * sizeof(uint8). +/// Must not be less than 3*width, except for single-row +/// images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must not be less than width * 4 * sizeof(uint8). +/// Must not be less than 4*width, except for single-row +/// images. /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// @@ -473,11 +487,13 @@ KLEIDICV_API_DECLARATION(kleidicv_rgb_to_bgra_u8, const uint8_t *src, /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the /// start of the next row for the source data. -/// Must not be less than width * 3 * sizeof(uint8). +/// Must not be less than 3*width, except for single-row +/// images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must not be less than width * 4 * sizeof(uint8). +/// Must not be less than 4*width, except for single-row +/// images. /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// @@ -499,11 +515,13 @@ KLEIDICV_API_DECLARATION(kleidicv_rgb_to_rgba_u8, const uint8_t *src, /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the /// start of the next row for the source data. -/// Must not be less than width * 4 * sizeof(uint8). +/// Must not be less than 4*width, except for single-row +/// images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must not be less than width * 3 * sizeof(uint8). +/// Must not be less than 3*width, except for single-row +/// images. /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// @@ -525,11 +543,13 @@ KLEIDICV_API_DECLARATION(kleidicv_rgba_to_bgr_u8, const uint8_t *src, /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the /// start of the next row for the source data. -/// Must not be less than width * 4 * sizeof(uint8). +/// Must not be less than 4*width, except for single-row +/// images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must not be less than width * 3 * sizeof(uint8). +/// Must not be less than 3*width, except for single-row +/// images. /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// @@ -553,18 +573,21 @@ KLEIDICV_API_DECLARATION(kleidicv_rgba_to_rgb_u8, const uint8_t *src, /// @param src_y Pointer to the input's Y component. Must be non-null. /// @param src_y_stride Distance in bytes from the start of one row to the /// start of the next row for the input's Y component. -/// Must not be less than width * sizeof(u8). +/// Must not be less than width * sizeof(u8), except for +/// single-row images. /// @param src_uv Pointer to the input's interleaved UV components. /// Must be non-null. If the width parameter is odd, the /// width of this input stream still needs to be even. /// @param src_uv_stride Distance in bytes from the start of one row to the /// start of the next row for the input's UV components. /// Must not be less than -/// __builtin_align_up(width, 2) * sizeof(u8). +/// __builtin_align_up(width, 2) * sizeof(u8), except for +/// single-row images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. Must -/// not be less than width * 3 * sizeof(type). +/// not be less than width * 3 * sizeof(type), except for +/// single-row images. /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// @param is_nv21 If true, input is treated as NV21, otherwise treated @@ -591,18 +614,21 @@ KLEIDICV_API_DECLARATION(kleidicv_yuv_sp_to_rgb_u8, const uint8_t *src_y, /// @param src_y Pointer to the input's Y component. Must be non-null. /// @param src_y_stride Distance in bytes from the start of one row to the /// start of the next row for the input's Y component. -/// Must not be less than width * sizeof(u8). +/// Must not be less than width * sizeof(u8), except for +/// single-row images. /// @param src_uv Pointer to the input's interleaved UV components. /// Must be non-null. If the width parameter is odd, the /// width of this input stream still needs to be even. /// @param src_uv_stride Distance in bytes from the start of one row to the /// start of the next row for the input's UV components. /// Must not be less than -/// __builtin_align_up(width, 2) * sizeof(u8). +/// __builtin_align_up(width, 2) * sizeof(u8), except for +/// single-row images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. Must -/// not be less than width * 3 * sizeof(type). +/// not be less than width * 3 * sizeof(type), except for +/// single-row images. /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// @param is_nv21 If true, input is treated as NV21, otherwise treated @@ -627,18 +653,21 @@ KLEIDICV_API_DECLARATION(kleidicv_yuv_sp_to_bgr_u8, const uint8_t *src_y, /// @param src_y Pointer to the input's Y component. Must be non-null. /// @param src_y_stride Distance in bytes from the start of one row to the /// start of the next row for the input's Y component. -/// Must not be less than width * sizeof(u8). +/// Must not be less than width * sizeof(u8), except for +/// single-row images. /// @param src_uv Pointer to the input's interleaved UV components. /// Must be non-null. If the width parameter is odd, the /// width of this input stream still needs to be even. /// @param src_uv_stride Distance in bytes from the start of one row to the /// start of the next row for the input's UV components. /// Must not be less than -/// __builtin_align_up(width, 2) * sizeof(u8). +/// __builtin_align_up(width, 2) * sizeof(u8), except for +/// single-row images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. Must -/// not be less than width * 4 * sizeof(type). +/// not be less than width * 4 * sizeof(type), except for +/// single-row images. /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// @param is_nv21 If true, input is treated as NV21, otherwise treated @@ -663,18 +692,21 @@ KLEIDICV_API_DECLARATION(kleidicv_yuv_sp_to_rgba_u8, const uint8_t *src_y, /// @param src_y Pointer to the input's Y component. Must be non-null. /// @param src_y_stride Distance in bytes from the start of one row to the /// start of the next row for the input's Y component. -/// Must not be less than width * sizeof(u8). +/// Must not be less than width * sizeof(u8), except for +/// single-row images. /// @param src_uv Pointer to the input's interleaved UV components. /// Must be non-null. If the width parameter is odd, the /// width of this input stream still needs to be even. /// @param src_uv_stride Distance in bytes from the start of one row to the /// start of the next row for the input's UV components. /// Must not be less than -/// __builtin_align_up(width, 2) * sizeof(u8). +/// __builtin_align_up(width, 2) * sizeof(u8), except for +/// single-row images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. Must -/// not be less than width * 4 * sizeof(type). +/// not be less than width * 4 * sizeof(type), except for +/// single-row images. /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// @param is_nv21 If true, input is treated as NV21, otherwise treated @@ -705,11 +737,12 @@ KLEIDICV_API_DECLARATION(kleidicv_yuv_sp_to_bgra_u8, const uint8_t *src_y, /// @param src_stride Distance in bytes from the start of one row to the /// start of the next row for the source data. /// Must not be less than width * (number of channels) * -/// sizeof(uint8). +/// sizeof(uint8), except for single-row images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must not be less than width * 3 * sizeof(uint8). +/// Must not be less than 3*width, except for single-row +/// images. /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// @@ -739,13 +772,13 @@ KLEIDICV_API_DECLARATION(kleidicv_rgba_to_yuv_u8, const uint8_t *src, /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the /// start of the next row for the source data. Must -/// not be less than width * sizeof(type). -/// Must be a multiple of sizeof(type). +/// not be less than width * sizeof(type), except for +/// single-row images. /// @param dst Pointer to the first destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. Must -/// not be less than width * sizeof(type). -/// Must be a multiple of sizeof(type). +/// not be less than width * sizeof(type), except for +/// single-row images. /// @param width Number of elements in a row. /// @param height Number of rows in the data. /// @param threshold The value that the elements of the source data are @@ -769,13 +802,13 @@ KLEIDICV_API_DECLARATION(kleidicv_threshold_binary_u8, const uint8_t *src, /// @param src_a Pointer to the first source data. Must be non-null. /// @param src_a_stride Distance in bytes from the start of one row to the /// start of the next row for the first source data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param src_b Pointer to the second source data. Must be non-null. /// @param src_b_stride Distance in bytes from the start of one row to the /// start of the next row for the second source data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param dst Pointer to the first destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. Must @@ -801,18 +834,18 @@ KLEIDICV_API_DECLARATION(kleidicv_compare_equal_u8, const uint8_t *src_a, /// @param src_a Pointer to the first source data. Must be non-null. /// @param src_a_stride Distance in bytes from the start of one row to the /// start of the next row for the first source data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param src_b Pointer to the second source data. Must be non-null. /// @param src_b_stride Distance in bytes from the start of one row to the /// start of the next row for the second source data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param dst Pointer to the first destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the -/// start of the next row for the destination data. Must -/// not be less than width * sizeof(type). -/// Must be a multiple of sizeof(type). +/// start of the next row for the destination data. +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param width Number of elements in a row. /// @param height Number of rows in the data. /// @@ -892,11 +925,13 @@ kleidicv_error_t kleidicv_morphology_release( /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the /// start of the next row for the source data. -/// Must not be less than width * channels * sizeof(uint8). +/// Must not be less than width * channels * sizeof(uint8), +/// except for single-row images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. Must -/// not be less than width * channels * sizeof(uint8). +/// not be less than width * channels * sizeof(uint8), +/// except for single-row images. /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// @param context Pointer to morphology context. @@ -919,8 +954,8 @@ KLEIDICV_API_DECLARATION(kleidicv_erode_u8, const uint8_t *src, /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the /// start of the next row for the source data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param width Number of elements in a row. /// @param height Number of rows in the data. /// @param count Pointer to variable to store result. Must be non-null. @@ -954,15 +989,15 @@ KLEIDICV_API_DECLARATION(kleidicv_count_nonzeros_u8, const uint8_t *src, /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the /// start of the next row for the source data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param src_width Number of elements in the source row. /// @param src_height Number of rows in the source data. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param dst_width Number of elements in the destination row. /// Must be src_width / 2 for even src_width. /// For odd src_width it must be either src_width / 2 @@ -988,15 +1023,15 @@ KLEIDICV_API_DECLARATION(kleidicv_resize_to_quarter_u8, const uint8_t *src, /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the /// start of the next row for the source data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param src_width Number of elements in the source row. /// @param src_height Number of rows in the source data. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must be a multiple of sizeof(type). -/// Must not be less than width * sizeof(type). +/// Must be a multiple of sizeof(type) and no less than +/// width * sizeof(type), except for single-row images. /// @param dst_width Number of elements in the destination row. /// Must be src_width * 2. /// @param dst_height Number of rows in the destination data. @@ -1031,14 +1066,16 @@ KLEIDICV_API_DECLARATION(kleidicv_resize_linear_f32, const float *src, /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the -/// start of the next row in the source data. Must not be -/// less than width * sizeof(src type) * channels. -/// Must be a multiple of sizeof(src type). +/// start of the next row in the source data. Must be a +/// multiple of sizeof(src type) and no less than width * +/// sizeof(src type) * channels, except for single-row +/// images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the -/// start of the next row in the destination data. Must not -/// be less than width * sizeof(dst type) * channels. -/// Must be a multiple of sizeof(dst type). +/// start of the next row in the destination data. Must be a +/// multiple of sizeof(dst type) and no less than width * +/// sizeof(dst type) * channels, except for single-row +/// images. /// @param width Number of pixels in the data. (One pixel consists of /// 'channels' number of elements.) /// @param height Number of rows in the data. @@ -1067,14 +1104,16 @@ KLEIDICV_API_DECLARATION(kleidicv_sobel_3x3_vertical_s16_u8, const uint8_t *src, /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the -/// start of the next row in the source data. Must not be -/// less than width * sizeof(src type) * channels. -/// Must be a multiple of sizeof(src type). +/// start of the next row in the source data. Must be a +/// multiple of sizeof(src type) and no less than width * +/// sizeof(src type) * channels, except for single-row +/// images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the -/// start of the next row in the destination data. Must not -/// be less than width * sizeof(dst type) * channels. -/// Must be a multiple of sizeof(dst type). +/// start of the next row in the destination data. Must be a +/// multiple of sizeof(dst type) and no less than width * +/// sizeof(dst type) * channels, except for single-row +/// images. /// @param width Number of pixels in the data. (One pixel consists of /// 'channels' number of elements.) /// @param height Number of rows in the data. @@ -1104,11 +1143,11 @@ KLEIDICV_API_DECLARATION(kleidicv_sobel_3x3_horizontal_s16_u8, /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the /// start of the next row in the source data. Must not be -/// less than width. +/// less than width, except for single-row images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row in the destination data. Must -/// not be less than width. +/// not be less than width, except for single-row images. /// @param width Number of elements in a row. /// @param height Number of rows in the data. /// @param low_threshold Low threshold for the edge detector algorithm. @@ -1193,14 +1232,14 @@ kleidicv_error_t kleidicv_filter_release(kleidicv_filter_context_t *context); /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the -/// start of the next row in the source data. Must not be -/// less than width * sizeof(type) * channels. -/// Must be a multiple of sizeof(type). +/// start of the next row in the source data. Must be a +/// multiple of sizeof(type) and no less than width * +/// sizeof(type) * channels, except for single-row images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the -/// start of the next row in the destination data. Must not -/// be less than width * sizeof(type) * channels. -/// Must be a multiple of sizeof(type). +/// start of the next row in the destination data. Must be a +/// multiple of sizeof(type) and no less than width * +/// sizeof(type) * channels, except for single-row images. /// @param width Number of columns in the data. (One column consists of /// 'channels' number of elements.) /// @param height Number of rows in the data. @@ -1238,9 +1277,9 @@ KLEIDICV_API_DECLARATION(kleidicv_gaussian_blur_7x7_u8, const uint8_t *src, /// @param src_data Pointer to the source data. Must be non-null. /// Must be aligned to element_size. /// @param src_stride Distance in bytes from the start of one row to the -/// start of the next row in the source data. Must not be -/// less than width * element_size * channels. -/// Must be a multiple of element_size. +/// start of the next row in the source data. Must be a +/// multiple of element_size and no less than width * +/// element_size * channels, except for single-row images. /// @param dst_data A C style array of pointers to the destination data. /// Number of pointers in the array must be the same as the /// channel number. All pointers must be non-null. @@ -1251,7 +1290,8 @@ KLEIDICV_API_DECLARATION(kleidicv_gaussian_blur_7x7_u8, const uint8_t *src, /// next row in the given destination stream. Number of /// stride values in the array must be the same as the /// channel number. All stride values must be a multiple of -/// element_size and not be less than width * element_size. +/// element_size and no less than width * element_size, +/// except for single-row images. /// @param width Number of pixels in one row of the source data. (One /// pixel consists of 'channels' number of elements.) /// @param height Number of rows in the source data. @@ -1282,15 +1322,15 @@ KLEIDICV_API_DECLARATION(kleidicv_split, const void *src_data, /// Must be aligned to element_size. /// @param src_stride Distance in bytes from the start of one row to the /// start of the next row for the source data. -/// Must be a multiple of element_size. -/// Must not be less than width * element_size. +/// Must be a multiple of element_size and no less than +/// width * element_size, except for single-row images. /// @param dst Pointer to the destination data. Must be non-null. /// Can be the same as source data for inplace operation. /// Must be aligned to element_size. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must be a multiple of element_size. -/// Must not be less than height * element_size. +/// Must be a multiple of element_size and no less than +/// height * element_size, except for single-column images. /// @param src_width Number of elements in a row. /// @param src_height Number of rows in the data. /// @param element_size Size of one element in bytes. Must be 1, 2, 4 or 8. @@ -1313,13 +1353,14 @@ KLEIDICV_API_DECLARATION(kleidicv_transpose, const void *src, size_t src_stride, /// next row in the given source stream. Number of /// stride values in the array must be the same as the /// channel number. All stride values must be a multiple of -/// element_size and not be less than width * element_size. +/// element_size and no less than width * element_size, +/// except for single-row images. /// @param dst Pointer to the destination data. Must be non-null. /// Must be aligned to element_size. /// @param dst_stride Distance in bytes from the start of one row to the -/// start of the next row in the destination data. Must not -/// be less than width * element_size * channels. -/// Must be a multiple of element_size. +/// start of the next row in the destination data. Must be a +/// multiple of element_size and no less than width * +/// element_size * channels, except for single-row images. /// @param width Number of elements in a row for the source streams, /// number of pixels in a row for the destination data. /// @param height Number of rows in the data. @@ -1337,9 +1378,9 @@ KLEIDICV_API_DECLARATION(kleidicv_merge, const void **srcs, /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the -/// start of the next row in the source data. Must not be -/// less than width * sizeof(type). -/// Must be a multiple of sizeof(type). +/// start of the next row in the source data. Must be a +/// multiple of sizeof(type) and no less than width * +/// sizeof(type), except for single-row images. /// @param width Number of elements in a row. Must be greater than 0. /// @param height Number of rows in the data. Must be greater than 0. /// @param min_value Pointer to save result minimum value to, or nullptr if @@ -1378,9 +1419,9 @@ KLEIDICV_API_DECLARATION(kleidicv_min_max_f32, const float *src, /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the -/// start of the next row in the source data. Must not be -/// less than width * sizeof(type). -/// Must be a multiple of sizeof(type). +/// start of the next row in the source data. Must be a +/// multiple of sizeof(type) and no less than width * +/// sizeof(type), except for single-row images. /// @param width Number of elements in a row. Must be greater than 0. /// @param height Number of rows in the data. Must be greater than 0. /// @param min_offset Pointer to save result offset of minimum value to, or @@ -1404,11 +1445,13 @@ KLEIDICV_API_DECLARATION(kleidicv_min_max_loc_u8, const uint8_t *src, /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the /// start of the next row for the source data. -/// Must not be less than width * sizeof(type). +/// Must not be less than width * sizeof(type), except for +/// single-row images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the /// start of the next row for the destination data. -/// Must not be less than width * sizeof(type). +/// Must not be less than width * sizeof(type), except for +/// single-row images. /// @param width Number of elements in a row. /// @param height Number of rows in the data. /// @param scale Value to multiply the input by. @@ -1429,14 +1472,14 @@ KLEIDICV_API_DECLARATION(kleidicv_scale_u8, const uint8_t *src, /// /// @param src Pointer to the source data. Must be non-null. /// @param src_stride Distance in bytes from the start of one row to the -/// start of the next row for the source data. Must -/// not be less than width * sizeof(type). -/// Must be a multiple of sizeof(type). +/// start of the next row for the source data. Must be a +/// multiple of sizeof(type) and no less than width * +/// sizeof(type), except for single-row images. /// @param dst Pointer to the destination data. Must be non-null. /// @param dst_stride Distance in bytes from the start of one row to the -/// start of the next row for the destination data. Must -/// not be less than width * sizeof(type). -/// Must be a multiple of sizeof(type). +/// start of the next row for the destination data. Must be +/// a multiple of sizeof(type) and no less than width * +/// sizeof(type), except for single-row images. /// @param width Number of pixels in a row. /// @param height Number of rows in the data. /// diff --git a/kleidicv/include/kleidicv/utils.h b/kleidicv/include/kleidicv/utils.h index 48d93d4ce..e012ca04e 100644 --- a/kleidicv/include/kleidicv/utils.h +++ b/kleidicv/include/kleidicv/utils.h @@ -367,11 +367,11 @@ T *align_up(T *value, size_t alignment) KLEIDICV_STREAMING_COMPATIBLE { // Specialisation for when stride misalignment is possible. template std::enable_if_t check_pointer_and_stride( - T *pointer, size_t stride) KLEIDICV_STREAMING_COMPATIBLE { + T *pointer, size_t stride, size_t height) KLEIDICV_STREAMING_COMPATIBLE { if (pointer == nullptr) { return KLEIDICV_ERROR_NULL_POINTER; } - if (is_misaligned(stride)) { + if (height > 1 && is_misaligned(stride)) { return KLEIDICV_ERROR_ALIGNMENT; } return KLEIDICV_OK; @@ -380,20 +380,21 @@ std::enable_if_t check_pointer_and_stride( // Specialisation for when stride misalignment is impossible. template std::enable_if_t check_pointer_and_stride( - T *pointer, size_t /*stride*/) KLEIDICV_STREAMING_COMPATIBLE { + T *pointer, size_t /*stride*/, + size_t /*height*/) KLEIDICV_STREAMING_COMPATIBLE { if (pointer == nullptr) { return KLEIDICV_ERROR_NULL_POINTER; } return KLEIDICV_OK; } -#define CHECK_POINTER_AND_STRIDE(pointer, stride) \ - do { \ - if (kleidicv_error_t ptr_stride_err = \ - KLEIDICV_TARGET_NAMESPACE::check_pointer_and_stride(pointer, \ - stride)) { \ - return ptr_stride_err; \ - } \ +#define CHECK_POINTER_AND_STRIDE(pointer, stride, height) \ + do { \ + if (kleidicv_error_t ptr_stride_err = \ + KLEIDICV_TARGET_NAMESPACE::check_pointer_and_stride( \ + pointer, stride, height)) { \ + return ptr_stride_err; \ + } \ } while (false) #define MAKE_POINTER_CHECK_ALIGNMENT(ElementType, name, from) \ diff --git a/kleidicv/src/analysis/canny_neon.cpp b/kleidicv/src/analysis/canny_neon.cpp index fe59c5ec5..ece4c3821 100644 --- a/kleidicv/src/analysis/canny_neon.cpp +++ b/kleidicv/src/analysis/canny_neon.cpp @@ -475,8 +475,8 @@ static void perform_hysteresis(StrongEdgeStack &strong_edge_pixels, KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t canny_u8( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, double low_threshold, double high_threshold) { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle dst_rect{width, height}; diff --git a/kleidicv/src/analysis/count_nonzeros_neon.cpp b/kleidicv/src/analysis/count_nonzeros_neon.cpp index f3eb3fc3c..2a8fe2959 100644 --- a/kleidicv/src/analysis/count_nonzeros_neon.cpp +++ b/kleidicv/src/analysis/count_nonzeros_neon.cpp @@ -45,7 +45,7 @@ KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t count_nonzeros( const T *src, size_t src_stride, size_t width, size_t height, size_t *count) { CHECK_POINTERS(count); - CHECK_POINTER_AND_STRIDE(src, src_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; diff --git a/kleidicv/src/analysis/min_max_loc_neon.cpp b/kleidicv/src/analysis/min_max_loc_neon.cpp index b44f5ddde..0bf04fe25 100644 --- a/kleidicv/src/analysis/min_max_loc_neon.cpp +++ b/kleidicv/src/analysis/min_max_loc_neon.cpp @@ -310,7 +310,7 @@ template kleidicv_error_t min_max_loc(const ScalarType *src, size_t src_stride, size_t width, size_t height, size_t *min_offset, size_t *max_offset) { - CHECK_POINTER_AND_STRIDE(src, src_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); CHECK_IMAGE_SIZE(width, height); if (KLEIDICV_UNLIKELY(width == 0 || height == 0)) { diff --git a/kleidicv/src/analysis/min_max_neon.cpp b/kleidicv/src/analysis/min_max_neon.cpp index 28bf0508b..084f1a2de 100644 --- a/kleidicv/src/analysis/min_max_neon.cpp +++ b/kleidicv/src/analysis/min_max_neon.cpp @@ -48,7 +48,7 @@ template kleidicv_error_t min_max(const ScalarType *src, size_t src_stride, size_t width, size_t height, ScalarType *min_value, ScalarType *max_value) { - CHECK_POINTER_AND_STRIDE(src, src_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); CHECK_IMAGE_SIZE(width, height); if (KLEIDICV_UNLIKELY(width == 0 || height == 0)) { diff --git a/kleidicv/src/analysis/min_max_sc.h b/kleidicv/src/analysis/min_max_sc.h index a01ce6089..05e913155 100644 --- a/kleidicv/src/analysis/min_max_sc.h +++ b/kleidicv/src/analysis/min_max_sc.h @@ -45,7 +45,7 @@ template kleidicv_error_t min_max_sc(const ScalarType *src, size_t src_stride, size_t width, size_t height, ScalarType *min_value, ScalarType *max_value) { - CHECK_POINTER_AND_STRIDE(src, src_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); CHECK_IMAGE_SIZE(width, height); if (KLEIDICV_UNLIKELY(width == 0 || height == 0)) { diff --git a/kleidicv/src/arithmetics/absdiff_neon.cpp b/kleidicv/src/arithmetics/absdiff_neon.cpp index 4ebbdbde6..7f11a6c82 100644 --- a/kleidicv/src/arithmetics/absdiff_neon.cpp +++ b/kleidicv/src/arithmetics/absdiff_neon.cpp @@ -40,9 +40,9 @@ kleidicv_error_t saturating_absdiff(const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); - CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src_a, src_a_stride, height); + CHECK_POINTER_AND_STRIDE(src_b, src_b_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); SaturatingAbsDiff operation; diff --git a/kleidicv/src/arithmetics/absdiff_sme2.cpp b/kleidicv/src/arithmetics/absdiff_sme2.cpp index bc254f2a7..9bf7c2184 100644 --- a/kleidicv/src/arithmetics/absdiff_sme2.cpp +++ b/kleidicv/src/arithmetics/absdiff_sme2.cpp @@ -40,9 +40,9 @@ template KLEIDICV_LOCALLY_STREAMING kleidicv_error_t saturating_absdiff( const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); - CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src_a, src_a_stride, height); + CHECK_POINTER_AND_STRIDE(src_b, src_b_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); SaturatingAbsDiff operation; diff --git a/kleidicv/src/arithmetics/absdiff_sve2.cpp b/kleidicv/src/arithmetics/absdiff_sve2.cpp index 9ede9ed35..21e0eac79 100644 --- a/kleidicv/src/arithmetics/absdiff_sve2.cpp +++ b/kleidicv/src/arithmetics/absdiff_sve2.cpp @@ -38,9 +38,9 @@ kleidicv_error_t saturating_absdiff(const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); - CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src_a, src_a_stride, height); + CHECK_POINTER_AND_STRIDE(src_b, src_b_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); SaturatingAbsDiff operation; diff --git a/kleidicv/src/arithmetics/add_abs_with_threshold_neon.cpp b/kleidicv/src/arithmetics/add_abs_with_threshold_neon.cpp index 85440ad39..c8c944ea5 100644 --- a/kleidicv/src/arithmetics/add_abs_with_threshold_neon.cpp +++ b/kleidicv/src/arithmetics/add_abs_with_threshold_neon.cpp @@ -52,9 +52,9 @@ template kleidicv_error_t saturating_add_abs_with_threshold( const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height, T threshold) { - CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); - CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src_a, src_a_stride, height); + CHECK_POINTER_AND_STRIDE(src_b, src_b_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); SaturatingAddAbsWithThreshold operation{threshold}; diff --git a/kleidicv/src/arithmetics/add_abs_with_threshold_sc.h b/kleidicv/src/arithmetics/add_abs_with_threshold_sc.h index 2ea1735bd..3b8075b68 100644 --- a/kleidicv/src/arithmetics/add_abs_with_threshold_sc.h +++ b/kleidicv/src/arithmetics/add_abs_with_threshold_sc.h @@ -39,9 +39,9 @@ kleidicv_error_t saturating_add_abs_with_threshold_sc( const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height, T threshold) KLEIDICV_STREAMING_COMPATIBLE { - CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); - CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src_a, src_a_stride, height); + CHECK_POINTER_AND_STRIDE(src_b, src_b_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); SaturatingAddAbsWithThreshold operation{threshold}; diff --git a/kleidicv/src/arithmetics/add_neon.cpp b/kleidicv/src/arithmetics/add_neon.cpp index 21dd18b35..50921be63 100644 --- a/kleidicv/src/arithmetics/add_neon.cpp +++ b/kleidicv/src/arithmetics/add_neon.cpp @@ -39,9 +39,9 @@ kleidicv_error_t saturating_add(const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); - CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src_a, src_a_stride, height); + CHECK_POINTER_AND_STRIDE(src_b, src_b_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); SaturatingAdd operation; diff --git a/kleidicv/src/arithmetics/add_sme2.cpp b/kleidicv/src/arithmetics/add_sme2.cpp index 99fdd6b69..7f21ffa7d 100644 --- a/kleidicv/src/arithmetics/add_sme2.cpp +++ b/kleidicv/src/arithmetics/add_sme2.cpp @@ -26,9 +26,9 @@ template KLEIDICV_LOCALLY_STREAMING kleidicv_error_t saturating_add( const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); - CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src_a, src_a_stride, height); + CHECK_POINTER_AND_STRIDE(src_b, src_b_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); SaturatingAdd operation; diff --git a/kleidicv/src/arithmetics/add_sve2.cpp b/kleidicv/src/arithmetics/add_sve2.cpp index c6b95b6d8..670237eb6 100644 --- a/kleidicv/src/arithmetics/add_sve2.cpp +++ b/kleidicv/src/arithmetics/add_sve2.cpp @@ -26,9 +26,9 @@ kleidicv_error_t saturating_add(const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); - CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src_a, src_a_stride, height); + CHECK_POINTER_AND_STRIDE(src_b, src_b_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); SaturatingAdd operation; diff --git a/kleidicv/src/arithmetics/compare_neon.cpp b/kleidicv/src/arithmetics/compare_neon.cpp index 183b0d5c4..6d97ba912 100644 --- a/kleidicv/src/arithmetics/compare_neon.cpp +++ b/kleidicv/src/arithmetics/compare_neon.cpp @@ -46,9 +46,9 @@ static kleidicv_error_t compare(const ScalarType *src_a, size_t src_a_stride, const ScalarType *src_b, size_t src_b_stride, ScalarType *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); - CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src_a, src_a_stride, height); + CHECK_POINTER_AND_STRIDE(src_b, src_b_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Comparator operation{}; diff --git a/kleidicv/src/arithmetics/compare_sc.h b/kleidicv/src/arithmetics/compare_sc.h index 493999652..fa45d9dfa 100644 --- a/kleidicv/src/arithmetics/compare_sc.h +++ b/kleidicv/src/arithmetics/compare_sc.h @@ -47,9 +47,9 @@ kleidicv_error_t compare_sc(const ScalarType *src_a, size_t src_a_stride, const ScalarType *src_b, size_t src_b_stride, ScalarType *dst, size_t dst_stride, size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { - CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); - CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src_a, src_a_stride, height); + CHECK_POINTER_AND_STRIDE(src_b, src_b_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Comparator operation{}; diff --git a/kleidicv/src/arithmetics/exp_neon.cpp b/kleidicv/src/arithmetics/exp_neon.cpp index 541424793..23fe62339 100644 --- a/kleidicv/src/arithmetics/exp_neon.cpp +++ b/kleidicv/src/arithmetics/exp_neon.cpp @@ -79,8 +79,8 @@ class Exp final : public UnrollOnce { template kleidicv_error_t exp(const T* src, size_t src_stride, T* dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Exp operation; diff --git a/kleidicv/src/arithmetics/multiply_neon.cpp b/kleidicv/src/arithmetics/multiply_neon.cpp index 0b660dbc3..7488ea54e 100644 --- a/kleidicv/src/arithmetics/multiply_neon.cpp +++ b/kleidicv/src/arithmetics/multiply_neon.cpp @@ -67,9 +67,9 @@ kleidicv_error_t saturating_multiply(const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height, double scale) { - CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); - CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src_a, src_a_stride, height); + CHECK_POINTER_AND_STRIDE(src_b, src_b_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); (void)scale; // TODO: figure out the way to process the scale. diff --git a/kleidicv/src/arithmetics/multiply_sve2.cpp b/kleidicv/src/arithmetics/multiply_sve2.cpp index fd26f2a7f..7edd481fb 100644 --- a/kleidicv/src/arithmetics/multiply_sve2.cpp +++ b/kleidicv/src/arithmetics/multiply_sve2.cpp @@ -45,9 +45,9 @@ kleidicv_error_t saturating_multiply(const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height, double scale) { - CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); - CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src_a, src_a_stride, height); + CHECK_POINTER_AND_STRIDE(src_b, src_b_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); (void)scale; // TODO: figure out the way to process the scale. diff --git a/kleidicv/src/arithmetics/scale_neon.cpp b/kleidicv/src/arithmetics/scale_neon.cpp index bad86de90..9c2995731 100644 --- a/kleidicv/src/arithmetics/scale_neon.cpp +++ b/kleidicv/src/arithmetics/scale_neon.cpp @@ -172,8 +172,8 @@ template kleidicv_error_t scale(const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, size_t height, float scale, float shift) { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; diff --git a/kleidicv/src/arithmetics/sub_neon.cpp b/kleidicv/src/arithmetics/sub_neon.cpp index cb162dd9a..4193a74e1 100644 --- a/kleidicv/src/arithmetics/sub_neon.cpp +++ b/kleidicv/src/arithmetics/sub_neon.cpp @@ -39,9 +39,9 @@ kleidicv_error_t saturating_sub(const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); - CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src_a, src_a_stride, height); + CHECK_POINTER_AND_STRIDE(src_b, src_b_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); SaturatingSub operation; diff --git a/kleidicv/src/arithmetics/sub_sme2.cpp b/kleidicv/src/arithmetics/sub_sme2.cpp index 6817e9552..1fe21043d 100644 --- a/kleidicv/src/arithmetics/sub_sme2.cpp +++ b/kleidicv/src/arithmetics/sub_sme2.cpp @@ -26,9 +26,9 @@ template KLEIDICV_LOCALLY_STREAMING kleidicv_error_t saturating_sub( const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); - CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src_a, src_a_stride, height); + CHECK_POINTER_AND_STRIDE(src_b, src_b_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); SaturatingSub operation; diff --git a/kleidicv/src/arithmetics/sub_sve2.cpp b/kleidicv/src/arithmetics/sub_sve2.cpp index 822cbc83a..43bdb97e3 100644 --- a/kleidicv/src/arithmetics/sub_sve2.cpp +++ b/kleidicv/src/arithmetics/sub_sve2.cpp @@ -26,9 +26,9 @@ kleidicv_error_t saturating_sub(const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); - CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src_a, src_a_stride, height); + CHECK_POINTER_AND_STRIDE(src_b, src_b_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); SaturatingSub operation; diff --git a/kleidicv/src/arithmetics/threshold_neon.cpp b/kleidicv/src/arithmetics/threshold_neon.cpp index 1f0618400..dd352fb6d 100644 --- a/kleidicv/src/arithmetics/threshold_neon.cpp +++ b/kleidicv/src/arithmetics/threshold_neon.cpp @@ -41,8 +41,8 @@ template kleidicv_error_t threshold_binary(const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, size_t height, T threshold, T value) { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; diff --git a/kleidicv/src/arithmetics/threshold_sc.h b/kleidicv/src/arithmetics/threshold_sc.h index b0a330999..2868b9b27 100644 --- a/kleidicv/src/arithmetics/threshold_sc.h +++ b/kleidicv/src/arithmetics/threshold_sc.h @@ -38,8 +38,8 @@ kleidicv_error_t threshold_binary_sc(const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, size_t height, T threshold, T value) KLEIDICV_STREAMING_COMPATIBLE { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; diff --git a/kleidicv/src/arithmetics/transpose_neon.cpp b/kleidicv/src/arithmetics/transpose_neon.cpp index 0909c91ca..a42abf9a3 100644 --- a/kleidicv/src/arithmetics/transpose_neon.cpp +++ b/kleidicv/src/arithmetics/transpose_neon.cpp @@ -199,8 +199,8 @@ static kleidicv_error_t transpose(const void *src_void, size_t src_stride, size_t src_width, size_t src_height) { MAKE_POINTER_CHECK_ALIGNMENT(const T, src, src_void); MAKE_POINTER_CHECK_ALIGNMENT(T, dst, dst_void); - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, src_height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, src_width); CHECK_IMAGE_SIZE(src_width, src_height); Rectangle rect{src_width, src_height}; diff --git a/kleidicv/src/conversions/gray_to_rgb_neon.cpp b/kleidicv/src/conversions/gray_to_rgb_neon.cpp index b8705c8da..6b0d15256 100644 --- a/kleidicv/src/conversions/gray_to_rgb_neon.cpp +++ b/kleidicv/src/conversions/gray_to_rgb_neon.cpp @@ -108,8 +108,8 @@ KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t gray_to_rgb_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; @@ -124,8 +124,8 @@ KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t gray_to_rgba_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; diff --git a/kleidicv/src/conversions/gray_to_rgb_sc.h b/kleidicv/src/conversions/gray_to_rgb_sc.h index 2844bee85..a0a1c7c24 100644 --- a/kleidicv/src/conversions/gray_to_rgb_sc.h +++ b/kleidicv/src/conversions/gray_to_rgb_sc.h @@ -204,8 +204,8 @@ class GrayToRGBAWithLookUpTable final : public UnrollTwice, KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t gray_to_rgb_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; @@ -224,8 +224,8 @@ KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t gray_to_rgb_u8_sc( KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t gray_to_rgba_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; diff --git a/kleidicv/src/conversions/merge_neon.cpp b/kleidicv/src/conversions/merge_neon.cpp index 24536c42f..5b7bc0157 100644 --- a/kleidicv/src/conversions/merge_neon.cpp +++ b/kleidicv/src/conversions/merge_neon.cpp @@ -374,9 +374,9 @@ kleidicv_error_t merge(const void **srcs, const size_t *src_strides, MAKE_POINTER_CHECK_ALIGNMENT(const ScalarType, src0, srcs[0]); MAKE_POINTER_CHECK_ALIGNMENT(const ScalarType, src1, srcs[1]); MAKE_POINTER_CHECK_ALIGNMENT(ScalarType, dst, dst_void); - CHECK_POINTER_AND_STRIDE(src0, src_strides[0]); - CHECK_POINTER_AND_STRIDE(src1, src_strides[1]); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src0, src_strides[0], height); + CHECK_POINTER_AND_STRIDE(src1, src_strides[1], height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; @@ -393,7 +393,7 @@ kleidicv_error_t merge(const void **srcs, const size_t *src_strides, case 3: { MAKE_POINTER_CHECK_ALIGNMENT(const ScalarType, src2, srcs[2]); - CHECK_POINTER_AND_STRIDE(src2, src_strides[2]); + CHECK_POINTER_AND_STRIDE(src2, src_strides[2], height); Merge3 operation; Rows src_c_rows{src2, src_strides[2]}; apply_operation_by_rows(operation, rect, src_a_rows, src_b_rows, @@ -403,8 +403,8 @@ kleidicv_error_t merge(const void **srcs, const size_t *src_strides, case 4: { MAKE_POINTER_CHECK_ALIGNMENT(const ScalarType, src2, srcs[2]); MAKE_POINTER_CHECK_ALIGNMENT(const ScalarType, src3, srcs[3]); - CHECK_POINTER_AND_STRIDE(src2, src_strides[2]); - CHECK_POINTER_AND_STRIDE(src3, src_strides[3]); + CHECK_POINTER_AND_STRIDE(src2, src_strides[2], height); + CHECK_POINTER_AND_STRIDE(src3, src_strides[3], height); Merge4 operation; Rows src_c_rows{src2, src_strides[2]}; Rows src_d_rows{src3, src_strides[3]}; diff --git a/kleidicv/src/conversions/rgb_to_rgb_api.cpp b/kleidicv/src/conversions/rgb_to_rgb_api.cpp index 47e81b990..8d13939ce 100644 --- a/kleidicv/src/conversions/rgb_to_rgb_api.cpp +++ b/kleidicv/src/conversions/rgb_to_rgb_api.cpp @@ -29,8 +29,8 @@ using KLEIDICV_TARGET_NAMESPACE::Rows; static kleidicv_error_t kleidicv_rgb_to_rgb_u8_impl( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; @@ -46,8 +46,8 @@ decltype(kleidicv_rgb_to_rgb_u8_impl) *kleidicv_rgb_to_rgb_u8 = static kleidicv_error_t kleidicv_rgba_to_rgba_u8_impl( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; diff --git a/kleidicv/src/conversions/rgb_to_rgb_neon.cpp b/kleidicv/src/conversions/rgb_to_rgb_neon.cpp index fe19051ec..001fe94a7 100644 --- a/kleidicv/src/conversions/rgb_to_rgb_neon.cpp +++ b/kleidicv/src/conversions/rgb_to_rgb_neon.cpp @@ -191,8 +191,8 @@ KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t rgb_to_bgr_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; @@ -207,8 +207,8 @@ KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t rgba_to_bgra_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; @@ -222,8 +222,8 @@ kleidicv_error_t rgba_to_bgra_u8(const uint8_t *src, size_t src_stride, KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t rgb_to_bgra_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; @@ -237,8 +237,8 @@ rgb_to_bgra_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t rgb_to_rgba_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; @@ -253,8 +253,8 @@ KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t rgba_to_bgr_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; @@ -269,8 +269,8 @@ KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t rgba_to_rgb_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; diff --git a/kleidicv/src/conversions/rgb_to_rgb_sc.h b/kleidicv/src/conversions/rgb_to_rgb_sc.h index bab6c91fb..8ec8cda39 100644 --- a/kleidicv/src/conversions/rgb_to_rgb_sc.h +++ b/kleidicv/src/conversions/rgb_to_rgb_sc.h @@ -186,8 +186,8 @@ class RGBAToRGB final : public UnrollTwice { KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t rgb_to_bgr_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; @@ -207,8 +207,8 @@ KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t rgba_to_bgra_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; @@ -223,8 +223,8 @@ KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t rgb_to_bgra_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; @@ -239,8 +239,8 @@ KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t rgb_to_rgba_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; @@ -255,8 +255,8 @@ KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t rgba_to_bgr_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; @@ -271,8 +271,8 @@ KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t rgba_to_rgb_u8_sc( const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; diff --git a/kleidicv/src/conversions/rgb_to_yuv_neon.cpp b/kleidicv/src/conversions/rgb_to_yuv_neon.cpp index 0b0dd6430..c8b89502a 100644 --- a/kleidicv/src/conversions/rgb_to_yuv_neon.cpp +++ b/kleidicv/src/conversions/rgb_to_yuv_neon.cpp @@ -159,8 +159,8 @@ kleidicv_error_t rgb2yuv_operation(OperationType &operation, const ScalarType *src, size_t src_stride, ScalarType *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; diff --git a/kleidicv/src/conversions/split_neon.cpp b/kleidicv/src/conversions/split_neon.cpp index 4cddd0473..6d53c6316 100644 --- a/kleidicv/src/conversions/split_neon.cpp +++ b/kleidicv/src/conversions/split_neon.cpp @@ -260,9 +260,9 @@ kleidicv_error_t split(const void *src_void, const size_t src_stride, MAKE_POINTER_CHECK_ALIGNMENT(const ScalarType, src_data, src_void); MAKE_POINTER_CHECK_ALIGNMENT(ScalarType, dst0, dst_data[0]); MAKE_POINTER_CHECK_ALIGNMENT(ScalarType, dst1, dst_data[1]); - CHECK_POINTER_AND_STRIDE(src_data, src_stride); - CHECK_POINTER_AND_STRIDE(dst0, dst_strides[0]); - CHECK_POINTER_AND_STRIDE(dst1, dst_strides[1]); + CHECK_POINTER_AND_STRIDE(src_data, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst0, dst_strides[0], height); + CHECK_POINTER_AND_STRIDE(dst1, dst_strides[1], height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; @@ -277,7 +277,7 @@ kleidicv_error_t split(const void *src_void, const size_t src_stride, } break; case 3: { MAKE_POINTER_CHECK_ALIGNMENT(ScalarType, dst2, dst_data[2]); - CHECK_POINTER_AND_STRIDE(dst2, dst_strides[2]); + CHECK_POINTER_AND_STRIDE(dst2, dst_strides[2], height); Rows dst_rows2{dst2, dst_strides[2]}; Split3 operation; apply_operation_by_rows(operation, rect, src_rows, dst_rows0, dst_rows1, @@ -286,8 +286,8 @@ kleidicv_error_t split(const void *src_void, const size_t src_stride, case 4: { MAKE_POINTER_CHECK_ALIGNMENT(ScalarType, dst2, dst_data[2]); MAKE_POINTER_CHECK_ALIGNMENT(ScalarType, dst3, dst_data[3]); - CHECK_POINTER_AND_STRIDE(dst2, dst_strides[2]); - CHECK_POINTER_AND_STRIDE(dst3, dst_strides[3]); + CHECK_POINTER_AND_STRIDE(dst2, dst_strides[2], height); + CHECK_POINTER_AND_STRIDE(dst3, dst_strides[3], height); Rows dst_rows2{dst2, dst_strides[2]}; Rows dst_rows3{dst3, dst_strides[3]}; Split4 operation; diff --git a/kleidicv/src/conversions/yuv_to_rgb_neon.cpp b/kleidicv/src/conversions/yuv_to_rgb_neon.cpp index dfb1da3e4..cd1084d03 100644 --- a/kleidicv/src/conversions/yuv_to_rgb_neon.cpp +++ b/kleidicv/src/conversions/yuv_to_rgb_neon.cpp @@ -291,9 +291,9 @@ kleidicv_error_t yuv2rgbx_operation( OperationType &operation, const ScalarType *src_y, size_t src_y_stride, const ScalarType *src_uv, size_t src_uv_stride, ScalarType *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src_y, src_y_stride); - CHECK_POINTER_AND_STRIDE(src_uv, src_uv_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src_y, src_y_stride, height); + CHECK_POINTER_AND_STRIDE(src_uv, src_uv_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; diff --git a/kleidicv/src/conversions/yuv_to_rgb_sc.h b/kleidicv/src/conversions/yuv_to_rgb_sc.h index 71a0f8e19..0cbee3252 100644 --- a/kleidicv/src/conversions/yuv_to_rgb_sc.h +++ b/kleidicv/src/conversions/yuv_to_rgb_sc.h @@ -191,9 +191,9 @@ kleidicv_error_t yuv2rgbx_operation( const ScalarType *src_uv, size_t src_uv_stride, ScalarType *dst, size_t dst_stride, size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { - CHECK_POINTER_AND_STRIDE(src_y, src_y_stride); - CHECK_POINTER_AND_STRIDE(src_uv, src_uv_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src_y, src_y_stride, height); + CHECK_POINTER_AND_STRIDE(src_uv, src_uv_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); Rectangle rect{width, height}; diff --git a/kleidicv/src/filters/gaussian_blur_neon.cpp b/kleidicv/src/filters/gaussian_blur_neon.cpp index 33ce02f7f..fe451b42a 100644 --- a/kleidicv/src/filters/gaussian_blur_neon.cpp +++ b/kleidicv/src/filters/gaussian_blur_neon.cpp @@ -294,8 +294,8 @@ kleidicv_error_t discrete_gaussian_blur(const ScalarType *src, using GaussianBlurFilterType = DiscreteGaussianBlur; CHECK_POINTERS(context); - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); if (width < KernelSize - 1 || height < KernelSize - 1) { diff --git a/kleidicv/src/filters/gaussian_blur_sc.h b/kleidicv/src/filters/gaussian_blur_sc.h index 5f5127652..a01b03d2e 100644 --- a/kleidicv/src/filters/gaussian_blur_sc.h +++ b/kleidicv/src/filters/gaussian_blur_sc.h @@ -272,8 +272,8 @@ kleidicv_error_t discrete_gaussian_blur( using GaussianBlurFilterType = DiscreteGaussianBlur; CHECK_POINTERS(context); - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); if (width < KernelSize - 1 || height < KernelSize - 1) { diff --git a/kleidicv/src/filters/sobel_neon.cpp b/kleidicv/src/filters/sobel_neon.cpp index 869e34788..09e108575 100644 --- a/kleidicv/src/filters/sobel_neon.cpp +++ b/kleidicv/src/filters/sobel_neon.cpp @@ -132,8 +132,8 @@ kleidicv_error_t sobel_3x3_horizontal_s16_u8(const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels) { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); const size_t KernelSize = 3; @@ -168,8 +168,8 @@ kleidicv_error_t sobel_3x3_vertical_s16_u8(const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels) { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); const size_t KernelSize = 3; diff --git a/kleidicv/src/filters/sobel_sc.h b/kleidicv/src/filters/sobel_sc.h index 6da923694..783cd55ad 100644 --- a/kleidicv/src/filters/sobel_sc.h +++ b/kleidicv/src/filters/sobel_sc.h @@ -123,8 +123,8 @@ static kleidicv_error_t sobel_3x3_horizontal_s16_u8_sc( const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels) KLEIDICV_STREAMING_COMPATIBLE { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); const size_t KernelSize = 3; @@ -159,8 +159,8 @@ static kleidicv_error_t sobel_3x3_vertical_s16_u8_sc( const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels) KLEIDICV_STREAMING_COMPATIBLE { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); const size_t KernelSize = 3; diff --git a/kleidicv/src/logical/bitwise_and_neon.cpp b/kleidicv/src/logical/bitwise_and_neon.cpp index 39393cbc1..e6237b223 100644 --- a/kleidicv/src/logical/bitwise_and_neon.cpp +++ b/kleidicv/src/logical/bitwise_and_neon.cpp @@ -28,9 +28,9 @@ template kleidicv_error_t bitwise_and(const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height) { - CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); - CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src_a, src_a_stride, height); + CHECK_POINTER_AND_STRIDE(src_b, src_b_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); BitwiseAnd operation; diff --git a/kleidicv/src/logical/bitwise_and_sc.h b/kleidicv/src/logical/bitwise_and_sc.h index 85f9ed63d..86ccf588b 100644 --- a/kleidicv/src/logical/bitwise_and_sc.h +++ b/kleidicv/src/logical/bitwise_and_sc.h @@ -28,9 +28,9 @@ kleidicv_error_t bitwise_and_sc(const T *src_a, size_t src_a_stride, const T *src_b, size_t src_b_stride, T *dst, size_t dst_stride, size_t width, size_t height) KLEIDICV_STREAMING_COMPATIBLE { - CHECK_POINTER_AND_STRIDE(src_a, src_a_stride); - CHECK_POINTER_AND_STRIDE(src_b, src_b_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src_a, src_a_stride, height); + CHECK_POINTER_AND_STRIDE(src_b, src_b_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); BitwiseAnd operation; diff --git a/kleidicv/src/morphology/morphology_neon.cpp b/kleidicv/src/morphology/morphology_neon.cpp index 5b99b9221..687a9309d 100644 --- a/kleidicv/src/morphology/morphology_neon.cpp +++ b/kleidicv/src/morphology/morphology_neon.cpp @@ -492,8 +492,8 @@ kleidicv_error_t dilate(const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, size_t height, kleidicv_morphology_context_t *context) { CHECK_POINTERS(context); - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); auto *workspace = reinterpret_cast(context); @@ -563,8 +563,8 @@ kleidicv_error_t erode(const T *src, size_t src_stride, T *dst, size_t dst_stride, size_t width, size_t height, kleidicv_morphology_context_t *context) { CHECK_POINTERS(context); - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); auto *workspace = reinterpret_cast(context); diff --git a/kleidicv/src/morphology/morphology_sc.h b/kleidicv/src/morphology/morphology_sc.h index d6e6c8eb0..bce498bb2 100644 --- a/kleidicv/src/morphology/morphology_sc.h +++ b/kleidicv/src/morphology/morphology_sc.h @@ -477,8 +477,8 @@ static kleidicv_error_t dilate_sc( size_t height, kleidicv_morphology_context_t *context) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTERS(context); - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); auto *workspace = reinterpret_cast(context); @@ -550,8 +550,8 @@ static kleidicv_error_t erode_sc(const T *src, size_t src_stride, T *dst, kleidicv_morphology_context_t *context) KLEIDICV_STREAMING_COMPATIBLE { CHECK_POINTERS(context); - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); CHECK_IMAGE_SIZE(width, height); auto *workspace = reinterpret_cast(context); diff --git a/kleidicv/src/resize/resize_linear_neon.cpp b/kleidicv/src/resize/resize_linear_neon.cpp index cc48b4a36..246eb7446 100644 --- a/kleidicv/src/resize/resize_linear_neon.cpp +++ b/kleidicv/src/resize/resize_linear_neon.cpp @@ -413,8 +413,8 @@ kleidicv_error_t resize_linear_u8(const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride, size_t dst_width, size_t dst_height) { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, src_height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, dst_height); CHECK_IMAGE_SIZE(dst_width, dst_height); if (src_width == 0 || src_height == 0) { @@ -749,8 +749,8 @@ kleidicv_error_t resize_linear_f32(const float *src, size_t src_stride, size_t src_width, size_t src_height, float *dst, size_t dst_stride, size_t dst_width, size_t dst_height) { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, src_height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, dst_height); CHECK_IMAGE_SIZE(dst_width, dst_height); if (src_width == 0 || src_height == 0) { diff --git a/kleidicv/src/resize/resize_linear_sc.h b/kleidicv/src/resize/resize_linear_sc.h index b7de848e1..da30d2ec4 100644 --- a/kleidicv/src/resize/resize_linear_sc.h +++ b/kleidicv/src/resize/resize_linear_sc.h @@ -639,8 +639,8 @@ KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t resize_linear_u8_sc( const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride, size_t dst_width, size_t dst_height) KLEIDICV_STREAMING_COMPATIBLE { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, src_height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, dst_height); CHECK_IMAGE_SIZE(dst_width, dst_height); if (src_width == 0 || src_height == 0) { @@ -661,8 +661,8 @@ KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t resize_linear_f32_sc( const float *src, size_t src_stride, size_t src_width, size_t src_height, float *dst, size_t dst_stride, size_t dst_width, size_t dst_height) KLEIDICV_STREAMING_COMPATIBLE { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, src_height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, dst_height); CHECK_IMAGE_SIZE(dst_width, dst_height); if (src_width == 0 || src_height == 0) { diff --git a/kleidicv/src/resize/resize_neon.cpp b/kleidicv/src/resize/resize_neon.cpp index 208bdd664..b69380ad7 100644 --- a/kleidicv/src/resize/resize_neon.cpp +++ b/kleidicv/src/resize/resize_neon.cpp @@ -33,8 +33,8 @@ kleidicv_error_t resize_to_quarter_u8(const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride, size_t dst_width, size_t dst_height) { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, src_height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, dst_height); CHECK_IMAGE_SIZE(src_width, src_height); if (kleidicv_error_t ret = check_dimensions(src_width, dst_width)) { diff --git a/kleidicv/src/resize/resize_sc.h b/kleidicv/src/resize/resize_sc.h index fa5e1f6aa..43cf2174e 100644 --- a/kleidicv/src/resize/resize_sc.h +++ b/kleidicv/src/resize/resize_sc.h @@ -159,8 +159,8 @@ KLEIDICV_TARGET_FN_ATTRS static kleidicv_error_t resize_to_quarter_u8_sc( const uint8_t *src, size_t src_stride, size_t src_width, size_t src_height, uint8_t *dst, size_t dst_stride, size_t dst_width, size_t dst_height) KLEIDICV_STREAMING_COMPATIBLE { - CHECK_POINTER_AND_STRIDE(src, src_stride); - CHECK_POINTER_AND_STRIDE(dst, dst_stride); + CHECK_POINTER_AND_STRIDE(src, src_stride, src_height); + CHECK_POINTER_AND_STRIDE(dst, dst_stride, dst_height); CHECK_IMAGE_SIZE(src_width, src_height); if (kleidicv_error_t ret = check_dimensions(src_width, dst_width)) { diff --git a/test/api/test_add_abs_with_threshold.cpp b/test/api/test_add_abs_with_threshold.cpp index 9aaaa43db..bbabfb1cc 100644 --- a/test/api/test_add_abs_with_threshold.cpp +++ b/test/api/test_add_abs_with_threshold.cpp @@ -188,19 +188,19 @@ TYPED_TEST(SaturatingAddAbsWithThresholdTest, Misalignment) { // misalignment impossible return; } - TypeParam src[1] = {}, dst[1] = {}; + TypeParam src[2] = {}, dst[2] = {}; EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, kleidicv_saturating_add_abs_with_threshold_s16( src, sizeof(TypeParam) + 1, src, sizeof(TypeParam), dst, - sizeof(TypeParam), 1, 1, 1)); + sizeof(TypeParam), 1, 2, 1)); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, kleidicv_saturating_add_abs_with_threshold_s16( src, sizeof(TypeParam), src, sizeof(TypeParam) + 1, dst, - sizeof(TypeParam), 1, 1, 1)); + sizeof(TypeParam), 1, 2, 1)); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, kleidicv_saturating_add_abs_with_threshold_s16( src, sizeof(TypeParam), src, sizeof(TypeParam), dst, - sizeof(TypeParam) + 1, 1, 1, 1)); + sizeof(TypeParam) + 1, 1, 2, 1)); } TYPED_TEST(SaturatingAddAbsWithThresholdTest, ZeroImageSize) { diff --git a/test/api/test_bitwise_and.cpp b/test/api/test_bitwise_and.cpp index 2cd70685b..459c83a4c 100644 --- a/test/api/test_bitwise_and.cpp +++ b/test/api/test_bitwise_and.cpp @@ -74,19 +74,19 @@ TYPED_TEST(BitwiseAnd, Misalignment) { // misalignment impossible return; } - TypeParam src[1] = {}, dst[1]; + TypeParam src[2] = {}, dst[2]; EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, bitwise_and()(src, sizeof(TypeParam) + 1, src, sizeof(TypeParam), dst, sizeof(TypeParam), - 1, 1)); + 1, 2)); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, bitwise_and()(src, sizeof(TypeParam), src, sizeof(TypeParam) + 1, dst, - sizeof(TypeParam), 1, 1)); + sizeof(TypeParam), 1, 2)); EXPECT_EQ( KLEIDICV_ERROR_ALIGNMENT, bitwise_and()(src, sizeof(TypeParam), src, sizeof(TypeParam), - dst, sizeof(TypeParam) + 1, 1, 1)); + dst, sizeof(TypeParam) + 1, 1, 2)); } TYPED_TEST(BitwiseAnd, ZeroImageSize) { diff --git a/test/api/test_canny.cpp b/test/api/test_canny.cpp index ed69818ae..06869cec3 100644 --- a/test/api/test_canny.cpp +++ b/test/api/test_canny.cpp @@ -33,13 +33,13 @@ TYPED_TEST(CannyTest, Misalignment) { // misalignment impossible return; } - TypeParam src[1], dst[1]; + TypeParam src[2], dst[2]; EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, canny()(src, sizeof(TypeParam) + 1, dst, - sizeof(TypeParam), 1, 1, 0.0, 1.0)); + sizeof(TypeParam), 1, 2, 0.0, 1.0)); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, canny()(src, sizeof(TypeParam), dst, - sizeof(TypeParam) + 1, 1, 1, 0.0, 1.0)); + sizeof(TypeParam) + 1, 1, 2, 0.0, 1.0)); } TYPED_TEST(CannyTest, ZeroImageSize) { diff --git a/test/api/test_compare.cpp b/test/api/test_compare.cpp index 3db2fddf8..5c0642d53 100644 --- a/test/api/test_compare.cpp +++ b/test/api/test_compare.cpp @@ -357,15 +357,15 @@ TYPED_TEST(Compare, EqualMisalignment) { // misalignment impossible return; } - TypeParam src_a[1] = {}, src_b[1] = {}, dst[1]; + TypeParam src_a[2] = {}, src_b[2] = {}, dst[1]; EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, (CompareEqualParams::api()(src_a, sizeof(TypeParam) + 1, src_b, sizeof(TypeParam), dst, - sizeof(TypeParam), 1, 1))); + sizeof(TypeParam), 1, 2))); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, (CompareEqualParams::api()( src_a, sizeof(TypeParam), src_b, sizeof(TypeParam), dst, - sizeof(TypeParam) + 1, 1, 1))); + sizeof(TypeParam) + 1, 1, 2))); } TYPED_TEST(Compare, GreaterMisalignment) { @@ -373,15 +373,15 @@ TYPED_TEST(Compare, GreaterMisalignment) { // misalignment impossible return; } - TypeParam src_a[1] = {}, src_b[1] = {}, dst[1]; + TypeParam src_a[2] = {}, src_b[2] = {}, dst[2]; EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, (CompareGreaterParams::api()( src_a, sizeof(TypeParam) + 1, src_b, sizeof(TypeParam), dst, - sizeof(TypeParam), 1, 1))); + sizeof(TypeParam), 1, 2))); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, (CompareGreaterParams::api()( src_a, sizeof(TypeParam), src_b, sizeof(TypeParam), dst, - sizeof(TypeParam) + 1, 1, 1))); + sizeof(TypeParam) + 1, 1, 2))); } TYPED_TEST(Compare, EqualZeroImageSize) { diff --git a/test/api/test_count_nonzeros.cpp b/test/api/test_count_nonzeros.cpp index 07ccfde34..0dd110475 100644 --- a/test/api/test_count_nonzeros.cpp +++ b/test/api/test_count_nonzeros.cpp @@ -125,11 +125,11 @@ TYPED_TEST(CountNonZeros, Misalignment) { // misalignment impossible return; } - TypeParam src[1]; + TypeParam src[2]; size_t count = 0; EXPECT_EQ( KLEIDICV_ERROR_ALIGNMENT, - count_nonzeros()(src, sizeof(TypeParam) + 1, 1, 1, &count)); + count_nonzeros()(src, sizeof(TypeParam) + 1, 1, 2, &count)); } TYPED_TEST(CountNonZeros, ZeroImageSize) { diff --git a/test/api/test_merge.cpp b/test/api/test_merge.cpp index 48d83d0cb..1b4172e49 100644 --- a/test/api/test_merge.cpp +++ b/test/api/test_merge.cpp @@ -251,7 +251,7 @@ TYPED_TEST(Merge, Misalignment) { const size_t kChannels = 4; // A size comfortably large enough to hold the data, taking into account the // various offsets that this test will make. - const size_t kBufSize = kChannels * sizeof(TypeParam) * 2; + const size_t kBufSize = kChannels * sizeof(TypeParam) * 4; alignas(TypeParam) char src_arrays[kBufSize] = {}; alignas(TypeParam) char dst[kBufSize] = {}; size_t src_strides[kChannels] = {}; @@ -270,7 +270,7 @@ TYPED_TEST(Merge, Misalignment) { EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, kleidicv_merge(reinterpret_cast(srcs), src_strides, dst_maybe_misaligned, dst_stride_maybe_misaligned, - 1, 1, channels, sizeof(TypeParam))); + 1, 2, channels, sizeof(TypeParam))); }; for (size_t channels = 2; channels <= kChannels; ++channels) { diff --git a/test/api/test_min_max.cpp b/test/api/test_min_max.cpp index 3101099de..95bf95fc2 100644 --- a/test/api/test_min_max.cpp +++ b/test/api/test_min_max.cpp @@ -309,9 +309,9 @@ TYPED_TEST(MinMax, Misalignment) { // misalignment impossible return; } - TypeParam src[1] = {}, min_value, max_value; + TypeParam src[2] = {}, min_value, max_value; EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, - min_max()(src, sizeof(TypeParam) + 1, 1, 1, &min_value, + min_max()(src, sizeof(TypeParam) + 1, 1, 2, &min_value, &max_value)); } diff --git a/test/api/test_morphology.cpp b/test/api/test_morphology.cpp index 46a6b8b3e..c8035abd8 100644 --- a/test/api/test_morphology.cpp +++ b/test/api/test_morphology.cpp @@ -572,14 +572,14 @@ TYPED_TEST(Morphology, DilateMisalignment) { } kleidicv_morphology_context_t *context = nullptr; ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam))); - TypeParam src[1] = {}, dst[1]; + TypeParam src[2] = {}, dst[2]; EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, DilateParams::api()(src, sizeof(TypeParam) + 1, dst, - sizeof(TypeParam), 1, 1, context)); + sizeof(TypeParam), 1, 2, context)); EXPECT_EQ( KLEIDICV_ERROR_ALIGNMENT, DilateParams::api()(src, sizeof(TypeParam), dst, - sizeof(TypeParam) + 1, 1, 1, context)); + sizeof(TypeParam) + 1, 1, 2, context)); EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); } @@ -590,14 +590,14 @@ TYPED_TEST(Morphology, ErodeMisalignment) { } kleidicv_morphology_context_t *context = nullptr; ASSERT_EQ(KLEIDICV_OK, make_minimal_context(&context, sizeof(TypeParam))); - TypeParam src[1] = {}, dst[1]; + TypeParam src[2] = {}, dst[2]; EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, ErodeParams::api()(src, sizeof(TypeParam) + 1, dst, - sizeof(TypeParam), 1, 1, context)); + sizeof(TypeParam), 1, 2, context)); EXPECT_EQ( KLEIDICV_ERROR_ALIGNMENT, ErodeParams::api()(src, sizeof(TypeParam), dst, - sizeof(TypeParam) + 1, 1, 1, context)); + sizeof(TypeParam) + 1, 1, 2, context)); EXPECT_EQ(KLEIDICV_OK, kleidicv_morphology_release(context)); } diff --git a/test/api/test_saturating_absdiff.cpp b/test/api/test_saturating_absdiff.cpp index 5d9d80134..61bc576f1 100644 --- a/test/api/test_saturating_absdiff.cpp +++ b/test/api/test_saturating_absdiff.cpp @@ -108,19 +108,19 @@ TYPED_TEST(SaturatingAbsDiff, Misalignment) { // misalignment impossible return; } - TypeParam src[1] = {}, dst[1]; + TypeParam src[2] = {}, dst[2]; EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_absdiff()(src, sizeof(TypeParam) + 1, src, sizeof(TypeParam), dst, - sizeof(TypeParam), 1, 1)); + sizeof(TypeParam), 1, 2)); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_absdiff()(src, sizeof(TypeParam), src, sizeof(TypeParam) + 1, dst, - sizeof(TypeParam), 1, 1)); + sizeof(TypeParam), 1, 2)); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_absdiff()(src, sizeof(TypeParam), src, sizeof(TypeParam), dst, - sizeof(TypeParam) + 1, 1, 1)); + sizeof(TypeParam) + 1, 1, 2)); } TYPED_TEST(SaturatingAbsDiff, ZeroImageSize) { diff --git a/test/api/test_saturating_add.cpp b/test/api/test_saturating_add.cpp index 99e48f031..f39b52b12 100644 --- a/test/api/test_saturating_add.cpp +++ b/test/api/test_saturating_add.cpp @@ -113,19 +113,19 @@ TYPED_TEST(SaturatingAdd, Misalignment) { // misalignment impossible return; } - TypeParam src[1] = {}, dst[1]; + TypeParam src[2] = {}, dst[2]; EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_add()(src, sizeof(TypeParam) + 1, src, sizeof(TypeParam), dst, - sizeof(TypeParam), 1, 1)); + sizeof(TypeParam), 1, 2)); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_add()(src, sizeof(TypeParam), src, sizeof(TypeParam) + 1, dst, - sizeof(TypeParam), 1, 1)); + sizeof(TypeParam), 1, 2)); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_add()(src, sizeof(TypeParam), src, sizeof(TypeParam), dst, - sizeof(TypeParam) + 1, 1, 1)); + sizeof(TypeParam) + 1, 1, 2)); } TYPED_TEST(SaturatingAdd, ZeroImageSize) { diff --git a/test/api/test_saturating_multiply.cpp b/test/api/test_saturating_multiply.cpp index 552af28f2..c16111c10 100644 --- a/test/api/test_saturating_multiply.cpp +++ b/test/api/test_saturating_multiply.cpp @@ -108,19 +108,19 @@ TYPED_TEST(SaturatingMultiply, Misalignment) { // misalignment impossible return; } - TypeParam src[1] = {}, dst[1]; + TypeParam src[2] = {}, dst[2]; EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_multiply()(src, sizeof(TypeParam) + 1, src, sizeof(TypeParam), dst, - sizeof(TypeParam), 1, 1, 1)); + sizeof(TypeParam), 1, 2, 1)); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_multiply()(src, sizeof(TypeParam), src, sizeof(TypeParam) + 1, dst, - sizeof(TypeParam), 1, 1, 1)); + sizeof(TypeParam), 1, 2, 1)); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_multiply()(src, sizeof(TypeParam), src, sizeof(TypeParam), dst, - sizeof(TypeParam) + 1, 1, 1, 1)); + sizeof(TypeParam) + 1, 1, 2, 1)); } TYPED_TEST(SaturatingMultiply, ZeroImageSize) { diff --git a/test/api/test_saturating_sub.cpp b/test/api/test_saturating_sub.cpp index d07ba0f43..09cd36550 100644 --- a/test/api/test_saturating_sub.cpp +++ b/test/api/test_saturating_sub.cpp @@ -115,19 +115,19 @@ TYPED_TEST(SaturatingSub, Misalignment) { // misalignment impossible return; } - TypeParam src[1] = {}, dst[1]; + TypeParam src[2] = {}, dst[2]; EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_sub()(src, sizeof(TypeParam) + 1, src, sizeof(TypeParam), dst, - sizeof(TypeParam), 1, 1)); + sizeof(TypeParam), 1, 2)); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_sub()(src, sizeof(TypeParam), src, sizeof(TypeParam) + 1, dst, - sizeof(TypeParam), 1, 1)); + sizeof(TypeParam), 1, 2)); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, saturating_sub()(src, sizeof(TypeParam), src, sizeof(TypeParam), dst, - sizeof(TypeParam) + 1, 1, 1)); + sizeof(TypeParam) + 1, 1, 2)); } TYPED_TEST(SaturatingSub, ZeroImageSize) { diff --git a/test/api/test_scale.cpp b/test/api/test_scale.cpp index ab9974722..3c7232e3a 100644 --- a/test/api/test_scale.cpp +++ b/test/api/test_scale.cpp @@ -415,13 +415,13 @@ TYPED_TEST(ScaleTest, Misalignment) { // misalignment impossible return; } - TypeParam src[1] = {}, dst[1]; + TypeParam src[2] = {}, dst[2]; EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, scale()(src, sizeof(TypeParam) + 1, dst, - sizeof(TypeParam), 1, 1, 2, 0)); + sizeof(TypeParam), 1, 2, 2, 0)); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, scale()(src, sizeof(TypeParam), dst, - sizeof(TypeParam) + 1, 1, 1, 2, 0)); + sizeof(TypeParam) + 1, 1, 2, 2, 0)); } TYPED_TEST(ScaleTest, ZeroImageSize) { diff --git a/test/api/test_sobel.cpp b/test/api/test_sobel.cpp index 664b84941..69d14be47 100644 --- a/test/api/test_sobel.cpp +++ b/test/api/test_sobel.cpp @@ -120,33 +120,33 @@ TYPED_TEST(Sobel, Vertical3x3) { TYPED_TEST(Sobel, MisalignmentHorizontal) { using KernelTestParams = SobelKernelTestParams; - typename KernelTestParams::InputType src[1] = {}; - typename KernelTestParams::OutputType dst[1]; + typename KernelTestParams::InputType src[2] = {}; + typename KernelTestParams::OutputType dst[2]; if (sizeof(typename KernelTestParams::InputType) != 1) { EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, sobel_3x3_horizontal()(src, sizeof(src) + 1, dst, - sizeof(dst), 1, 1, 1)); + sizeof(dst), 1, 2, 1)); } if (sizeof(typename KernelTestParams::OutputType) != 1) { EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, sobel_3x3_horizontal()(src, sizeof(src), dst, - sizeof(dst) + 1, 1, 1, 1)); + sizeof(dst) + 1, 1, 2, 1)); } } TYPED_TEST(Sobel, MisalignmentVertical) { using KernelTestParams = SobelKernelTestParams; - typename KernelTestParams::InputType src[1] = {}; - typename KernelTestParams::OutputType dst[1]; + typename KernelTestParams::InputType src[2] = {}; + typename KernelTestParams::OutputType dst[2]; if (sizeof(typename KernelTestParams::InputType) != 1) { EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, sobel_3x3_vertical()(src, sizeof(src) + 1, dst, - sizeof(dst), 1, 1, 1)); + sizeof(dst), 1, 2, 1)); } if (sizeof(typename KernelTestParams::OutputType) != 1) { EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, sobel_3x3_vertical()(src, sizeof(src), dst, - sizeof(dst) + 1, 1, 1, 1)); + sizeof(dst) + 1, 1, 2, 1)); } } diff --git a/test/api/test_split.cpp b/test/api/test_split.cpp index fcdcda622..36c572a7f 100644 --- a/test/api/test_split.cpp +++ b/test/api/test_split.cpp @@ -240,7 +240,7 @@ TYPED_TEST(Split, Misalignment) { const size_t kChannels = 4; // A size comfortably large enough to hold the data, taking into account the // various offsets that this test will make. - const size_t kBufSize = kChannels * sizeof(TypeParam) * 2; + const size_t kBufSize = kChannels * sizeof(TypeParam) * 4; alignas(TypeParam) char src_data[kBufSize]; size_t src_stride = kChannels * sizeof(TypeParam); alignas(TypeParam) char dst_arrays[kBufSize]; @@ -259,7 +259,7 @@ TYPED_TEST(Split, Misalignment) { EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, kleidicv_split(src_maybe_misaligned, src_stride_maybe_misaligned, reinterpret_cast(dst_data), dst_strides, 1, - 1, channels, sizeof(TypeParam))); + 2, channels, sizeof(TypeParam))); }; for (size_t channels = 2; channels <= kChannels; ++channels) { diff --git a/test/api/test_transpose.cpp b/test/api/test_transpose.cpp index 45230e713..4b6426670 100644 --- a/test/api/test_transpose.cpp +++ b/test/api/test_transpose.cpp @@ -214,11 +214,15 @@ TYPED_TEST(Transpose, Misalignment) { sizeof(TypeParam), 1, 1, sizeof(TypeParam))); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, kleidicv_transpose(src, sizeof(TypeParam) + 1, dst, - sizeof(TypeParam), 1, 1, sizeof(TypeParam))); + sizeof(TypeParam), 1, 2, sizeof(TypeParam))); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, kleidicv_transpose(src, sizeof(TypeParam), dst + 1, sizeof(TypeParam), 1, 1, sizeof(TypeParam))); EXPECT_EQ(KLEIDICV_ERROR_ALIGNMENT, + kleidicv_transpose(src, sizeof(TypeParam), dst, + sizeof(TypeParam) + 1, 2, 1, sizeof(TypeParam))); + // Ignore stride if there's only one row + EXPECT_EQ(KLEIDICV_OK, kleidicv_transpose(src, sizeof(TypeParam), dst, sizeof(TypeParam) + 1, 1, 1, sizeof(TypeParam))); } -- GitLab