diff --git a/kleidicv/include/kleidicv/kleidicv.h b/kleidicv/include/kleidicv/kleidicv.h index c04dfb170ac73f8f2f576b8720e6aaf57177dda5..88dfdc6bd2e6ee91d96a29e6bf1948464e45010d 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 48d93d4ce248083075b42e13682ed736b0c7b953..e012ca04e49262c380e77ba3ffb5faf8f017d736 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 fe59c5ec5bb9f26c7b3dd2479165b99b1f992dad..ece4c3821e4cdebb297525e31bce9ab40ef82df5 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 f3eb3fc3cbf3a1552f37d821d711153e120b28f7..2a8fe2959ec11a97fe6f7f917adcbcec5c7e2860 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 b44f5dddec54af1f6ceeedddde740f79b6fe91d3..0bf04fe25f5b19258918fe7a7ded7a144b57d203 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 28bf0508b165463ad90b8f3d92cdf97254097a59..084f1a2ded8ce67db596c6a1b74e1eec41ed747e 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 a01ce608966e4c4f94030a3b319686749e6028c3..05e91315509b535bcc577b9d47d144e6cc8669ab 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 4ebbdbde6322c498ad5b8fb3eda5f94014e9792e..7f11a6c82cf3c5e0ae07fc75db582d10f814a1f7 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 bc254f2a7e3a9b498422c002629495abe978e76d..9bf7c21848a42acd75e65c54f75242ed8895ba62 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 9ede9ed35835d0981dd3195e0edac3c9f84e992a..21e0eac79eb356594fbb182e2f082df45aa2256b 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 85440ad39e0cf7fdf4083d9b75fa5fda806e24ba..c8c944ea5df6413d92c4e8b00544f71f6c9248c8 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 2ea1735bde4cd84348d9fec7cea45dca8fa66012..3b8075b68f7d37fac45b24493c156b874c195a70 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 21dd18b352db4ad4ad8fe203cb11c2f33a0defd8..50921be63e96cc166e3188b96fe73dad68a4c166 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 99fdd6b6921083f82174ee7ea7f2eba74afc7cd6..7f21ffa7d240f7bfdcd1771a4ca66fdd565ab2ee 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 c6b95b6d8d998dffb5130e4dd41b2b749e184d91..670237eb65cc31a08faceec302ae810d91af5837 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 183b0d5c4d669b62a91f79e1dff80c4318dc4a68..6d97ba912ddbf832efbb5eb55983b308de55ae96 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 49399965251c4df9ab14239bbb665f651d9bd231..fa45d9dfa02e0b45283c70e0d645c87cf55853de 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 5414247934e4de4318206d607aaef104c0048e74..23fe62339e8d1e4127e11902f2911fecdb6026f5 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 0b660dbc3134dae622b99f9d72dc7761735b197f..7488ea54ea71c6f0d9e2435f6bd5f3e1a69a5e1d 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 fd26f2a7fc3f3a4279a57cca0aff7c35d7877ee9..7edd481fb3a4cd74f4d8dddcfaf963e3a481a227 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 bad86de90f3e451f3c1924fcbef20f519f9df061..9c29957314a860cad99ff4a03a148db56fce133b 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 cb162dd9ac38ef048dd2cc5ffa249fa55b970322..4193a74e15496bf29684ca9621b546c9307ff87d 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 6817e9552d270d829bfdf31e9a6f98364a8de078..1fe21043dfe9d49ae02f3c7f0944aa2c7ab36e68 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 822cbc83a1b23bbfd0b19e1d98dd6ab0486e7562..43bdb97e39d8fbcaa54140b6508f6f59e322a234 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 1f0618400dd63063a40bb52281138f519ca10746..dd352fb6ddb60a40e381f161fd562dab2b09cf67 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 b0a330999f6ffadf8343bcfe9fbb48228f70666f..2868b9b2751c69b4d5509d660910cc2d2b0adf19 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 0909c91caaf4aafeea74ba9f7c70b2edc6e68339..a42abf9a34117e22d8dec81c680d06bc94eb2253 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 b8705c8dae67e1926aea640b8be0ed4f3a10c60d..6b0d152564991e7107aec959ade4d6c956e27afd 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 2844bee85115d12c4b650aaab4cf4771fba49588..a0a1c7c242d2717710b1bdbaf4c9ac229971855d 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 24536c42f0dd564da246fc4b9a0fd17c373e7056..5b7bc0157763ba67e2ea72c4bb348645ee913920 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 47e81b99068cd88677d2a0ff86b3e00677a66863..8d13939ce33c110cea79fae90e5de60241a64eed 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 fe19051ec566ef307b37b37216a6a7a7f8c83b73..001fe94a7ef691ee3105bece7f9d5286d4dfe674 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 bab6c91fbf50ce895630f0e5060d409e4be00b2c..8ec8cda393564ea153e85f97e4748f70a0c48c22 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 0b0dd6430b43b4702d7a6ec1048e0cf6507b7c48..c8b89502a1856cf74455a0acc804c25f166841f5 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 4cddd0473209ba82f0a31c0496ad5a7dfdb09233..6d53c6316d4e1cf17cf5c4588ef94c9a70afe8cf 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 dfb1da3e489a9bc5880b97d488979f5d1284a5d8..cd1084d03c76813f29ec2572faecd9c059fd1756 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 71a0f8e19b88cf624a83087e6851a12f829e5119..0cbee3252ebd089738bac45298513aa22fe24495 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 33ce02f7fe0a16e65691069e980b34f1b1bdbba4..fe451b42ae8f5d5cf6c9fd70e0a5a1c2658e2410 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 5f5127652fde0b72ef0521cdc574200aa322b87f..a01b03d2ef82c91ee11e6f0141c2b09cf5b05921 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 869e3478812e2f031ddfff2a7c9f2e05be3de526..09e108575d9fde81a0ba189f3cf06097399fcbc0 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 6da9236942a90db0694db3273bcb164fab045fdc..783cd55ad4adf7153dbd4d4ded63df01fd7b28fa 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 39393cbc1da1c976aee1e33e55491a793e56a388..e6237b223d905fe14ac5cffb4ecc5881ca54ff73 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 85f9ed63da815cf1b35ad8c051354762c34c87a7..86ccf588bfdd04e148d3158abf8b86c2ebce58ac 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 5b99b92218806d8d7a9254c0a172b871295aa98e..687a9309de71506dce509436465f014d750e2f8d 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 d6e6c8eb0d80cb0e012a160545417ecd3b67ac34..bce498bb23a3226de4d2fe781bdc056a3069cf7e 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 cc48b4a365bd35cf212102743c819097242f5710..246eb7446b9fb03f4fda7dbc43cc3f3add3d3fa5 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 b7de848e137f6e531e47171ec131b201cdb96440..da30d2ec4cbfa68717adb5719af5591e48a0173f 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 208bdd664f6c6d52d689625982296a3e7107f91f..b69380ad7900d8c7b1cb49b285c58195fcb2b257 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 fa5e1f6aade5647f005379ea1a6daee5bf69e942..43cf2174e1426664b4a88d017c9c989ee21fc360 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 9aaaa43db55da5ba006cf8991f75a6089762beb1..bbabfb1ccb47cd7bd9501b9ea4954f4918072566 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 2cd70685b5b4907d5da532bbf5562d4d8fac1554..459c83a4ced682bb8e1f68a91b31069e4c397051 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 ed69818aeaf4aaf67be372fca3f47bb8c0f600e8..06869cec37b3efeb8437ab1aff2a3c901d6fdc5a 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 3db2fddf8cc1040f3fcb8f29b4264c53246f9534..5c0642d5349ebd802afc52a7523200833b675aba 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 07ccfde34c9e20be35b2ff4005346cbd3aec7f31..0dd110475a0665aa4c5639b89eb9f6613fc28768 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 48d83d0cbb215b187ea3017847139b134d522034..1b4172e49f1171c721ad3fcc8435194861c3c185 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 3101099de2604b0457f6e99566adf10fc53fbfd5..95bf95fc2fc9f77565cfbc4c5d78ba7c98947acc 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 46a6b8b3e4a20c19549754ef50bfdab00d8c7fce..c8035abd84341005c1cbe913271d46d2ba0c00b8 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 5d9d80134b73db829064daac5da10c657f72087b..61bc576f1bb328f4efa906d7219e28d0742eb88a 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 99e48f0317e8e18bf28bc5b9789e7331ee5c36ae..f39b52b12d8e352a728d68a922de2a726b1e2239 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 552af28f2df927d708c8ba49e93178225dbc410e..c16111c104455a4da77d42d17c163e59f0f088e5 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 d07ba0f43666f085bd2ba7b5623cca61dd29e987..09cd365508c9326c197cc7f6900575ccdbb05ab4 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 ab9974722b8cfc9f20eace65e01fa7c67abdc954..3c7232e3a4733fd18877d2acd1812b688ee5ac5e 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 664b84941671068b6effce02fe0e623b71dbce45..69d14be47da1b6ef237d309a8331b4be38bb9c14 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 fcdcda622908c342e2d33d8446e62e98cdb59ec9..36c572a7ff8789456c355233ecb0aba295dcf362 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 45230e713431eeaf33e0d8f647b6a4599adce51d..4b6426670e44fafbb0b37b0ee4ded31379d6ed2c 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))); }