KleidiCV
Loading...
Searching...
No Matches
Macros | Functions
kleidicv.h File Reference

For an overview of the functions and their supported types see functionality. More...

Include dependency graph for kleidicv.h:

Macros

#define KLEIDICV_MAX_IMAGE_PIXELS   ((1ULL << 48) - 1)
 
#define KLEIDICV_MAXIMUM_TYPE_SIZE   (8)
 Size in bytes of the largest possible element type.
 
#define KLEIDICV_MAXIMUM_CHANNEL_COUNT   (4)
 Maximum number of channels.
 

Functions

kleidicv_error_t kleidicv_saturating_add_s8 (const int8_t *src_a, size_t src_a_stride, const int8_t *src_b, size_t src_b_stride, int8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_add_u8 (const uint8_t *src_a, size_t src_a_stride, const uint8_t *src_b, size_t src_b_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_add_s16 (const int16_t *src_a, size_t src_a_stride, const int16_t *src_b, size_t src_b_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_add_u16 (const uint16_t *src_a, size_t src_a_stride, const uint16_t *src_b, size_t src_b_stride, uint16_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_add_s32 (const int32_t *src_a, size_t src_a_stride, const int32_t *src_b, size_t src_b_stride, int32_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_add_u32 (const uint32_t *src_a, size_t src_a_stride, const uint32_t *src_b, size_t src_b_stride, uint32_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_add_s64 (const int64_t *src_a, size_t src_a_stride, const int64_t *src_b, size_t src_b_stride, int64_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_add_u64 (const uint64_t *src_a, size_t src_a_stride, const uint64_t *src_b, size_t src_b_stride, uint64_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_sub_s8 (const int8_t *src_a, size_t src_a_stride, const int8_t *src_b, size_t src_b_stride, int8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_sub_u8 (const uint8_t *src_a, size_t src_a_stride, const uint8_t *src_b, size_t src_b_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_sub_s16 (const int16_t *src_a, size_t src_a_stride, const int16_t *src_b, size_t src_b_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_sub_u16 (const uint16_t *src_a, size_t src_a_stride, const uint16_t *src_b, size_t src_b_stride, uint16_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_sub_s32 (const int32_t *src_a, size_t src_a_stride, const int32_t *src_b, size_t src_b_stride, int32_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_sub_u32 (const uint32_t *src_a, size_t src_a_stride, const uint32_t *src_b, size_t src_b_stride, uint32_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_sub_s64 (const int64_t *src_a, size_t src_a_stride, const int64_t *src_b, size_t src_b_stride, int64_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_sub_u64 (const uint64_t *src_a, size_t src_a_stride, const uint64_t *src_b, size_t src_b_stride, uint64_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_absdiff_u8 (const uint8_t *src_a, size_t src_a_stride, const uint8_t *src_b, size_t src_b_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_absdiff_s8 (const int8_t *src_a, size_t src_a_stride, const int8_t *src_b, size_t src_b_stride, int8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_absdiff_u16 (const uint16_t *src_a, size_t src_a_stride, const uint16_t *src_b, size_t src_b_stride, uint16_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_absdiff_s16 (const int16_t *src_a, size_t src_a_stride, const int16_t *src_b, size_t src_b_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_absdiff_s32 (const int32_t *src_a, size_t src_a_stride, const int32_t *src_b, size_t src_b_stride, int32_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_saturating_multiply_u8 (const uint8_t *src_a, size_t src_a_stride, const uint8_t *src_b, size_t src_b_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, double scale)
 
kleidicv_error_t kleidicv_saturating_multiply_s8 (const int8_t *src_a, size_t src_a_stride, const int8_t *src_b, size_t src_b_stride, int8_t *dst, size_t dst_stride, size_t width, size_t height, double scale)
 
kleidicv_error_t kleidicv_saturating_multiply_u16 (const uint16_t *src_a, size_t src_a_stride, const uint16_t *src_b, size_t src_b_stride, uint16_t *dst, size_t dst_stride, size_t width, size_t height, double scale)
 
kleidicv_error_t kleidicv_saturating_multiply_s16 (const int16_t *src_a, size_t src_a_stride, const int16_t *src_b, size_t src_b_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, double scale)
 
kleidicv_error_t kleidicv_saturating_multiply_s32 (const int32_t *src_a, size_t src_a_stride, const int32_t *src_b, size_t src_b_stride, int32_t *dst, size_t dst_stride, size_t width, size_t height, double scale)
 
kleidicv_error_t kleidicv_saturating_add_abs_with_threshold_s16 (const int16_t *src_a, size_t src_a_stride, const int16_t *src_b, size_t src_b_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, int16_t threshold)
 
kleidicv_error_t kleidicv_bitwise_and (const uint8_t *src_a, size_t src_a_stride, const uint8_t *src_b, size_t src_b_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_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)
 
kleidicv_error_t kleidicv_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)
 
kleidicv_error_t kleidicv_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)
 
kleidicv_error_t kleidicv_rgb_to_rgb_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_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)
 
kleidicv_error_t kleidicv_rgba_to_rgba_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_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)
 
kleidicv_error_t kleidicv_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)
 
kleidicv_error_t kleidicv_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)
 
kleidicv_error_t kleidicv_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)
 
kleidicv_error_t kleidicv_yuv_sp_to_rgb_u8 (const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21)
 
kleidicv_error_t kleidicv_yuv_sp_to_bgr_u8 (const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21)
 
kleidicv_error_t kleidicv_yuv_sp_to_rgba_u8 (const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21)
 
kleidicv_error_t kleidicv_yuv_sp_to_bgra_u8 (const uint8_t *src_y, size_t src_y_stride, const uint8_t *src_uv, size_t src_uv_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_nv21)
 
kleidicv_error_t kleidicv_yuv_p_to_rgb_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_yv12)
 
kleidicv_error_t kleidicv_yuv_p_to_rgba_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_yv12)
 
kleidicv_error_t kleidicv_yuv_p_to_bgr_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_yv12)
 
kleidicv_error_t kleidicv_yuv_p_to_bgra_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_yv12)
 
kleidicv_error_t kleidicv_yuv_to_bgr_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_yuv_to_rgb_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_yuv_to_rgba_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_yuv_to_bgra_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_bgr_to_yuv_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_rgb_to_yuv_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_bgra_to_yuv_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_rgba_to_yuv_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_rgb_to_yuv420_p_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_yv12)
 
kleidicv_error_t kleidicv_rgba_to_yuv420_p_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_yv12)
 
kleidicv_error_t kleidicv_bgr_to_yuv420_p_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_yv12)
 
kleidicv_error_t kleidicv_bgra_to_yuv420_p_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, bool is_yv12)
 
kleidicv_error_t kleidicv_rgb_to_yuv420_sp_u8 (const uint8_t *src, size_t src_stride, uint8_t *y_dst, size_t y_stride, uint8_t *uv_dst, size_t uv_stride, size_t width, size_t height, bool is_nv21)
 
kleidicv_error_t kleidicv_rgba_to_yuv420_sp_u8 (const uint8_t *src, size_t src_stride, uint8_t *y_dst, size_t y_stride, uint8_t *uv_dst, size_t uv_stride, size_t width, size_t height, bool is_nv21)
 
kleidicv_error_t kleidicv_bgr_to_yuv420_sp_u8 (const uint8_t *src, size_t src_stride, uint8_t *y_dst, size_t y_stride, uint8_t *uv_dst, size_t uv_stride, size_t width, size_t height, bool is_nv21)
 
kleidicv_error_t kleidicv_bgra_to_yuv420_sp_u8 (const uint8_t *src, size_t src_stride, uint8_t *y_dst, size_t y_stride, uint8_t *uv_dst, size_t uv_stride, size_t width, size_t height, bool is_nv21)
 
kleidicv_error_t kleidicv_threshold_binary_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, uint8_t threshold, uint8_t value)
 
kleidicv_error_t kleidicv_compare_equal_u8 (const uint8_t *src_a, size_t src_a_stride, const uint8_t *src_b, size_t src_b_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_compare_greater_u8 (const uint8_t *src_a, size_t src_a_stride, const uint8_t *src_b, size_t src_b_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_morphology_create (kleidicv_morphology_context_t **context, kleidicv_rectangle_t kernel, kleidicv_point_t anchor, kleidicv_border_type_t border_type, const uint8_t *border_value, size_t channels, size_t iterations, size_t type_size, kleidicv_rectangle_t image)
 
kleidicv_error_t kleidicv_morphology_release (kleidicv_morphology_context_t *context)
 
kleidicv_error_t kleidicv_dilate_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, kleidicv_morphology_context_t *context)
 
kleidicv_error_t kleidicv_erode_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, kleidicv_morphology_context_t *context)
 
kleidicv_error_t kleidicv_count_nonzeros_u8 (const uint8_t *src, size_t src_stride, size_t width, size_t height, size_t *count)
 
kleidicv_error_t kleidicv_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)
 
kleidicv_error_t kleidicv_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)
 
kleidicv_error_t kleidicv_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)
 
kleidicv_error_t kleidicv_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)
 
kleidicv_error_t kleidicv_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)
 
kleidicv_error_t kleidicv_filter_context_create (kleidicv_filter_context_t **context, size_t max_channels, size_t max_kernel_width, size_t max_kernel_height, size_t max_image_width, size_t max_image_height)
 
kleidicv_error_t kleidicv_filter_context_release (kleidicv_filter_context_t *context)
 
kleidicv_error_t kleidicv_separable_filter_2d_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels, const uint8_t *kernel_x, size_t kernel_width, const uint8_t *kernel_y, size_t kernel_height, kleidicv_border_type_t border_type, kleidicv_filter_context_t *context)
 
kleidicv_error_t kleidicv_separable_filter_2d_u16 (const uint16_t *src, size_t src_stride, uint16_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels, const uint16_t *kernel_x, size_t kernel_width, const uint16_t *kernel_y, size_t kernel_height, kleidicv_border_type_t border_type, kleidicv_filter_context_t *context)
 
kleidicv_error_t kleidicv_separable_filter_2d_s16 (const int16_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels, const int16_t *kernel_x, size_t kernel_width, const int16_t *kernel_y, size_t kernel_height, kleidicv_border_type_t border_type, kleidicv_filter_context_t *context)
 
kleidicv_error_t kleidicv_gaussian_blur_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels, size_t kernel_width, size_t kernel_height, float sigma_x, float sigma_y, kleidicv_border_type_t border_type, kleidicv_filter_context_t *context)
 
kleidicv_error_t kleidicv_split (const void *src_data, size_t src_stride, void **dst_data, const size_t *dst_strides, size_t width, size_t height, size_t channels, size_t element_size)
 
kleidicv_error_t kleidicv_transpose (const void *src, size_t src_stride, void *dst, size_t dst_stride, size_t src_width, size_t src_height, size_t element_size)
 
kleidicv_error_t kleidicv_rotate (const void *src, size_t src_stride, size_t width, size_t height, void *dst, size_t dst_stride, int angle, size_t element_size)
 
kleidicv_error_t kleidicv_merge (const void **srcs, const size_t *src_strides, void *dst, size_t dst_stride, size_t width, size_t height, size_t channels, size_t element_size)
 
kleidicv_error_t kleidicv_min_max_u8 (const uint8_t *src, size_t src_stride, size_t width, size_t height, uint8_t *min_value, uint8_t *max_value)
 
kleidicv_error_t kleidicv_min_max_s8 (const int8_t *src, size_t src_stride, size_t width, size_t height, int8_t *min_value, int8_t *max_value)
 
kleidicv_error_t kleidicv_min_max_u16 (const uint16_t *src, size_t src_stride, size_t width, size_t height, uint16_t *min_value, uint16_t *max_value)
 
kleidicv_error_t kleidicv_min_max_s16 (const int16_t *src, size_t src_stride, size_t width, size_t height, int16_t *min_value, int16_t *max_value)
 
kleidicv_error_t kleidicv_min_max_s32 (const int32_t *src, size_t src_stride, size_t width, size_t height, int32_t *min_value, int32_t *max_value)
 
kleidicv_error_t kleidicv_min_max_f32 (const float *src, size_t src_stride, size_t width, size_t height, float *min_value, float *max_value)
 
kleidicv_error_t kleidicv_min_max_loc_u8 (const uint8_t *src, size_t src_stride, size_t width, size_t height, size_t *min_offset, size_t *max_offset)
 
kleidicv_error_t kleidicv_sum_f32 (const float *src, size_t src_stride, size_t width, size_t height, float *sum)
 
kleidicv_error_t kleidicv_scale_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, float scale, float shift)
 
kleidicv_error_t kleidicv_scale_f32 (const float *src, size_t src_stride, float *dst, size_t dst_stride, size_t width, size_t height, float scale, float shift)
 
kleidicv_error_t kleidicv_exp_f32 (const float *src, size_t src_stride, float *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_f32_to_s8 (const float *src, size_t src_stride, int8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_f32_to_u8 (const float *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_s8_to_f32 (const int8_t *src, size_t src_stride, float *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_u8_to_f32 (const uint8_t *src, size_t src_stride, float *dst, size_t dst_stride, size_t width, size_t height)
 
kleidicv_error_t kleidicv_in_range_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, uint8_t lower_bound, uint8_t upper_bound)
 
kleidicv_error_t kleidicv_in_range_f32 (const float *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, float lower_bound, float upper_bound)
 
kleidicv_error_t kleidicv_remap_s16_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, size_t channels, const int16_t *mapxy, size_t mapxy_stride, kleidicv_border_type_t border_type, const uint8_t *border_value)
 
kleidicv_error_t kleidicv_remap_s16_u16 (const uint16_t *src, size_t src_stride, size_t src_width, size_t src_height, uint16_t *dst, size_t dst_stride, size_t dst_width, size_t dst_height, size_t channels, const int16_t *mapxy, size_t mapxy_stride, kleidicv_border_type_t border_type, const uint16_t *border_value)
 
kleidicv_error_t kleidicv_remap_f32_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, size_t channels, const float *mapx, size_t mapx_stride, const float *mapy, size_t mapy_stride, kleidicv_interpolation_type_t interpolation, kleidicv_border_type_t border_type, const uint8_t *border_value)
 
kleidicv_error_t kleidicv_remap_f32_u16 (const uint16_t *src, size_t src_stride, size_t src_width, size_t src_height, uint16_t *dst, size_t dst_stride, size_t dst_width, size_t dst_height, size_t channels, const float *mapx, size_t mapx_stride, const float *mapy, size_t mapy_stride, kleidicv_interpolation_type_t interpolation, kleidicv_border_type_t border_type, const uint16_t *border_value)
 
kleidicv_error_t kleidicv_warp_perspective_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, const float transformation[9], size_t channels, kleidicv_interpolation_type_t interpolation, kleidicv_border_type_t border_type, const uint8_t *border_value)
 
kleidicv_error_t kleidicv_median_blur_u8 (const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels, size_t kernel_width, size_t kernel_height, kleidicv_border_type_t border_type)
 
kleidicv_error_t kleidicv_median_blur_s16 (const int16_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels, size_t kernel_width, size_t kernel_height, kleidicv_border_type_t border_type)
 
kleidicv_error_t kleidicv_median_blur_u16 (const uint16_t *src, size_t src_stride, uint16_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels, size_t kernel_width, size_t kernel_height, kleidicv_border_type_t border_type)
 
kleidicv_error_t kleidicv_median_blur_f32 (const float *src, size_t src_stride, float *dst, size_t dst_stride, size_t width, size_t height, size_t channels, size_t kernel_width, size_t kernel_height, kleidicv_border_type_t border_type)
 
kleidicv_error_t kleidicv_median_blur_s8 (const int8_t *src, size_t src_stride, int8_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels, size_t kernel_width, size_t kernel_height, kleidicv_border_type_t border_type)
 
kleidicv_error_t kleidicv_median_blur_s32 (const int32_t *src, size_t src_stride, int32_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels, size_t kernel_width, size_t kernel_height, kleidicv_border_type_t border_type)
 
kleidicv_error_t kleidicv_median_blur_u32 (const uint32_t *src, size_t src_stride, uint32_t *dst, size_t dst_stride, size_t width, size_t height, size_t channels, size_t kernel_width, size_t kernel_height, kleidicv_border_type_t border_type)
 

Detailed Description

For an overview of the functions and their supported types see functionality.

Macro Definition Documentation

◆ KLEIDICV_MAX_IMAGE_PIXELS

#define KLEIDICV_MAX_IMAGE_PIXELS   ((1ULL << 48) - 1)

Maximum image size in pixels the library accepts.

In case of AArch64 it is limited to (almost) 256 terapixels. This way 16 bit is left for any arithmetic operations around image size or width or height.

Function Documentation

◆ kleidicv_bgr_to_yuv420_p_u8()

kleidicv_error_t kleidicv_bgr_to_yuv420_p_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
bool  is_yv12 
)

Converts an interleaved RGB, RGBA, BGR, or BGRA image to planar YUV420 format (IYUV or YV12 layout). All channels are 8-bit wide. If the input format includes an alpha channel, it is ignored.

Source format Source data has 3 or 4 interleaved channels per pixel:

  • R, G, B
  • B, G, R
  • R, G, B, Alpha
  • B, G, R, Alpha

One pixel occupies 3 or 4 bytes, depending on the format. There is no padding between pixels.

Destination format: Planar YUV420 The output buffer consists of three planes concatenated in memory:

  • Y plane: full resolution, size = width × height
  • U plane: quarter resolution, size = (width / 2) × (height / 2)
  • V plane: quarter resolution, size = (width / 2) × (height / 2)

Chroma (U and V) are subsampled by a factor of 2 in both horizontal and vertical directions. Only even rows and even columns from the RGB image are used to compute U and V values. If the input image has an odd width or height, the chroma resolution is rounded up. For example, a height of 9 will result in 5 chroma rows (since 9 / 2 = 4.5 -> rounded up). The same applies to the width. This behavior matches OpenCV's implementation.

If is_yv12 == false, the format is IYUV: Y + U + V If is_yv12 == true, the format is YV12: Y + V + U

Width and height refer to the logical image dimensions, i.e., number of pixels per row and number of rows. The total number of pixels must not exceed KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source buffer containing interleaved RGBX/BGRX data. Must be non-null.
src_strideByte offset between the start of one source row and the next. Must be at least (source channel count) * width, unless the image has only one row.
dstPointer to the destination buffer to store Y + U + V or Y
  • V + U data. Must be non-null.
dst_strideByte offset between the start of one row in the Y plane of the output and the next. Must be at least width. This same stride is reused to compute row stepping in the U and V planes, which are stored sequentially after the Y plane. Their row stepping alternates between these two values: uvsteps[2] = { width / 2, dst_stride - width / 2 }.
widthNumber of pixels in a row.
heightNumber of rows in the image.
is_yv12If true, use YV12 layout (Y + V + U). Otherwise, use I420 layout (Y + U + V).

◆ kleidicv_bgr_to_yuv420_sp_u8()

kleidicv_error_t kleidicv_bgr_to_yuv420_sp_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  y_dst,
size_t  y_stride,
uint8_t *  uv_dst,
size_t  uv_stride,
size_t  width,
size_t  height,
bool  is_nv21 
)

Converts an interleaved RGB, RGBA, BGR, or BGRA image to semi-planar YUV420 format (NV12 or NV21 layout). All channels are 8-bit wide. If the input format includes an alpha channel, it is ignored.

Source format Source data has 3 or 4 interleaved channels per pixel:

  • R, G, B
  • B, G, R
  • R, G, B, Alpha
  • B, G, R, Alpha

Each pixel occupies 3 or 4 bytes, depending on the format. There is no padding between pixels.

Destination format: Semi-Planar YUV420 The output consists of two planes:

  • Y plane: full resolution, size = width × height
  • UV plane: interleaved chroma (U and V) at quarter resolution, size = (width / 2) × (height / 2) × 2 bytes per chroma sample pair

Chroma (U and V) are subsampled by a factor of 2 in both horizontal and vertical directions. Only even rows and even columns from the RGB image are used to compute U and V values. If the input image has an odd width or height, the chroma resolution is rounded up. For example, a height of 9 will result in 5 chroma rows (since 9 / 2 = 4.5 -> rounded up). The same applies to the width. This behavior matches OpenCV's implementation.

If is_nv21 == false, the format is NV12: Y + interleaved UV If is_nv21 == true, the format is NV21: Y + interleaved VU

Width and height refer to the logical image dimensions, i.e., number of pixels per row and number of rows. The total number of pixels must not exceed KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source buffer containing interleaved RGBX/BGRX data. Must be non-null.
src_strideByte offset between the start of one source row and the next. Must be at least (source channel count) * width, unless the image has only one row.
y_dstPointer to the destination Y plane. Must be non-null.
y_strideByte offset between the start of one row in the Y plane and the next. Must be at least width.
uv_dstPointer to the destination UV plane (interleaved). Must be non-null.
uv_strideByte offset between the start of one row in the UV plane and the next. Must be at least __builtin_align_up(width, 2).
widthNumber of pixels per row in the image.
heightNumber of rows in the image.
is_nv21If true, UV plane is written in VU order (NV21). Otherwise, UV plane is written in UV order (NV12).

◆ kleidicv_bgr_to_yuv_u8()

kleidicv_error_t kleidicv_bgr_to_yuv_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Converts an RGB image to YUV, pixel by pixel. All channels are 8-bit wide.

Source data can have 3 channels or 4 if there is an alpha channel:

  • R,G,B
  • R,G,B,Alpha
  • B,G,R
  • B,G,R,Alpha

Destination data is filled like this: | Y,U,V | Y,U,V | Y,U,V | ... One pixel is represented by 3 bytes. There is no padding between the pixels. Alpha channel is not used in the conversion.

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the start of the next row for the destination data. Must not be less than 3 * width, except for single-row images.
widthNumber of pixels in a row.
heightNumber of rows in the data.

◆ kleidicv_bgra_to_yuv420_p_u8()

kleidicv_error_t kleidicv_bgra_to_yuv420_p_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
bool  is_yv12 
)

Converts an interleaved RGB, RGBA, BGR, or BGRA image to planar YUV420 format (IYUV or YV12 layout). All channels are 8-bit wide. If the input format includes an alpha channel, it is ignored.

Source format Source data has 3 or 4 interleaved channels per pixel:

  • R, G, B
  • B, G, R
  • R, G, B, Alpha
  • B, G, R, Alpha

One pixel occupies 3 or 4 bytes, depending on the format. There is no padding between pixels.

Destination format: Planar YUV420 The output buffer consists of three planes concatenated in memory:

  • Y plane: full resolution, size = width × height
  • U plane: quarter resolution, size = (width / 2) × (height / 2)
  • V plane: quarter resolution, size = (width / 2) × (height / 2)

Chroma (U and V) are subsampled by a factor of 2 in both horizontal and vertical directions. Only even rows and even columns from the RGB image are used to compute U and V values. If the input image has an odd width or height, the chroma resolution is rounded up. For example, a height of 9 will result in 5 chroma rows (since 9 / 2 = 4.5 -> rounded up). The same applies to the width. This behavior matches OpenCV's implementation.

If is_yv12 == false, the format is IYUV: Y + U + V If is_yv12 == true, the format is YV12: Y + V + U

Width and height refer to the logical image dimensions, i.e., number of pixels per row and number of rows. The total number of pixels must not exceed KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source buffer containing interleaved RGBX/BGRX data. Must be non-null.
src_strideByte offset between the start of one source row and the next. Must be at least (source channel count) * width, unless the image has only one row.
dstPointer to the destination buffer to store Y + U + V or Y
  • V + U data. Must be non-null.
dst_strideByte offset between the start of one row in the Y plane of the output and the next. Must be at least width. This same stride is reused to compute row stepping in the U and V planes, which are stored sequentially after the Y plane. Their row stepping alternates between these two values: uvsteps[2] = { width / 2, dst_stride - width / 2 }.
widthNumber of pixels in a row.
heightNumber of rows in the image.
is_yv12If true, use YV12 layout (Y + V + U). Otherwise, use I420 layout (Y + U + V).

◆ kleidicv_bgra_to_yuv420_sp_u8()

kleidicv_error_t kleidicv_bgra_to_yuv420_sp_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  y_dst,
size_t  y_stride,
uint8_t *  uv_dst,
size_t  uv_stride,
size_t  width,
size_t  height,
bool  is_nv21 
)

Converts an interleaved RGB, RGBA, BGR, or BGRA image to semi-planar YUV420 format (NV12 or NV21 layout). All channels are 8-bit wide. If the input format includes an alpha channel, it is ignored.

Source format Source data has 3 or 4 interleaved channels per pixel:

  • R, G, B
  • B, G, R
  • R, G, B, Alpha
  • B, G, R, Alpha

Each pixel occupies 3 or 4 bytes, depending on the format. There is no padding between pixels.

Destination format: Semi-Planar YUV420 The output consists of two planes:

  • Y plane: full resolution, size = width × height
  • UV plane: interleaved chroma (U and V) at quarter resolution, size = (width / 2) × (height / 2) × 2 bytes per chroma sample pair

Chroma (U and V) are subsampled by a factor of 2 in both horizontal and vertical directions. Only even rows and even columns from the RGB image are used to compute U and V values. If the input image has an odd width or height, the chroma resolution is rounded up. For example, a height of 9 will result in 5 chroma rows (since 9 / 2 = 4.5 -> rounded up). The same applies to the width. This behavior matches OpenCV's implementation.

If is_nv21 == false, the format is NV12: Y + interleaved UV If is_nv21 == true, the format is NV21: Y + interleaved VU

Width and height refer to the logical image dimensions, i.e., number of pixels per row and number of rows. The total number of pixels must not exceed KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source buffer containing interleaved RGBX/BGRX data. Must be non-null.
src_strideByte offset between the start of one source row and the next. Must be at least (source channel count) * width, unless the image has only one row.
y_dstPointer to the destination Y plane. Must be non-null.
y_strideByte offset between the start of one row in the Y plane and the next. Must be at least width.
uv_dstPointer to the destination UV plane (interleaved). Must be non-null.
uv_strideByte offset between the start of one row in the UV plane and the next. Must be at least __builtin_align_up(width, 2).
widthNumber of pixels per row in the image.
heightNumber of rows in the image.
is_nv21If true, UV plane is written in VU order (NV21). Otherwise, UV plane is written in UV order (NV12).

◆ kleidicv_bgra_to_yuv_u8()

kleidicv_error_t kleidicv_bgra_to_yuv_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Converts an RGB image to YUV, pixel by pixel. All channels are 8-bit wide.

Source data can have 3 channels or 4 if there is an alpha channel:

  • R,G,B
  • R,G,B,Alpha
  • B,G,R
  • B,G,R,Alpha

Destination data is filled like this: | Y,U,V | Y,U,V | Y,U,V | ... One pixel is represented by 3 bytes. There is no padding between the pixels. Alpha channel is not used in the conversion.

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the start of the next row for the destination data. Must not be less than 3 * width, except for single-row images.
widthNumber of pixels in a row.
heightNumber of rows in the data.

◆ kleidicv_bitwise_and()

kleidicv_error_t kleidicv_bitwise_and ( const uint8_t *  src_a,
size_t  src_a_stride,
const uint8_t *  src_b,
size_t  src_b_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Bitwise-ands the values of the corresponding elements in src_a and src_b, and puts the result into dst.

Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_compare_equal_u8()

kleidicv_error_t kleidicv_compare_equal_u8 ( const uint8_t *  src_a,
size_t  src_a_stride,
const uint8_t *  src_b,
size_t  src_b_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Performs an 'equal to' comparison of each element's value in src_a with respect to the corresponding element's value in src_b.

If the result of the comparison is true then the corresponding element in dst is set to 255, otherwise to 0.

Width and height are the same for the source and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the first destination data. Must be non-null.
dst_strideDistance 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).
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_compare_greater_u8()

kleidicv_error_t kleidicv_compare_greater_u8 ( const uint8_t *  src_a,
size_t  src_a_stride,
const uint8_t *  src_b,
size_t  src_b_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Performs a 'strictly greater than' comparison of each element's value in src_a with respect to the corresponding element's value in src_b.

If the result of the comparison is true then the corresponding element in dst is set to 255, otherwise to 0.

Width and height are the same for the source and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the first destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_count_nonzeros_u8()

kleidicv_error_t kleidicv_count_nonzeros_u8 ( const uint8_t *  src,
size_t  src_stride,
size_t  width,
size_t  height,
size_t *  count 
)

Counts how many nonzero elements are in the source data. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.
countPointer to variable to store result. Must be non-null.

◆ kleidicv_dilate_u8()

kleidicv_error_t kleidicv_dilate_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
kleidicv_morphology_context_t context 
)

Calculates maximum (dilate) or minimum (erode) element value of src values using a given kernel which has a rectangular shape, and puts the result into dst.

Width and height are the same for the source and the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

The kernel has an anchor point, it is usually the center of the kernel. The algorithm takes a rectangle from the source data using the kernel and the anchor, and calculates the max/min value in that rectangle.

Example for dilate:

[ 2, 8, 9, 3, 6 ] kernel: (3, 3) [ 8, 9, 9, 9, 6 ]
[ 7, 2, 4, 1, 5 ] anchor: (1, 1) -> [ 8, 9, 9, 9, 8 ]
[ 4, 3, 6, 8, 1 ] border: replicate [ 7, 7, 8, 8, 8 ]
[ 1, 2, 5, 3, 7 ] [ 4, 6, 8, 8, 8 ]

Usage:

Before using this function, a context must be created using kleidicv_morphology_create, and after finished, it has to be released using kleidicv_morphology_release. The context must be created with the same image dimensions as width and height parameters, with sizeof(uint8) as type_size, and with the channel number of the data as channels.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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), except for single-row images.
widthNumber of columns in the data. (One column consists of channels number of elements.) Must be greater than or equal to kernel - 1.
heightNumber of rows in the data. Must be greater than or equal to kernel - 1.
contextPointer to morphology context.

◆ kleidicv_erode_u8()

kleidicv_error_t kleidicv_erode_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
kleidicv_morphology_context_t context 
)

Calculates maximum (dilate) or minimum (erode) element value of src values using a given kernel which has a rectangular shape, and puts the result into dst.

Width and height are the same for the source and the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

The kernel has an anchor point, it is usually the center of the kernel. The algorithm takes a rectangle from the source data using the kernel and the anchor, and calculates the max/min value in that rectangle.

Example for dilate:

[ 2, 8, 9, 3, 6 ] kernel: (3, 3) [ 8, 9, 9, 9, 6 ]
[ 7, 2, 4, 1, 5 ] anchor: (1, 1) -> [ 8, 9, 9, 9, 8 ]
[ 4, 3, 6, 8, 1 ] border: replicate [ 7, 7, 8, 8, 8 ]
[ 1, 2, 5, 3, 7 ] [ 4, 6, 8, 8, 8 ]

Usage:

Before using this function, a context must be created using kleidicv_morphology_create, and after finished, it has to be released using kleidicv_morphology_release. The context must be created with the same image dimensions as width and height parameters, with sizeof(uint8) as type_size, and with the channel number of the data as channels.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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), except for single-row images.
widthNumber of columns in the data. (One column consists of channels number of elements.) Must be greater than or equal to kernel - 1.
heightNumber of rows in the data. Must be greater than or equal to kernel - 1.
contextPointer to morphology context.

◆ kleidicv_exp_f32()

kleidicv_error_t kleidicv_exp_f32 ( const float *  src,
size_t  src_stride,
float *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Exponential function, input is the elements in src, output is the elements in dst.

In case of float type the maximum error is 0.36565+0.5 ULP, or the error of the toolchain's expf implementation, if it is bigger.

Source and destination data length is width * height. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of pixels in a row.
heightNumber of rows in the data.

◆ kleidicv_f32_to_s8()

kleidicv_error_t kleidicv_f32_to_s8 ( const float *  src,
size_t  src_stride,
int8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Converts the elements in src from a floating-point type to an integer type, then stores the result in dst.

Each resulting element is saturated, i.e. it is the smallest/largest number of the type of the element if the src data type cannot be represented as the dst type. In case of some special values, such as the different variations of NaN, the result is 0. Source and destination data length is width * height. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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).
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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).
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_f32_to_u8()

kleidicv_error_t kleidicv_f32_to_u8 ( const float *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Converts the elements in src from a floating-point type to an integer type, then stores the result in dst.

Each resulting element is saturated, i.e. it is the smallest/largest number of the type of the element if the src data type cannot be represented as the dst type. In case of some special values, such as the different variations of NaN, the result is 0. Source and destination data length is width * height. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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).
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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).
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_filter_context_create()

kleidicv_error_t kleidicv_filter_context_create ( kleidicv_filter_context_t **  context,
size_t  max_channels,
size_t  max_kernel_width,
size_t  max_kernel_height,
size_t  max_image_width,
size_t  max_image_height 
)

Creates a filter context according to the parameters.

Before a Gaussian blur operation, this initialization is needed. After the operation is finished, the context needs to be released using kleidicv_filter_context_release.

Parameters
contextPointer where to return the created context's address.
max_channelsMaximum number of channels in the data. Must not be more than KLEIDICV_MAXIMUM_CHANNEL_COUNT.
max_kernel_widthMaximum width of the Gaussian blur kernel.
max_kernel_heightMaximum height of the Gaussian blur kernel.
max_image_widthMaximum image width. max_image_width * max_image_height must not be more than KLEIDICV_MAX_IMAGE_PIXELS.
max_image_heightMaximum image height. max_image_width * max_image_height must not be more than KLEIDICV_MAX_IMAGE_PIXELS.

◆ kleidicv_filter_context_release()

kleidicv_error_t kleidicv_filter_context_release ( kleidicv_filter_context_t context)

Releases a filter context that was previously created using kleidicv_filter_context_create.

Parameters
contextPointer to filter context. Must not be nullptr.

◆ kleidicv_gaussian_blur_u8()

kleidicv_error_t kleidicv_gaussian_blur_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
size_t  channels,
size_t  kernel_width,
size_t  kernel_height,
float  sigma_x,
float  sigma_y,
kleidicv_border_type_t  border_type,
kleidicv_filter_context_t context 
)

Applies Gaussian blur to the source image using the specified parameters. In-place filtering is not supported.

Width and height are assumed to be the same for the source and for the destination. The number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Usage:

Before using this function, a context must be created using kleidicv_filter_context_create, and when finished, it has to be released using kleidicv_filter_context_release. Please ensure that your filter context parameters are large enough, otherwise this API will return with an error.

Note, from the border types only these are supported:

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the 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.
widthNumber of columns in the data. (One column consists of channels number of elements.) Must be greater than or equal to kernel_width - 1 (if kernel_width is 3,5,7,15,21), or (kernel_width/2) rounded up to 8, plus kernel_width/2 (for other kernel sizes).
heightNumber of rows in the data. Must be greater than or equal to kernel_height - 1.
channelsNumber of channels in the data. Must be not more than KLEIDICV_MAXIMUM_CHANNEL_COUNT.
kernel_widthWidth of the Gaussian kernel.
kernel_heightHeight of the Gaussian kernel.
sigma_xHorizontal sigma (standard deviation) value. If equal to 0.0, Gaussian filter is approximated by the probability mass function of the binomial distribution in the horizontal direction.
sigma_yVertical sigma (standard deviation) value. If equal to 0.0, Gaussian filter is approximated by the probability mass function of the binomial distribution in the vertical direction.
border_typeWay of handling the border.
contextPointer to filter context.

◆ kleidicv_gray_to_rgb_u8()

kleidicv_error_t kleidicv_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 
)

Converts a grayscale image to RGB. All channels are 8-bit wide.

Destination data is filled as follows: R = G = B = Gray resulting in | R,G,B | R,G,B | R,G,B | ... image where each letter represents one byte of data, and one pixel is represented by 3 bytes. There is no padding between the pixels.

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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, except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the start of the next row for the destination data. Must not be less than 3 * width, except for single-row images.
widthNumber of pixels in a row.
heightNumber of rows in the data.

◆ kleidicv_gray_to_rgba_u8()

kleidicv_error_t kleidicv_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 
)

Converts a grayscale image to RGBA. All channels are 8-bit wide.

Destination data is filled as follows: R = G = B = Gray, A = 0xFF resulting in | R,G,B,A | R,G,B,A | R,G,B,A | ... image where each letter represents one byte of data, and one pixel is represented by 4 bytes. There is no padding between the pixels.

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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, except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the start of the next row for the destination data. Must not be less than 4 * width, except for single-row images.
widthNumber of pixels in a row.
heightNumber of rows in the data.

◆ kleidicv_in_range_f32()

kleidicv_error_t kleidicv_in_range_f32 ( const float *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
float  lower_bound,
float  upper_bound 
)

Performs a per element comparison in src with respect to caller defined lower and upper bounds. For the elements exceeding these bounds, the corresponding elements in dst are set to 0 and elements within to 255.

Width and height are the same for the source and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.
lower_boundThe lower bound of the interval.
upper_boundThe upper bound of the interval.

◆ kleidicv_in_range_u8()

kleidicv_error_t kleidicv_in_range_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
uint8_t  lower_bound,
uint8_t  upper_bound 
)

Performs a per element comparison in src with respect to caller defined lower and upper bounds. For the elements exceeding these bounds, the corresponding elements in dst are set to 0 and elements within to 255.

Width and height are the same for the source and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.
lower_boundThe lower bound of the interval.
upper_boundThe upper bound of the interval.

◆ kleidicv_median_blur_f32()

kleidicv_error_t kleidicv_median_blur_f32 ( const float *  src,
size_t  src_stride,
float *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
size_t  channels,
size_t  kernel_width,
size_t  kernel_height,
kleidicv_border_type_t  border_type 
)

Reduces noise by applying a median filter.

Width and height are assumed to be the same for the source and for the destination. The total number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the 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.
widthNumber of columns in the data. (One column consists of channels number of elements.) Must be greater than or equal to kernel_width - 1.
heightNumber of rows in the data. Must be greater than or equal to kernel_height - 1.
channelsNumber of channels in the data. Must not be more than KLEIDICV_MAXIMUM_CHANNEL_COUNT.
kernel_widthWidth of the Median kernel. Must be odd and equal to kernel_height. For uint8_t, values 3 to 255 are supported. For other types, only 3, 5 and 7.
kernel_heightHeight of the Median kernel. Must be odd and equal to kernel_width. For uint8_t, values 3 to 255 are supported. For other types, only 3, 5 and 7.
border_typeWay of handling the border. The supported border types are:

◆ kleidicv_median_blur_s16()

kleidicv_error_t kleidicv_median_blur_s16 ( const int16_t *  src,
size_t  src_stride,
int16_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
size_t  channels,
size_t  kernel_width,
size_t  kernel_height,
kleidicv_border_type_t  border_type 
)

Reduces noise by applying a median filter.

Width and height are assumed to be the same for the source and for the destination. The total number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the 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.
widthNumber of columns in the data. (One column consists of channels number of elements.) Must be greater than or equal to kernel_width - 1.
heightNumber of rows in the data. Must be greater than or equal to kernel_height - 1.
channelsNumber of channels in the data. Must not be more than KLEIDICV_MAXIMUM_CHANNEL_COUNT.
kernel_widthWidth of the Median kernel. Must be odd and equal to kernel_height. For uint8_t, values 3 to 255 are supported. For other types, only 3, 5 and 7.
kernel_heightHeight of the Median kernel. Must be odd and equal to kernel_width. For uint8_t, values 3 to 255 are supported. For other types, only 3, 5 and 7.
border_typeWay of handling the border. The supported border types are:

◆ kleidicv_median_blur_s32()

kleidicv_error_t kleidicv_median_blur_s32 ( const int32_t *  src,
size_t  src_stride,
int32_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
size_t  channels,
size_t  kernel_width,
size_t  kernel_height,
kleidicv_border_type_t  border_type 
)

Reduces noise by applying a median filter.

Width and height are assumed to be the same for the source and for the destination. The total number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the 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.
widthNumber of columns in the data. (One column consists of channels number of elements.) Must be greater than or equal to kernel_width - 1.
heightNumber of rows in the data. Must be greater than or equal to kernel_height - 1.
channelsNumber of channels in the data. Must not be more than KLEIDICV_MAXIMUM_CHANNEL_COUNT.
kernel_widthWidth of the Median kernel. Must be odd and equal to kernel_height. For uint8_t, values 3 to 255 are supported. For other types, only 3, 5 and 7.
kernel_heightHeight of the Median kernel. Must be odd and equal to kernel_width. For uint8_t, values 3 to 255 are supported. For other types, only 3, 5 and 7.
border_typeWay of handling the border. The supported border types are:

◆ kleidicv_median_blur_s8()

kleidicv_error_t kleidicv_median_blur_s8 ( const int8_t *  src,
size_t  src_stride,
int8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
size_t  channels,
size_t  kernel_width,
size_t  kernel_height,
kleidicv_border_type_t  border_type 
)

Reduces noise by applying a median filter.

Width and height are assumed to be the same for the source and for the destination. The total number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the 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.
widthNumber of columns in the data. (One column consists of channels number of elements.) Must be greater than or equal to kernel_width - 1.
heightNumber of rows in the data. Must be greater than or equal to kernel_height - 1.
channelsNumber of channels in the data. Must not be more than KLEIDICV_MAXIMUM_CHANNEL_COUNT.
kernel_widthWidth of the Median kernel. Must be odd and equal to kernel_height. For uint8_t, values 3 to 255 are supported. For other types, only 3, 5 and 7.
kernel_heightHeight of the Median kernel. Must be odd and equal to kernel_width. For uint8_t, values 3 to 255 are supported. For other types, only 3, 5 and 7.
border_typeWay of handling the border. The supported border types are:

◆ kleidicv_median_blur_u16()

kleidicv_error_t kleidicv_median_blur_u16 ( const uint16_t *  src,
size_t  src_stride,
uint16_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
size_t  channels,
size_t  kernel_width,
size_t  kernel_height,
kleidicv_border_type_t  border_type 
)

Reduces noise by applying a median filter.

Width and height are assumed to be the same for the source and for the destination. The total number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the 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.
widthNumber of columns in the data. (One column consists of channels number of elements.) Must be greater than or equal to kernel_width - 1.
heightNumber of rows in the data. Must be greater than or equal to kernel_height - 1.
channelsNumber of channels in the data. Must not be more than KLEIDICV_MAXIMUM_CHANNEL_COUNT.
kernel_widthWidth of the Median kernel. Must be odd and equal to kernel_height. For uint8_t, values 3 to 255 are supported. For other types, only 3, 5 and 7.
kernel_heightHeight of the Median kernel. Must be odd and equal to kernel_width. For uint8_t, values 3 to 255 are supported. For other types, only 3, 5 and 7.
border_typeWay of handling the border. The supported border types are:

◆ kleidicv_median_blur_u32()

kleidicv_error_t kleidicv_median_blur_u32 ( const uint32_t *  src,
size_t  src_stride,
uint32_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
size_t  channels,
size_t  kernel_width,
size_t  kernel_height,
kleidicv_border_type_t  border_type 
)

Reduces noise by applying a median filter.

Width and height are assumed to be the same for the source and for the destination. The total number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the 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.
widthNumber of columns in the data. (One column consists of channels number of elements.) Must be greater than or equal to kernel_width - 1.
heightNumber of rows in the data. Must be greater than or equal to kernel_height - 1.
channelsNumber of channels in the data. Must not be more than KLEIDICV_MAXIMUM_CHANNEL_COUNT.
kernel_widthWidth of the Median kernel. Must be odd and equal to kernel_height. For uint8_t, values 3 to 255 are supported. For other types, only 3, 5 and 7.
kernel_heightHeight of the Median kernel. Must be odd and equal to kernel_width. For uint8_t, values 3 to 255 are supported. For other types, only 3, 5 and 7.
border_typeWay of handling the border. The supported border types are:

◆ kleidicv_median_blur_u8()

kleidicv_error_t kleidicv_median_blur_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
size_t  channels,
size_t  kernel_width,
size_t  kernel_height,
kleidicv_border_type_t  border_type 
)

Reduces noise by applying a median filter.

Width and height are assumed to be the same for the source and for the destination. The total number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the 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.
widthNumber of columns in the data. (One column consists of channels number of elements.) Must be greater than or equal to kernel_width - 1.
heightNumber of rows in the data. Must be greater than or equal to kernel_height - 1.
channelsNumber of channels in the data. Must not be more than KLEIDICV_MAXIMUM_CHANNEL_COUNT.
kernel_widthWidth of the Median kernel. Must be odd and equal to kernel_height. For uint8_t, values 3 to 255 are supported. For other types, only 3, 5 and 7.
kernel_heightHeight of the Median kernel. Must be odd and equal to kernel_width. For uint8_t, values 3 to 255 are supported. For other types, only 3, 5 and 7.
border_typeWay of handling the border. The supported border types are:

◆ kleidicv_merge()

kleidicv_error_t kleidicv_merge ( const void **  srcs,
const size_t *  src_strides,
void *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
size_t  channels,
size_t  element_size 
)

Merges separate 1-channel source streams to one multi channel stream. Width and height are the same for all the source streams and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcsA C style array of pointers to the source data. Number of pointers in the array must be the same as the channel number. All pointers must be non-null. All pointers must be aligned to element_size.
src_stridesA C style array of stride values for the source streams. A stride value represents the distance in bytes from the start of one row to the start of the 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 no less than width * element_size, except for single-row images.
dstPointer to the destination data. Must be non-null. Must be aligned to element_size.
dst_strideDistance in bytes from the start of one row to the 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.
widthNumber of elements in a row for the source streams, number of pixels in a row for the destination data.
heightNumber of rows in the data.
channelsNumber of channels in the destination data. Must be 2, 3 or 4.
element_sizeSize of one element in bytes. Must be 1, 2, 4 or 8.

◆ kleidicv_min_max_f32()

kleidicv_error_t kleidicv_min_max_f32 ( const float *  src,
size_t  src_stride,
size_t  width,
size_t  height,
float *  min_value,
float *  max_value 
)

Calculates minimum and maximum element value across the source data. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
widthNumber of elements in a row. Must be greater than 0.
heightNumber of rows in the data. Must be greater than 0.
min_valuePointer to save result minimum value to, or nullptr if minimum is not to be calculated.
max_valuePointer to save result maximum value to, or nullptr if maximum is not to be calculated.

◆ kleidicv_min_max_loc_u8()

kleidicv_error_t kleidicv_min_max_loc_u8 ( const uint8_t *  src,
size_t  src_stride,
size_t  width,
size_t  height,
size_t *  min_offset,
size_t *  max_offset 
)

Finds minimum and maximum element value across the source data, and returns their location in the source data as offset in bytes from the source beginning. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
widthNumber of elements in a row. Must be greater than 0.
heightNumber of rows in the data. Must be greater than 0.
min_offsetPointer to save result offset of minimum value to, or nullptr if minimum is not to be calculated.
max_offsetPointer to save result offset of maximum value to, or nullptr if maximum is not to be calculated.

◆ kleidicv_min_max_s16()

kleidicv_error_t kleidicv_min_max_s16 ( const int16_t *  src,
size_t  src_stride,
size_t  width,
size_t  height,
int16_t *  min_value,
int16_t *  max_value 
)

Calculates minimum and maximum element value across the source data. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
widthNumber of elements in a row. Must be greater than 0.
heightNumber of rows in the data. Must be greater than 0.
min_valuePointer to save result minimum value to, or nullptr if minimum is not to be calculated.
max_valuePointer to save result maximum value to, or nullptr if maximum is not to be calculated.

◆ kleidicv_min_max_s32()

kleidicv_error_t kleidicv_min_max_s32 ( const int32_t *  src,
size_t  src_stride,
size_t  width,
size_t  height,
int32_t *  min_value,
int32_t *  max_value 
)

Calculates minimum and maximum element value across the source data. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
widthNumber of elements in a row. Must be greater than 0.
heightNumber of rows in the data. Must be greater than 0.
min_valuePointer to save result minimum value to, or nullptr if minimum is not to be calculated.
max_valuePointer to save result maximum value to, or nullptr if maximum is not to be calculated.

◆ kleidicv_min_max_s8()

kleidicv_error_t kleidicv_min_max_s8 ( const int8_t *  src,
size_t  src_stride,
size_t  width,
size_t  height,
int8_t *  min_value,
int8_t *  max_value 
)

Calculates minimum and maximum element value across the source data. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
widthNumber of elements in a row. Must be greater than 0.
heightNumber of rows in the data. Must be greater than 0.
min_valuePointer to save result minimum value to, or nullptr if minimum is not to be calculated.
max_valuePointer to save result maximum value to, or nullptr if maximum is not to be calculated.

◆ kleidicv_min_max_u16()

kleidicv_error_t kleidicv_min_max_u16 ( const uint16_t *  src,
size_t  src_stride,
size_t  width,
size_t  height,
uint16_t *  min_value,
uint16_t *  max_value 
)

Calculates minimum and maximum element value across the source data. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
widthNumber of elements in a row. Must be greater than 0.
heightNumber of rows in the data. Must be greater than 0.
min_valuePointer to save result minimum value to, or nullptr if minimum is not to be calculated.
max_valuePointer to save result maximum value to, or nullptr if maximum is not to be calculated.

◆ kleidicv_min_max_u8()

kleidicv_error_t kleidicv_min_max_u8 ( const uint8_t *  src,
size_t  src_stride,
size_t  width,
size_t  height,
uint8_t *  min_value,
uint8_t *  max_value 
)

Calculates minimum and maximum element value across the source data. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
widthNumber of elements in a row. Must be greater than 0.
heightNumber of rows in the data. Must be greater than 0.
min_valuePointer to save result minimum value to, or nullptr if minimum is not to be calculated.
max_valuePointer to save result maximum value to, or nullptr if maximum is not to be calculated.

◆ kleidicv_morphology_create()

kleidicv_error_t kleidicv_morphology_create ( kleidicv_morphology_context_t **  context,
kleidicv_rectangle_t  kernel,
kleidicv_point_t  anchor,
kleidicv_border_type_t  border_type,
const uint8_t *  border_value,
size_t  channels,
size_t  iterations,
size_t  type_size,
kleidicv_rectangle_t  image 
)

Creates a morphology context according to the parameters.

Before a dilate or erode operation, this initialization is needed. After the operation is finished, the context needs to be released using kleidicv_morphology_release.

Parameters
contextPointer where to return the created context's address.
kernelWidth and height of the kernel. Its size must not be more than KLEIDICV_MAX_IMAGE_PIXELS.
anchorLocation in the kernel which is aligned to the actual point in the source data. Must not point out of the kernel.
border_typeWay of handling the border. The supported border types are:
border_valueBorder value if the border_type is KLEIDICV_BORDER_TYPE_CONSTANT.
channelsNumber of channels in the data. Must be not more than KLEIDICV_MAXIMUM_CHANNEL_COUNT.
iterationsNumber of times to do the morphology operation.
type_sizeElement size in bytes. Must not be more than KLEIDICV_MAXIMUM_TYPE_SIZE.
imageImage dimensions. Its size must not be more than KLEIDICV_MAX_IMAGE_PIXELS.

◆ kleidicv_morphology_release()

kleidicv_error_t kleidicv_morphology_release ( kleidicv_morphology_context_t context)

Releases a morphology context that was previously created using kleidicv_morphology_create.

Parameters
contextPointer to morphology context. Must not be nullptr.

◆ kleidicv_remap_f32_u16()

kleidicv_error_t kleidicv_remap_f32_u16 ( const uint16_t *  src,
size_t  src_stride,
size_t  src_width,
size_t  src_height,
uint16_t *  dst,
size_t  dst_stride,
size_t  dst_width,
size_t  dst_height,
size_t  channels,
const float *  mapx,
size_t  mapx_stride,
const float *  mapy,
size_t  mapy_stride,
kleidicv_interpolation_type_t  interpolation,
kleidicv_border_type_t  border_type,
const uint16_t *  border_value 
)

Transforms the src image by taking the pixels specified by the coordinates from the mapxy image.

Width and height are the same for mapx, mapy and for dst. src dimensions may be different, but due to the limits of 32-bit float format, its width and height must be less than 2^24. Coordinates outside of src dimensions are considered border. Zero width or height src is not supported.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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), except for single-row images. Must be less than 2^32.
src_widthNumber of elements in the source row. Must be less than 2^24.
src_heightNumber of rows in the source data. Must be less than 2^24.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dst_widthNumber of elements in a destination row. Must be at least 4.
dst_heightNumber of rows in the destination data.
channelsNumber of channels in the (source and destination) data. Can be 1 or 2.
mapxPointer to the x coordinates' data. Must be non-null.
mapx_strideDistance in bytes from the start of one row to the start of the next row for mapx. Must be a multiple of sizeof(float) and no less than width * sizeof(float), except for single-row images.
mapyPointer to the y coordinates' data. Must be non-null.
mapy_strideDistance in bytes from the start of one row to the start of the next row for mapy. Must be a multiple of sizeof(float) and no less than width * sizeof(float), except for single-row images.
interpolationInterpolation algorithm. Supported types:
border_typeWay of handling the border. The supported border types are:
border_valueBorder values if the border_type is KLEIDICV_BORDER_TYPE_CONSTANT.

◆ kleidicv_remap_f32_u8()

kleidicv_error_t kleidicv_remap_f32_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,
size_t  channels,
const float *  mapx,
size_t  mapx_stride,
const float *  mapy,
size_t  mapy_stride,
kleidicv_interpolation_type_t  interpolation,
kleidicv_border_type_t  border_type,
const uint8_t *  border_value 
)

Transforms the src image by taking the pixels specified by the coordinates from the mapxy image.

Width and height are the same for mapx, mapy and for dst. src dimensions may be different, but due to the limits of 32-bit float format, its width and height must be less than 2^24. Coordinates outside of src dimensions are considered border. Zero width or height src is not supported.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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), except for single-row images. Must be less than 2^32.
src_widthNumber of elements in the source row. Must be less than 2^24.
src_heightNumber of rows in the source data. Must be less than 2^24.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dst_widthNumber of elements in a destination row. Must be at least 4.
dst_heightNumber of rows in the destination data.
channelsNumber of channels in the (source and destination) data. Can be 1 or 2.
mapxPointer to the x coordinates' data. Must be non-null.
mapx_strideDistance in bytes from the start of one row to the start of the next row for mapx. Must be a multiple of sizeof(float) and no less than width * sizeof(float), except for single-row images.
mapyPointer to the y coordinates' data. Must be non-null.
mapy_strideDistance in bytes from the start of one row to the start of the next row for mapy. Must be a multiple of sizeof(float) and no less than width * sizeof(float), except for single-row images.
interpolationInterpolation algorithm. Supported types:
border_typeWay of handling the border. The supported border types are:
border_valueBorder values if the border_type is KLEIDICV_BORDER_TYPE_CONSTANT.

◆ kleidicv_remap_s16_u16()

kleidicv_error_t kleidicv_remap_s16_u16 ( const uint16_t *  src,
size_t  src_stride,
size_t  src_width,
size_t  src_height,
uint16_t *  dst,
size_t  dst_stride,
size_t  dst_width,
size_t  dst_height,
size_t  channels,
const int16_t *  mapxy,
size_t  mapxy_stride,
kleidicv_border_type_t  border_type,
const uint16_t *  border_value 
)

Transforms the src image by taking the pixels specified by the coordinates from the mapxy image.

Width and height must be the same for mapxy and for dst. src dimensions may be different. Coordinates outside of src dimensions are considered border.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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), except for single-row images. Must be less than 2^16 * sizeof(type).
src_widthNumber of elements in the source row. Must not be bigger than 2^15.
src_heightNumber of rows in the source data. Must not be bigger than 2^15.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dst_widthNumber of elements in the destination row. Must be at least 8.
dst_heightNumber of rows in the destination data.
mapxyPointer to the mapping data. Must be non-null.
mapxy_strideDistance 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(int16_t) and no less than width * sizeof(int16_t), except for single-row images.
channelsNumber of channels in the data. Must be 1.
border_typeWay of handling the border. The supported border types are:
border_valueBorder value if the border_type is KLEIDICV_BORDER_TYPE_CONSTANT.

◆ kleidicv_remap_s16_u8()

kleidicv_error_t kleidicv_remap_s16_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,
size_t  channels,
const int16_t *  mapxy,
size_t  mapxy_stride,
kleidicv_border_type_t  border_type,
const uint8_t *  border_value 
)

Transforms the src image by taking the pixels specified by the coordinates from the mapxy image.

Width and height must be the same for mapxy and for dst. src dimensions may be different. Coordinates outside of src dimensions are considered border.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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), except for single-row images. Must be less than 2^16 * sizeof(type).
src_widthNumber of elements in the source row. Must not be bigger than 2^15.
src_heightNumber of rows in the source data. Must not be bigger than 2^15.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dst_widthNumber of elements in the destination row. Must be at least 8.
dst_heightNumber of rows in the destination data.
mapxyPointer to the mapping data. Must be non-null.
mapxy_strideDistance 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(int16_t) and no less than width * sizeof(int16_t), except for single-row images.
channelsNumber of channels in the data. Must be 1.
border_typeWay of handling the border. The supported border types are:
border_valueBorder value if the border_type is KLEIDICV_BORDER_TYPE_CONSTANT.

◆ kleidicv_resize_linear_f32()

kleidicv_error_t kleidicv_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 
)

Resize image using linear interpolation. In-place operation not supported.

At present only 2x2 and 4x4 upsizing is supported, and 8x8 for float data. For other ratios KLEIDICV_ERROR_NOT_IMPLEMENTED will be returned. The total number of pixels in the destination is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_widthNumber of elements in the source row.
src_heightNumber of rows in the source data.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dst_widthNumber of elements in the destination row. Must be inline with the choosen upsizing operation, for example src_width * 2 in case of 2x2.
dst_heightNumber of rows in the destination data. Must be inline with the choosen upsizing operation, for example src_height * 2 in case of 2x2.

◆ kleidicv_resize_linear_u8()

kleidicv_error_t kleidicv_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 
)

Resize image using linear interpolation. In-place operation not supported.

At present only 2x2 and 4x4 upsizing is supported, and 8x8 for float data. For other ratios KLEIDICV_ERROR_NOT_IMPLEMENTED will be returned. The total number of pixels in the destination is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_widthNumber of elements in the source row.
src_heightNumber of rows in the source data.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dst_widthNumber of elements in the destination row. Must be inline with the choosen upsizing operation, for example src_width * 2 in case of 2x2.
dst_heightNumber of rows in the destination data. Must be inline with the choosen upsizing operation, for example src_height * 2 in case of 2x2.

◆ kleidicv_resize_to_quarter_u8()

kleidicv_error_t kleidicv_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 
)

Resizes source data by averaging 4 elements to one. In-place operation not supported.

For even source dimensions (2*N, 2*M) destination dimensions should be (N, M). In case of odd source dimensions (2*N+1, 2*M+1) destination dimensions could be either (N+1, M+1) or (N, M) or combination of both. For later cases last respective row or column of source data will not be processed. Currently only supports single-channel data. Number of pixels in the source is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Even dimension example of 2x2 to 1x1 conversion:

| a | b | --> | (a+b+c+d)/4 |
| c | d |

Odd dimension example of 3x3 to 2x2 conversion:

| a | b | c | | (a+b+c+d)/4 | (c+f)/2 |
| d | e | f | --> | (g+h)/2 | i |
| g | h | i |
Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_widthNumber of elements in the source row.
src_heightNumber of rows in the source data.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dst_widthNumber 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 or (src_width / 2) + 1.
dst_heightNumber of rows in the destination data. Must be src_height / 2 for even src_height. For odd src_height it must be either src_height / 2 or (src_height / 2) + 1.

◆ kleidicv_rgb_to_bgr_u8()

kleidicv_error_t kleidicv_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 
)

Converts an RGB image to BGR. All channels are 8-bit wide.

Destination data is filled as follows: | B,G,R | B,G,R | B,G,R | ... Each letter represents one byte of data, and one pixel is represented by 3 bytes. There is no padding between the pixels.

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the start of the next row for the source data. Must not be less than 3 * width, except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the start of the next row for the destination data. Must not be less than 3 * width, except for single-row images.
widthNumber of pixels in a row.
heightNumber of rows in the data.

◆ kleidicv_rgb_to_bgra_u8()

kleidicv_error_t kleidicv_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 
)

Converts an RGB image to BGRA. All channels are 8-bit wide.

Corresponding colors are set while Alpha channel is set to 0xFF. Destination data is filled as follows: | B,G,R,A | B,G,R,A | B,G,R,A | ... Each letter represents one byte of data, and one pixel is represented by 4 bytes. There is no padding between the pixels.

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the start of the next row for the source data. Must not be less than 3 * width, except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the start of the next row for the destination data. Must not be less than 4 * width, except for single-row images.
widthNumber of pixels in a row.
heightNumber of rows in the data.

◆ kleidicv_rgb_to_rgb_u8()

kleidicv_error_t kleidicv_rgb_to_rgb_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Copies a source RBG image to destination buffer. All channels are 8-bit wide.

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the start of the next row for the source data. Must not be less than 3 * width, except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the start of the next row for the destination data. Must not be less than 3 * width, except for single-row images.
widthNumber of pixels in a row.
heightNumber of rows in the data.

◆ kleidicv_rgb_to_rgba_u8()

kleidicv_error_t kleidicv_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 
)

Converts an RGB image to RGBA. All channels are 8-bit wide.

Corresponding colors are set while Alpha channel is set to 0xFF. Destination data is filled as follows: | R,G,B,A | R,G,B,A | R,G,B,A | ... Each letter represents one byte of data, and one pixel is represented by 4 bytes. There is no padding between the pixels.

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the start of the next row for the source data. Must not be less than 3 * width, except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the start of the next row for the destination data. Must not be less than 4 * width, except for single-row images.
widthNumber of pixels in a row.
heightNumber of rows in the data.

◆ kleidicv_rgb_to_yuv420_p_u8()

kleidicv_error_t kleidicv_rgb_to_yuv420_p_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
bool  is_yv12 
)

Converts an interleaved RGB, RGBA, BGR, or BGRA image to planar YUV420 format (IYUV or YV12 layout). All channels are 8-bit wide. If the input format includes an alpha channel, it is ignored.

Source format Source data has 3 or 4 interleaved channels per pixel:

  • R, G, B
  • B, G, R
  • R, G, B, Alpha
  • B, G, R, Alpha

One pixel occupies 3 or 4 bytes, depending on the format. There is no padding between pixels.

Destination format: Planar YUV420 The output buffer consists of three planes concatenated in memory:

  • Y plane: full resolution, size = width × height
  • U plane: quarter resolution, size = (width / 2) × (height / 2)
  • V plane: quarter resolution, size = (width / 2) × (height / 2)

Chroma (U and V) are subsampled by a factor of 2 in both horizontal and vertical directions. Only even rows and even columns from the RGB image are used to compute U and V values. If the input image has an odd width or height, the chroma resolution is rounded up. For example, a height of 9 will result in 5 chroma rows (since 9 / 2 = 4.5 -> rounded up). The same applies to the width. This behavior matches OpenCV's implementation.

If is_yv12 == false, the format is IYUV: Y + U + V If is_yv12 == true, the format is YV12: Y + V + U

Width and height refer to the logical image dimensions, i.e., number of pixels per row and number of rows. The total number of pixels must not exceed KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source buffer containing interleaved RGBX/BGRX data. Must be non-null.
src_strideByte offset between the start of one source row and the next. Must be at least (source channel count) * width, unless the image has only one row.
dstPointer to the destination buffer to store Y + U + V or Y
  • V + U data. Must be non-null.
dst_strideByte offset between the start of one row in the Y plane of the output and the next. Must be at least width. This same stride is reused to compute row stepping in the U and V planes, which are stored sequentially after the Y plane. Their row stepping alternates between these two values: uvsteps[2] = { width / 2, dst_stride - width / 2 }.
widthNumber of pixels in a row.
heightNumber of rows in the image.
is_yv12If true, use YV12 layout (Y + V + U). Otherwise, use I420 layout (Y + U + V).

◆ kleidicv_rgb_to_yuv420_sp_u8()

kleidicv_error_t kleidicv_rgb_to_yuv420_sp_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  y_dst,
size_t  y_stride,
uint8_t *  uv_dst,
size_t  uv_stride,
size_t  width,
size_t  height,
bool  is_nv21 
)

Converts an interleaved RGB, RGBA, BGR, or BGRA image to semi-planar YUV420 format (NV12 or NV21 layout). All channels are 8-bit wide. If the input format includes an alpha channel, it is ignored.

Source format Source data has 3 or 4 interleaved channels per pixel:

  • R, G, B
  • B, G, R
  • R, G, B, Alpha
  • B, G, R, Alpha

Each pixel occupies 3 or 4 bytes, depending on the format. There is no padding between pixels.

Destination format: Semi-Planar YUV420 The output consists of two planes:

  • Y plane: full resolution, size = width × height
  • UV plane: interleaved chroma (U and V) at quarter resolution, size = (width / 2) × (height / 2) × 2 bytes per chroma sample pair

Chroma (U and V) are subsampled by a factor of 2 in both horizontal and vertical directions. Only even rows and even columns from the RGB image are used to compute U and V values. If the input image has an odd width or height, the chroma resolution is rounded up. For example, a height of 9 will result in 5 chroma rows (since 9 / 2 = 4.5 -> rounded up). The same applies to the width. This behavior matches OpenCV's implementation.

If is_nv21 == false, the format is NV12: Y + interleaved UV If is_nv21 == true, the format is NV21: Y + interleaved VU

Width and height refer to the logical image dimensions, i.e., number of pixels per row and number of rows. The total number of pixels must not exceed KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source buffer containing interleaved RGBX/BGRX data. Must be non-null.
src_strideByte offset between the start of one source row and the next. Must be at least (source channel count) * width, unless the image has only one row.
y_dstPointer to the destination Y plane. Must be non-null.
y_strideByte offset between the start of one row in the Y plane and the next. Must be at least width.
uv_dstPointer to the destination UV plane (interleaved). Must be non-null.
uv_strideByte offset between the start of one row in the UV plane and the next. Must be at least __builtin_align_up(width, 2).
widthNumber of pixels per row in the image.
heightNumber of rows in the image.
is_nv21If true, UV plane is written in VU order (NV21). Otherwise, UV plane is written in UV order (NV12).

◆ kleidicv_rgb_to_yuv_u8()

kleidicv_error_t kleidicv_rgb_to_yuv_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Converts an RGB image to YUV, pixel by pixel. All channels are 8-bit wide.

Source data can have 3 channels or 4 if there is an alpha channel:

  • R,G,B
  • R,G,B,Alpha
  • B,G,R
  • B,G,R,Alpha

Destination data is filled like this: | Y,U,V | Y,U,V | Y,U,V | ... One pixel is represented by 3 bytes. There is no padding between the pixels. Alpha channel is not used in the conversion.

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the start of the next row for the destination data. Must not be less than 3 * width, except for single-row images.
widthNumber of pixels in a row.
heightNumber of rows in the data.

◆ kleidicv_rgba_to_bgr_u8()

kleidicv_error_t kleidicv_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 
)

Converts an RGBA image to BGR. All channels are 8-bit wide.

Corresponding colors are set while Alpha channel is discarded. Destination data is filled as follows: | B,G,R | B,G,R | B,G,R | ... Each letter represents one byte of data, and one pixel is represented by 3 bytes. There is no padding between the pixels.

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the start of the next row for the source data. Must not be less than 4 * width, except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the start of the next row for the destination data. Must not be less than 3 * width, except for single-row images.
widthNumber of pixels in a row.
heightNumber of rows in the data.

◆ kleidicv_rgba_to_bgra_u8()

kleidicv_error_t kleidicv_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 
)

Converts an RGBA image to BGRA. All channels are 8-bit wide.

Destination data is filled as follows: | B,G,R,A | B,G,R,A | B,G,R,A | ... Each letter represents one byte of data, and one pixel is represented by 4 bytes. There is no padding between the pixels.

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the start of the next row for the source data. Must not be less than 4 * width, except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the start of the next row for the destination data. Must not be less than 4 * width, except for single-row images.
widthNumber of pixels in a row.
heightNumber of rows in the data.

◆ kleidicv_rgba_to_rgb_u8()

kleidicv_error_t kleidicv_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 
)

Converts an RGBA image to RGB. All channels are 8-bit wide.

Corresponding colors are set while Alpha channel is discarded. Destination data is filled as follows: | R,G,B | R,G,B | R,G,B | ... Each letter represents one byte of data, and one pixel is represented by 3 bytes. There is no padding between the pixels.

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the start of the next row for the source data. Must not be less than 4 * width, except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the start of the next row for the destination data. Must not be less than 3 * width, except for single-row images.
widthNumber of pixels in a row.
heightNumber of rows in the data.

◆ kleidicv_rgba_to_rgba_u8()

kleidicv_error_t kleidicv_rgba_to_rgba_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Copies a source RBGA image to destination buffer. All channels are 8-bit wide.

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the start of the next row for the source data. Must not be less than 4 * width, except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the start of the next row for the destination data. Must not be less than 4 * width, except for single-row images.
widthNumber of pixels in a row.
heightNumber of rows in the data.

◆ kleidicv_rgba_to_yuv420_p_u8()

kleidicv_error_t kleidicv_rgba_to_yuv420_p_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
bool  is_yv12 
)

Converts an interleaved RGB, RGBA, BGR, or BGRA image to planar YUV420 format (IYUV or YV12 layout). All channels are 8-bit wide. If the input format includes an alpha channel, it is ignored.

Source format Source data has 3 or 4 interleaved channels per pixel:

  • R, G, B
  • B, G, R
  • R, G, B, Alpha
  • B, G, R, Alpha

One pixel occupies 3 or 4 bytes, depending on the format. There is no padding between pixels.

Destination format: Planar YUV420 The output buffer consists of three planes concatenated in memory:

  • Y plane: full resolution, size = width × height
  • U plane: quarter resolution, size = (width / 2) × (height / 2)
  • V plane: quarter resolution, size = (width / 2) × (height / 2)

Chroma (U and V) are subsampled by a factor of 2 in both horizontal and vertical directions. Only even rows and even columns from the RGB image are used to compute U and V values. If the input image has an odd width or height, the chroma resolution is rounded up. For example, a height of 9 will result in 5 chroma rows (since 9 / 2 = 4.5 -> rounded up). The same applies to the width. This behavior matches OpenCV's implementation.

If is_yv12 == false, the format is IYUV: Y + U + V If is_yv12 == true, the format is YV12: Y + V + U

Width and height refer to the logical image dimensions, i.e., number of pixels per row and number of rows. The total number of pixels must not exceed KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source buffer containing interleaved RGBX/BGRX data. Must be non-null.
src_strideByte offset between the start of one source row and the next. Must be at least (source channel count) * width, unless the image has only one row.
dstPointer to the destination buffer to store Y + U + V or Y
  • V + U data. Must be non-null.
dst_strideByte offset between the start of one row in the Y plane of the output and the next. Must be at least width. This same stride is reused to compute row stepping in the U and V planes, which are stored sequentially after the Y plane. Their row stepping alternates between these two values: uvsteps[2] = { width / 2, dst_stride - width / 2 }.
widthNumber of pixels in a row.
heightNumber of rows in the image.
is_yv12If true, use YV12 layout (Y + V + U). Otherwise, use I420 layout (Y + U + V).

◆ kleidicv_rgba_to_yuv420_sp_u8()

kleidicv_error_t kleidicv_rgba_to_yuv420_sp_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  y_dst,
size_t  y_stride,
uint8_t *  uv_dst,
size_t  uv_stride,
size_t  width,
size_t  height,
bool  is_nv21 
)

Converts an interleaved RGB, RGBA, BGR, or BGRA image to semi-planar YUV420 format (NV12 or NV21 layout). All channels are 8-bit wide. If the input format includes an alpha channel, it is ignored.

Source format Source data has 3 or 4 interleaved channels per pixel:

  • R, G, B
  • B, G, R
  • R, G, B, Alpha
  • B, G, R, Alpha

Each pixel occupies 3 or 4 bytes, depending on the format. There is no padding between pixels.

Destination format: Semi-Planar YUV420 The output consists of two planes:

  • Y plane: full resolution, size = width × height
  • UV plane: interleaved chroma (U and V) at quarter resolution, size = (width / 2) × (height / 2) × 2 bytes per chroma sample pair

Chroma (U and V) are subsampled by a factor of 2 in both horizontal and vertical directions. Only even rows and even columns from the RGB image are used to compute U and V values. If the input image has an odd width or height, the chroma resolution is rounded up. For example, a height of 9 will result in 5 chroma rows (since 9 / 2 = 4.5 -> rounded up). The same applies to the width. This behavior matches OpenCV's implementation.

If is_nv21 == false, the format is NV12: Y + interleaved UV If is_nv21 == true, the format is NV21: Y + interleaved VU

Width and height refer to the logical image dimensions, i.e., number of pixels per row and number of rows. The total number of pixels must not exceed KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source buffer containing interleaved RGBX/BGRX data. Must be non-null.
src_strideByte offset between the start of one source row and the next. Must be at least (source channel count) * width, unless the image has only one row.
y_dstPointer to the destination Y plane. Must be non-null.
y_strideByte offset between the start of one row in the Y plane and the next. Must be at least width.
uv_dstPointer to the destination UV plane (interleaved). Must be non-null.
uv_strideByte offset between the start of one row in the UV plane and the next. Must be at least __builtin_align_up(width, 2).
widthNumber of pixels per row in the image.
heightNumber of rows in the image.
is_nv21If true, UV plane is written in VU order (NV21). Otherwise, UV plane is written in UV order (NV12).

◆ kleidicv_rgba_to_yuv_u8()

kleidicv_error_t kleidicv_rgba_to_yuv_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Converts an RGB image to YUV, pixel by pixel. All channels are 8-bit wide.

Source data can have 3 channels or 4 if there is an alpha channel:

  • R,G,B
  • R,G,B,Alpha
  • B,G,R
  • B,G,R,Alpha

Destination data is filled like this: | Y,U,V | Y,U,V | Y,U,V | ... One pixel is represented by 3 bytes. There is no padding between the pixels. Alpha channel is not used in the conversion.

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the start of the next row for the destination data. Must not be less than 3 * width, except for single-row images.
widthNumber of pixels in a row.
heightNumber of rows in the data.

◆ kleidicv_rotate()

kleidicv_error_t kleidicv_rotate ( const void *  src,
size_t  src_stride,
size_t  width,
size_t  height,
void *  dst,
size_t  dst_stride,
int  angle,
size_t  element_size 
)

Matrix rotate operation. In-place operation is not supported. Only supports 90 degrees clockwise rotate Example for src[3,2] to dst[2,3]:

| 0 | 1 | 2 | | 4 | 0 |
| 4 | 5 | 6 | -> | 5 | 1 |
| 6 | 2 |

Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null. Must be aligned to element_size.
src_strideDistance 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 and no less than width * element_size, except for single-row images.
widthNumber of columns in the source data.
heightNumber of rows in the source data.
dstPointer to the destination data. Must be non-null. Can be the same as source data for in-place operation. Must be aligned to element_size.
dst_strideDistance 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 and no less than height * element_size, except for single-column images.
angleDegrees to rotate clockwise. Must be 90.
element_sizeSize of one element in bytes. Must be 1, 2, 4 or 8.

◆ kleidicv_s8_to_f32()

kleidicv_error_t kleidicv_s8_to_f32 ( const int8_t *  src,
size_t  src_stride,
float *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Converts the elements in src from an integer type to a floating-point type, then stores the result in dst.

Each resulting element is saturated, i.e. it is the smallest/largest number of the type of the element if the src data type cannot be represented as the dst type. Source and destination data length is width * height. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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).
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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).
widthNumber of pixels in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_absdiff_s16()

kleidicv_error_t kleidicv_saturating_absdiff_s16 ( const int16_t *  src_a,
size_t  src_a_stride,
const int16_t *  src_b,
size_t  src_b_stride,
int16_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

From the corresponding elements in src_a and src_b, subtracts the lower one from the higher one, and puts the result into dst.

The subtraction is saturated, i.e. the result is the largest number of the type of the element if the result would overflow (it is only possible with signed types). Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_absdiff_s32()

kleidicv_error_t kleidicv_saturating_absdiff_s32 ( const int32_t *  src_a,
size_t  src_a_stride,
const int32_t *  src_b,
size_t  src_b_stride,
int32_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

From the corresponding elements in src_a and src_b, subtracts the lower one from the higher one, and puts the result into dst.

The subtraction is saturated, i.e. the result is the largest number of the type of the element if the result would overflow (it is only possible with signed types). Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_absdiff_s8()

kleidicv_error_t kleidicv_saturating_absdiff_s8 ( const int8_t *  src_a,
size_t  src_a_stride,
const int8_t *  src_b,
size_t  src_b_stride,
int8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

From the corresponding elements in src_a and src_b, subtracts the lower one from the higher one, and puts the result into dst.

The subtraction is saturated, i.e. the result is the largest number of the type of the element if the result would overflow (it is only possible with signed types). Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_absdiff_u16()

kleidicv_error_t kleidicv_saturating_absdiff_u16 ( const uint16_t *  src_a,
size_t  src_a_stride,
const uint16_t *  src_b,
size_t  src_b_stride,
uint16_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

From the corresponding elements in src_a and src_b, subtracts the lower one from the higher one, and puts the result into dst.

The subtraction is saturated, i.e. the result is the largest number of the type of the element if the result would overflow (it is only possible with signed types). Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_absdiff_u8()

kleidicv_error_t kleidicv_saturating_absdiff_u8 ( const uint8_t *  src_a,
size_t  src_a_stride,
const uint8_t *  src_b,
size_t  src_b_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

From the corresponding elements in src_a and src_b, subtracts the lower one from the higher one, and puts the result into dst.

The subtraction is saturated, i.e. the result is the largest number of the type of the element if the result would overflow (it is only possible with signed types). Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_add_abs_with_threshold_s16()

kleidicv_error_t kleidicv_saturating_add_abs_with_threshold_s16 ( const int16_t *  src_a,
size_t  src_a_stride,
const int16_t *  src_b,
size_t  src_b_stride,
int16_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
int16_t  threshold 
)

Adds the absolute values of the corresponding elements in src_a and src_b. Then, performs a comparison of each element's value in the result with respect to a caller defined threshold. The strictly larger elements remain unchanged and the rest are set to 0.

The addition is saturated, i.e. the result is the largest number of the type of the element if the addition result would overflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.
thresholdThe value that the elements of the addition result are compared to.

◆ kleidicv_saturating_add_s16()

kleidicv_error_t kleidicv_saturating_add_s16 ( const int16_t *  src_a,
size_t  src_a_stride,
const int16_t *  src_b,
size_t  src_b_stride,
int16_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Adds the values of the corresponding elements in src_a and src_b, and puts the result into dst.

The addition is saturated, i.e. the result is the largest number of the type of the element if the addition result would overflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_add_s32()

kleidicv_error_t kleidicv_saturating_add_s32 ( const int32_t *  src_a,
size_t  src_a_stride,
const int32_t *  src_b,
size_t  src_b_stride,
int32_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Adds the values of the corresponding elements in src_a and src_b, and puts the result into dst.

The addition is saturated, i.e. the result is the largest number of the type of the element if the addition result would overflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_add_s64()

kleidicv_error_t kleidicv_saturating_add_s64 ( const int64_t *  src_a,
size_t  src_a_stride,
const int64_t *  src_b,
size_t  src_b_stride,
int64_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Adds the values of the corresponding elements in src_a and src_b, and puts the result into dst.

The addition is saturated, i.e. the result is the largest number of the type of the element if the addition result would overflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_add_s8()

kleidicv_error_t kleidicv_saturating_add_s8 ( const int8_t *  src_a,
size_t  src_a_stride,
const int8_t *  src_b,
size_t  src_b_stride,
int8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Adds the values of the corresponding elements in src_a and src_b, and puts the result into dst.

The addition is saturated, i.e. the result is the largest number of the type of the element if the addition result would overflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_add_u16()

kleidicv_error_t kleidicv_saturating_add_u16 ( const uint16_t *  src_a,
size_t  src_a_stride,
const uint16_t *  src_b,
size_t  src_b_stride,
uint16_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Adds the values of the corresponding elements in src_a and src_b, and puts the result into dst.

The addition is saturated, i.e. the result is the largest number of the type of the element if the addition result would overflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_add_u32()

kleidicv_error_t kleidicv_saturating_add_u32 ( const uint32_t *  src_a,
size_t  src_a_stride,
const uint32_t *  src_b,
size_t  src_b_stride,
uint32_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Adds the values of the corresponding elements in src_a and src_b, and puts the result into dst.

The addition is saturated, i.e. the result is the largest number of the type of the element if the addition result would overflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_add_u64()

kleidicv_error_t kleidicv_saturating_add_u64 ( const uint64_t *  src_a,
size_t  src_a_stride,
const uint64_t *  src_b,
size_t  src_b_stride,
uint64_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Adds the values of the corresponding elements in src_a and src_b, and puts the result into dst.

The addition is saturated, i.e. the result is the largest number of the type of the element if the addition result would overflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_add_u8()

kleidicv_error_t kleidicv_saturating_add_u8 ( const uint8_t *  src_a,
size_t  src_a_stride,
const uint8_t *  src_b,
size_t  src_b_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Adds the values of the corresponding elements in src_a and src_b, and puts the result into dst.

The addition is saturated, i.e. the result is the largest number of the type of the element if the addition result would overflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_multiply_s16()

kleidicv_error_t kleidicv_saturating_multiply_s16 ( const int16_t *  src_a,
size_t  src_a_stride,
const int16_t *  src_b,
size_t  src_b_stride,
int16_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
double  scale 
)

Multiplies the values of the corresponding elements in src_a and src_b, and puts the result into dst.

The multiplication is saturated, i.e. the result is the largest number of the type of the element if the multiplication result would overflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.
scaleCurrently unused parameter.

◆ kleidicv_saturating_multiply_s32()

kleidicv_error_t kleidicv_saturating_multiply_s32 ( const int32_t *  src_a,
size_t  src_a_stride,
const int32_t *  src_b,
size_t  src_b_stride,
int32_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
double  scale 
)

Multiplies the values of the corresponding elements in src_a and src_b, and puts the result into dst.

The multiplication is saturated, i.e. the result is the largest number of the type of the element if the multiplication result would overflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.
scaleCurrently unused parameter.

◆ kleidicv_saturating_multiply_s8()

kleidicv_error_t kleidicv_saturating_multiply_s8 ( const int8_t *  src_a,
size_t  src_a_stride,
const int8_t *  src_b,
size_t  src_b_stride,
int8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
double  scale 
)

Multiplies the values of the corresponding elements in src_a and src_b, and puts the result into dst.

The multiplication is saturated, i.e. the result is the largest number of the type of the element if the multiplication result would overflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.
scaleCurrently unused parameter.

◆ kleidicv_saturating_multiply_u16()

kleidicv_error_t kleidicv_saturating_multiply_u16 ( const uint16_t *  src_a,
size_t  src_a_stride,
const uint16_t *  src_b,
size_t  src_b_stride,
uint16_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
double  scale 
)

Multiplies the values of the corresponding elements in src_a and src_b, and puts the result into dst.

The multiplication is saturated, i.e. the result is the largest number of the type of the element if the multiplication result would overflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.
scaleCurrently unused parameter.

◆ kleidicv_saturating_multiply_u8()

kleidicv_error_t kleidicv_saturating_multiply_u8 ( const uint8_t *  src_a,
size_t  src_a_stride,
const uint8_t *  src_b,
size_t  src_b_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
double  scale 
)

Multiplies the values of the corresponding elements in src_a and src_b, and puts the result into dst.

The multiplication is saturated, i.e. the result is the largest number of the type of the element if the multiplication result would overflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.
scaleCurrently unused parameter.

◆ kleidicv_saturating_sub_s16()

kleidicv_error_t kleidicv_saturating_sub_s16 ( const int16_t *  src_a,
size_t  src_a_stride,
const int16_t *  src_b,
size_t  src_b_stride,
int16_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Subtracts the value of the corresponding element in src_b from src_a, and puts the result into dst.

The subtraction is saturated, i.e. the result is 0 (unsigned) or the smallest possible value of the type of the element if the subtraction result would underflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_sub_s32()

kleidicv_error_t kleidicv_saturating_sub_s32 ( const int32_t *  src_a,
size_t  src_a_stride,
const int32_t *  src_b,
size_t  src_b_stride,
int32_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Subtracts the value of the corresponding element in src_b from src_a, and puts the result into dst.

The subtraction is saturated, i.e. the result is 0 (unsigned) or the smallest possible value of the type of the element if the subtraction result would underflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_sub_s64()

kleidicv_error_t kleidicv_saturating_sub_s64 ( const int64_t *  src_a,
size_t  src_a_stride,
const int64_t *  src_b,
size_t  src_b_stride,
int64_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Subtracts the value of the corresponding element in src_b from src_a, and puts the result into dst.

The subtraction is saturated, i.e. the result is 0 (unsigned) or the smallest possible value of the type of the element if the subtraction result would underflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_sub_s8()

kleidicv_error_t kleidicv_saturating_sub_s8 ( const int8_t *  src_a,
size_t  src_a_stride,
const int8_t *  src_b,
size_t  src_b_stride,
int8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Subtracts the value of the corresponding element in src_b from src_a, and puts the result into dst.

The subtraction is saturated, i.e. the result is 0 (unsigned) or the smallest possible value of the type of the element if the subtraction result would underflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_sub_u16()

kleidicv_error_t kleidicv_saturating_sub_u16 ( const uint16_t *  src_a,
size_t  src_a_stride,
const uint16_t *  src_b,
size_t  src_b_stride,
uint16_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Subtracts the value of the corresponding element in src_b from src_a, and puts the result into dst.

The subtraction is saturated, i.e. the result is 0 (unsigned) or the smallest possible value of the type of the element if the subtraction result would underflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_sub_u32()

kleidicv_error_t kleidicv_saturating_sub_u32 ( const uint32_t *  src_a,
size_t  src_a_stride,
const uint32_t *  src_b,
size_t  src_b_stride,
uint32_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Subtracts the value of the corresponding element in src_b from src_a, and puts the result into dst.

The subtraction is saturated, i.e. the result is 0 (unsigned) or the smallest possible value of the type of the element if the subtraction result would underflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_sub_u64()

kleidicv_error_t kleidicv_saturating_sub_u64 ( const uint64_t *  src_a,
size_t  src_a_stride,
const uint64_t *  src_b,
size_t  src_b_stride,
uint64_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Subtracts the value of the corresponding element in src_b from src_a, and puts the result into dst.

The subtraction is saturated, i.e. the result is 0 (unsigned) or the smallest possible value of the type of the element if the subtraction result would underflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_saturating_sub_u8()

kleidicv_error_t kleidicv_saturating_sub_u8 ( const uint8_t *  src_a,
size_t  src_a_stride,
const uint8_t *  src_b,
size_t  src_b_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Subtracts the value of the corresponding element in src_b from src_a, and puts the result into dst.

The subtraction is saturated, i.e. the result is 0 (unsigned) or the smallest possible value of the type of the element if the subtraction result would underflow. Source data length (in bytes) is stride * height. Width and height are the same for the two sources and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_aPointer to the first source data. Must be non-null.
src_a_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
src_bPointer to the second source data. Must be non-null.
src_b_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.

◆ kleidicv_scale_f32()

kleidicv_error_t kleidicv_scale_f32 ( const float *  src,
size_t  src_stride,
float *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
float  scale,
float  shift 
)

Multiplies the elements in src by scale, then adds shift to the result and stores it in dst.

The result is saturated, i.e. it is the smallest/largest number of the type of the element if the result would underflow/overflow. Source data length (in bytes) is stride * height. Width and height are the same for the source and destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.
scaleValue to multiply the input by.
shiftValue to add to the result.

◆ kleidicv_scale_u8()

kleidicv_error_t kleidicv_scale_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
float  scale,
float  shift 
)

Multiplies the elements in src by scale, then adds shift to the result and stores it in dst.

The result is saturated, i.e. it is the smallest/largest number of the type of the element if the result would underflow/overflow. Source data length (in bytes) is stride * height. Width and height are the same for the source and destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.
scaleValue to multiply the input by.
shiftValue to add to the result.

◆ kleidicv_separable_filter_2d_s16()

kleidicv_error_t kleidicv_separable_filter_2d_s16 ( const int16_t *  src,
size_t  src_stride,
int16_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
size_t  channels,
const int16_t *  kernel_x,
size_t  kernel_width,
const int16_t *  kernel_y,
size_t  kernel_height,
kleidicv_border_type_t  border_type,
kleidicv_filter_context_t context 
)

Applies a two-dimensional separable filter to the source image using the specified parameters. In-place filtering is not supported.

Width and height are assumed to be the same for the source and for the destination. The number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Usage:

Before using this function, a context must be created using kleidicv_filter_context_create, and when finished, it has to be released using kleidicv_filter_context_release. Please ensure that your filter context parameters are large enough, otherwise this API will return with an error.

Note, from the border types only KLEIDICV_BORDER_TYPE_REPLICATE is supported.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the 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.
widthNumber of columns in the data. (One column consists of channels number of elements.) Must be greater than or equal to kernel_width - 1.
heightNumber of rows in the data. Must be greater than or equal to kernel_height - 1.
channelsNumber of channels in the data. Must be not more than KLEIDICV_MAXIMUM_CHANNEL_COUNT.
kernel_xPointer to the horizontal 2D kernel values.
kernel_widthSize of the horizontal 2D kernel.
kernel_yPointer to the vertical 2D kernel values.
kernel_heightSize of the vertical 2D kernel.
border_typeWay of handling the border.
contextPointer to filter context.

◆ kleidicv_separable_filter_2d_u16()

kleidicv_error_t kleidicv_separable_filter_2d_u16 ( const uint16_t *  src,
size_t  src_stride,
uint16_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
size_t  channels,
const uint16_t *  kernel_x,
size_t  kernel_width,
const uint16_t *  kernel_y,
size_t  kernel_height,
kleidicv_border_type_t  border_type,
kleidicv_filter_context_t context 
)

Applies a two-dimensional separable filter to the source image using the specified parameters. In-place filtering is not supported.

Width and height are assumed to be the same for the source and for the destination. The number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Usage:

Before using this function, a context must be created using kleidicv_filter_context_create, and when finished, it has to be released using kleidicv_filter_context_release. Please ensure that your filter context parameters are large enough, otherwise this API will return with an error.

Note, from the border types only KLEIDICV_BORDER_TYPE_REPLICATE is supported.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the 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.
widthNumber of columns in the data. (One column consists of channels number of elements.) Must be greater than or equal to kernel_width - 1.
heightNumber of rows in the data. Must be greater than or equal to kernel_height - 1.
channelsNumber of channels in the data. Must be not more than KLEIDICV_MAXIMUM_CHANNEL_COUNT.
kernel_xPointer to the horizontal 2D kernel values.
kernel_widthSize of the horizontal 2D kernel.
kernel_yPointer to the vertical 2D kernel values.
kernel_heightSize of the vertical 2D kernel.
border_typeWay of handling the border.
contextPointer to filter context.

◆ kleidicv_separable_filter_2d_u8()

kleidicv_error_t kleidicv_separable_filter_2d_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
size_t  channels,
const uint8_t *  kernel_x,
size_t  kernel_width,
const uint8_t *  kernel_y,
size_t  kernel_height,
kleidicv_border_type_t  border_type,
kleidicv_filter_context_t context 
)

Applies a two-dimensional separable filter to the source image using the specified parameters. In-place filtering is not supported.

Width and height are assumed to be the same for the source and for the destination. The number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Usage:

Before using this function, a context must be created using kleidicv_filter_context_create, and when finished, it has to be released using kleidicv_filter_context_release. Please ensure that your filter context parameters are large enough, otherwise this API will return with an error.

Note, from the border types only KLEIDICV_BORDER_TYPE_REPLICATE is supported.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the 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.
widthNumber of columns in the data. (One column consists of channels number of elements.) Must be greater than or equal to kernel_width - 1.
heightNumber of rows in the data. Must be greater than or equal to kernel_height - 1.
channelsNumber of channels in the data. Must be not more than KLEIDICV_MAXIMUM_CHANNEL_COUNT.
kernel_xPointer to the horizontal 2D kernel values.
kernel_widthSize of the horizontal 2D kernel.
kernel_yPointer to the vertical 2D kernel values.
kernel_heightSize of the vertical 2D kernel.
border_typeWay of handling the border.
contextPointer to filter context.

◆ kleidicv_sobel_3x3_horizontal_s16_u8()

kleidicv_error_t kleidicv_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 
)

Calculates horizontal derivative approximation with Sobel filter.

The used convolution kernel is:

[ 1 0 -1 ]
[ 2 0 -2 ]
[ 1 0 -1 ]

Note, that the kernel is mirrored both vertically and horizontally during the convolution.

The only supported border type is KLEIDICV_BORDER_TYPE_REPLICATE

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the 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.
widthNumber of columns in the data. (One column consists of channels number of elements.) Must be greater than or equal to kernel size (== 3) - 1.
heightNumber of rows in the data. Must be greater than or equal to kernel size (== 3) - 1.
channelsNumber of channels in the data. Must be not more than KLEIDICV_MAXIMUM_CHANNEL_COUNT.

◆ kleidicv_sobel_3x3_vertical_s16_u8()

kleidicv_error_t kleidicv_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 
)

Calculates vertical derivative approximation with Sobel filter.

The used convolution kernel is:

[ 1 2 1 ]
[ 0 0 0 ]
[ -1 -2 -1 ]

Note, that the kernel is mirrored both vertically and horizontally during the convolution.

The only supported border type is KLEIDICV_BORDER_TYPE_REPLICATE

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
dstPointer to the destination data. Must be non-null.
dst_strideDistance in bytes from the start of one row to the 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.
widthNumber of columns in the data. (One column consists of channels number of elements.) Must be greater than or equal to kernel size (== 3) - 1.
heightNumber of rows in the data. Must be greater than or equal to kernel size (== 3) - 1.
channelsNumber of channels in the data. Must be not more than KLEIDICV_MAXIMUM_CHANNEL_COUNT.

◆ kleidicv_split()

kleidicv_error_t kleidicv_split ( const void *  src_data,
size_t  src_stride,
void **  dst_data,
const size_t *  dst_strides,
size_t  width,
size_t  height,
size_t  channels,
size_t  element_size 
)

Splits a multi channel source stream into separate 1-channel streams. Width and height are the same for the source stream and for all the destination streams. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_dataPointer to the source data. Must be non-null. Must be aligned to element_size.
src_strideDistance in bytes from the start of one row to the 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.
dst_dataA 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. All pointers must be aligned to element_size.
dst_stridesA C style array of stride values for the destination streams. A stride value represents the distance in bytes from the start of one row to the start of the 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 no less than width * element_size, except for single-row images.
widthNumber of pixels in one row of the source data. (One pixel consists of channels number of elements.)
heightNumber of rows in the source data.
channelsNumber of channels in the source data. Must be 2, 3 or 4.
element_sizeSize of one element in bytes. Must be 1, 2, 4 or 8.

◆ kleidicv_sum_f32()

kleidicv_error_t kleidicv_sum_f32 ( const float *  src,
size_t  src_stride,
size_t  width,
size_t  height,
float *  sum 
)

Returns the sum of element values across the source data.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the 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.
widthNumber of elements in a row.
heightNumber of rows in the data.
sumPointer to save the sum value to. Must be non-null.

◆ kleidicv_threshold_binary_u8()

kleidicv_error_t kleidicv_threshold_binary_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
uint8_t  threshold,
uint8_t  value 
)

Performs a comparison of each element's value in src with respect to a caller defined threshold. The strictly larger elements are set to value and the rest to 0.

Width and height are the same for the source and for the destination. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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), except for single-row images.
dstPointer to the first destination data. Must be non-null.
dst_strideDistance 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), except for single-row images.
widthNumber of elements in a row.
heightNumber of rows in the data.
thresholdThe value that the elements of the source data are compared to.
valueThe value that the larger elements are set to.

◆ kleidicv_transpose()

kleidicv_error_t kleidicv_transpose ( const void *  src,
size_t  src_stride,
void *  dst,
size_t  dst_stride,
size_t  src_width,
size_t  src_height,
size_t  element_size 
)

Matrix transpose operation. In-place transpose (src == dst) is only supported for square matrixes (src_width == src_height).

Example for src[4,3] to dst[3,4]:

| 0 | 2 | 2 | 2 | | 0 | 1 | 1 |
| 1 | 0 | 2 | 2 | -> | 2 | 0 | 1 |
| 1 | 1 | 0 | 0 | | 2 | 2 | 0 |
| 2 | 2 | 2 |

Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null. Must be aligned to element_size.
src_strideDistance 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 and no less than width * element_size, except for single-row images.
dstPointer to the destination data. Must be non-null. Can be the same as source data for in-place operation. Must be aligned to element_size.
dst_strideDistance 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 and no less than height * element_size, except for single-column images.
src_widthNumber of elements in a row.
src_heightNumber of rows in the data.
element_sizeSize of one element in bytes. Must be 1, 2, 4 or 8.

◆ kleidicv_u8_to_f32()

kleidicv_error_t kleidicv_u8_to_f32 ( const uint8_t *  src,
size_t  src_stride,
float *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Converts the elements in src from an integer type to a floating-point type, then stores the result in dst.

Each resulting element is saturated, i.e. it is the smallest/largest number of the type of the element if the src data type cannot be represented as the dst type. Source and destination data length is width * height. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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).
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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).
widthNumber of pixels in a row.
heightNumber of rows in the data.

◆ kleidicv_warp_perspective_u8()

kleidicv_error_t kleidicv_warp_perspective_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,
const float  transformation[9],
size_t  channels,
kleidicv_interpolation_type_t  interpolation,
kleidicv_border_type_t  border_type,
const uint8_t *  border_value 
)

Performs a perspective transformation on an image. For each pixel in dst take a pixel from src specified by the transformed x and y coordinates, and optionally doing a bilinear interpolation.

src and dst dimensions may be different. Number of elements is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance 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), except for single-row images. Must be less than 2^32.
src_widthNumber of elements in the source row. Must be less than 2^24.
src_heightNumber of rows in the source data. Must be less than 2^24.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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) and no less than width * sizeof(type), except for single-row images.
dst_widthNumber of elements in the destination row. Must be at least 8. Must be less than 2^24.
dst_heightNumber of rows in the destination data. Must be less than 2^24.
transformationPointer to the transformation matrix of 9 values.
channelsNumber of channels in the data. Must be 1.
interpolationInterpolation algorithm. Supported types:
border_typeWay of handling the border. The supported border types are:
border_valueBorder value if the border_type is KLEIDICV_BORDER_TYPE_CONSTANT.

◆ kleidicv_yuv_p_to_bgr_u8()

kleidicv_error_t kleidicv_yuv_p_to_bgr_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
bool  is_yv12 
)

Converts a planar YUV420 image (I420 or YV12 layout) to RGB, RGBA, BGR, or BGRA format. All channels are 8-bit wide. If the output format includes an alpha channel, the alpha value is set to 0xFF.

Source format: Planar YUV420 The input buffer consists of three planes stored sequentially in memory:

  • Y plane: full resolution, size = width × height
  • U plane: quarter resolution, size = (width / 2) × (height / 2)
  • V plane: quarter resolution, size = (width / 2) × (height / 2)

Destination format Destination data uses interleaved pixel layout with 3 or 4 channels per pixel:

  • R, G, B
  • B, G, R
  • R, G, B, Alpha
  • B, G, R, Alpha

One pixel occupies 3 or 4 bytes, depending on the format.

Width and height refer to the logical image dimensions, i.e., number of pixels per row and number of rows. The total number of pixels must not exceed KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source buffer containing Y + U + V or Y + V + U in sequential planes. Must be non-null.
src_strideByte offset between the start of one row in the Y plane of the output and the next. Must be at least width. This same stride is reused to compute row stepping in the U and V planes, which are stored sequentially after the Y plane. Their row stepping alternates between these two values: uvsteps[2] = { width / 2, dst_stride - width / 2 }.
dstPointer to the destination data. Must be non-null.
dst_strideByte offset between the start of one destination row and the next. Must be at least (destination channel count) * width, unless the image has only one row.
widthNumber of pixels in a row.
heightNumber of rows in the data.
is_yv12If true, treat the layout as YV12 (Y + V + U). Otherwise, I420 (Y + U + V).

◆ kleidicv_yuv_p_to_bgra_u8()

kleidicv_error_t kleidicv_yuv_p_to_bgra_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
bool  is_yv12 
)

Converts a planar YUV420 image (I420 or YV12 layout) to RGB, RGBA, BGR, or BGRA format. All channels are 8-bit wide. If the output format includes an alpha channel, the alpha value is set to 0xFF.

Source format: Planar YUV420 The input buffer consists of three planes stored sequentially in memory:

  • Y plane: full resolution, size = width × height
  • U plane: quarter resolution, size = (width / 2) × (height / 2)
  • V plane: quarter resolution, size = (width / 2) × (height / 2)

Destination format Destination data uses interleaved pixel layout with 3 or 4 channels per pixel:

  • R, G, B
  • B, G, R
  • R, G, B, Alpha
  • B, G, R, Alpha

One pixel occupies 3 or 4 bytes, depending on the format.

Width and height refer to the logical image dimensions, i.e., number of pixels per row and number of rows. The total number of pixels must not exceed KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source buffer containing Y + U + V or Y + V + U in sequential planes. Must be non-null.
src_strideByte offset between the start of one row in the Y plane of the output and the next. Must be at least width. This same stride is reused to compute row stepping in the U and V planes, which are stored sequentially after the Y plane. Their row stepping alternates between these two values: uvsteps[2] = { width / 2, dst_stride - width / 2 }.
dstPointer to the destination data. Must be non-null.
dst_strideByte offset between the start of one destination row and the next. Must be at least (destination channel count) * width, unless the image has only one row.
widthNumber of pixels in a row.
heightNumber of rows in the data.
is_yv12If true, treat the layout as YV12 (Y + V + U). Otherwise, I420 (Y + U + V).

◆ kleidicv_yuv_p_to_rgb_u8()

kleidicv_error_t kleidicv_yuv_p_to_rgb_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
bool  is_yv12 
)

Converts a planar YUV420 image (I420 or YV12 layout) to RGB, RGBA, BGR, or BGRA format. All channels are 8-bit wide. If the output format includes an alpha channel, the alpha value is set to 0xFF.

Source format: Planar YUV420 The input buffer consists of three planes stored sequentially in memory:

  • Y plane: full resolution, size = width × height
  • U plane: quarter resolution, size = (width / 2) × (height / 2)
  • V plane: quarter resolution, size = (width / 2) × (height / 2)

Destination format Destination data uses interleaved pixel layout with 3 or 4 channels per pixel:

  • R, G, B
  • B, G, R
  • R, G, B, Alpha
  • B, G, R, Alpha

One pixel occupies 3 or 4 bytes, depending on the format.

Width and height refer to the logical image dimensions, i.e., number of pixels per row and number of rows. The total number of pixels must not exceed KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source buffer containing Y + U + V or Y + V + U in sequential planes. Must be non-null.
src_strideByte offset between the start of one row in the Y plane of the output and the next. Must be at least width. This same stride is reused to compute row stepping in the U and V planes, which are stored sequentially after the Y plane. Their row stepping alternates between these two values: uvsteps[2] = { width / 2, dst_stride - width / 2 }.
dstPointer to the destination data. Must be non-null.
dst_strideByte offset between the start of one destination row and the next. Must be at least (destination channel count) * width, unless the image has only one row.
widthNumber of pixels in a row.
heightNumber of rows in the data.
is_yv12If true, treat the layout as YV12 (Y + V + U). Otherwise, I420 (Y + U + V).

◆ kleidicv_yuv_p_to_rgba_u8()

kleidicv_error_t kleidicv_yuv_p_to_rgba_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
bool  is_yv12 
)

Converts a planar YUV420 image (I420 or YV12 layout) to RGB, RGBA, BGR, or BGRA format. All channels are 8-bit wide. If the output format includes an alpha channel, the alpha value is set to 0xFF.

Source format: Planar YUV420 The input buffer consists of three planes stored sequentially in memory:

  • Y plane: full resolution, size = width × height
  • U plane: quarter resolution, size = (width / 2) × (height / 2)
  • V plane: quarter resolution, size = (width / 2) × (height / 2)

Destination format Destination data uses interleaved pixel layout with 3 or 4 channels per pixel:

  • R, G, B
  • B, G, R
  • R, G, B, Alpha
  • B, G, R, Alpha

One pixel occupies 3 or 4 bytes, depending on the format.

Width and height refer to the logical image dimensions, i.e., number of pixels per row and number of rows. The total number of pixels must not exceed KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source buffer containing Y + U + V or Y + V + U in sequential planes. Must be non-null.
src_strideByte offset between the start of one row in the Y plane of the output and the next. Must be at least width. This same stride is reused to compute row stepping in the U and V planes, which are stored sequentially after the Y plane. Their row stepping alternates between these two values: uvsteps[2] = { width / 2, dst_stride - width / 2 }.
dstPointer to the destination data. Must be non-null.
dst_strideByte offset between the start of one destination row and the next. Must be at least (destination channel count) * width, unless the image has only one row.
widthNumber of pixels in a row.
heightNumber of rows in the data.
is_yv12If true, treat the layout as YV12 (Y + V + U). Otherwise, I420 (Y + U + V).

◆ kleidicv_yuv_sp_to_bgr_u8()

kleidicv_error_t kleidicv_yuv_sp_to_bgr_u8 ( const uint8_t *  src_y,
size_t  src_y_stride,
const uint8_t *  src_uv,
size_t  src_uv_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
bool  is_nv21 
)

Converts an NV12 or NV21 (Semi-Planar) YUV image to BGR. All channels are 8-bit wide.

Destination data is filled liked this: | B,G,R | B,G,R | B,G,R | ... Where each letter represents one byte of data, and one pixel is represented by 3 bytes. There is no padding between the pixels. If 4-byte alignment is required then kleidicv_yuv_sp_to_bgra_u8 can be used.

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_yPointer to the input's Y component. Must be non-null.
src_y_strideDistance 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), except for single-row images.
src_uvPointer 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.
src_uv_strideDistance 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), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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), except for single-row images.
widthNumber of pixels in a row.
heightNumber of rows in the data.
is_nv21If true, input is treated as NV21, otherwise treated as NV12.

◆ kleidicv_yuv_sp_to_bgra_u8()

kleidicv_error_t kleidicv_yuv_sp_to_bgra_u8 ( const uint8_t *  src_y,
size_t  src_y_stride,
const uint8_t *  src_uv,
size_t  src_uv_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
bool  is_nv21 
)

Converts an NV12 or NV21 (Semi-Planar) YUV image to BGRA. All channels are 8-bit wide. Alpha channel is set to 0xFF.

Destination data is filled liked this: | B,G,R,A | B,G,R,A | B,G,R,A | ... Where each letter represents one byte of data, and one pixel is represented by 4 bytes. There is no padding between the pixels.

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_yPointer to the input's Y component. Must be non-null.
src_y_strideDistance 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), except for single-row images.
src_uvPointer 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.
src_uv_strideDistance 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), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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), except for single-row images.
widthNumber of pixels in a row.
heightNumber of rows in the data.
is_nv21If true, input is treated as NV21, otherwise treated as NV12.

◆ kleidicv_yuv_sp_to_rgb_u8()

kleidicv_error_t kleidicv_yuv_sp_to_rgb_u8 ( const uint8_t *  src_y,
size_t  src_y_stride,
const uint8_t *  src_uv,
size_t  src_uv_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
bool  is_nv21 
)

Converts an NV12 or NV21 (Semi-Planar) YUV image to RGB. All channels are 8-bit wide.

Destination data is filled liked this: | R,G,B | R,G,B | R,G,B | ... Where each letter represents one byte of data, and one pixel is represented by 3 bytes. There is no padding between the pixels. If 4-byte alignment is required then kleidicv_yuv_sp_to_rgba_u8 can be used.

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_yPointer to the input's Y component. Must be non-null.
src_y_strideDistance 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), except for single-row images.
src_uvPointer 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.
src_uv_strideDistance 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), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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), except for single-row images.
widthNumber of pixels in a row.
heightNumber of rows in the data.
is_nv21If true, input is treated as NV21, otherwise treated as NV12.

◆ kleidicv_yuv_sp_to_rgba_u8()

kleidicv_error_t kleidicv_yuv_sp_to_rgba_u8 ( const uint8_t *  src_y,
size_t  src_y_stride,
const uint8_t *  src_uv,
size_t  src_uv_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height,
bool  is_nv21 
)

Converts an NV12 or NV21 (Semi-Planar) YUV image to RGBA. All channels are 8-bit wide. Alpha channel is set to 0xFF.

Destination data is filled liked this: | R,G,B,A | R,G,B,A | R,G,B,A | ... Where each letter represents one byte of data, and one pixel is represented by 4 bytes. There is no padding between the pixels.

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
src_yPointer to the input's Y component. Must be non-null.
src_y_strideDistance 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), except for single-row images.
src_uvPointer 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.
src_uv_strideDistance 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), except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideDistance 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), except for single-row images.
widthNumber of pixels in a row.
heightNumber of rows in the data.
is_nv21If true, input is treated as NV21, otherwise treated as NV12.

◆ kleidicv_yuv_to_bgr_u8()

kleidicv_error_t kleidicv_yuv_to_bgr_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Converts a YUV image to RGB or RGBA, pixel by pixel. All channels are 8-bit wide.

Source data has 3 channels like this: | Y,U,V | Y,U,V | Y,U,V | ... One pixel is represented by 3 bytes. There is no padding between the pixels.

Destination data has 3 or 4 channels:

  • R,G,B
  • B,G,R
  • R,G,B,Alpha
  • B,G,R,Alpha

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the start of the next row for the source data. Must not be less than 3 * width, except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideByte offset between the start of one destination row and the next. Must be at least (destination channel count) * width, unless the image has only one row.
widthNumber of pixels in a row.
heightNumber of rows in the data.

◆ kleidicv_yuv_to_bgra_u8()

kleidicv_error_t kleidicv_yuv_to_bgra_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Converts a YUV image to RGB or RGBA, pixel by pixel. All channels are 8-bit wide.

Source data has 3 channels like this: | Y,U,V | Y,U,V | Y,U,V | ... One pixel is represented by 3 bytes. There is no padding between the pixels.

Destination data has 3 or 4 channels:

  • R,G,B
  • B,G,R
  • R,G,B,Alpha
  • B,G,R,Alpha

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the start of the next row for the source data. Must not be less than 3 * width, except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideByte offset between the start of one destination row and the next. Must be at least (destination channel count) * width, unless the image has only one row.
widthNumber of pixels in a row.
heightNumber of rows in the data.

◆ kleidicv_yuv_to_rgb_u8()

kleidicv_error_t kleidicv_yuv_to_rgb_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Converts a YUV image to RGB or RGBA, pixel by pixel. All channels are 8-bit wide.

Source data has 3 channels like this: | Y,U,V | Y,U,V | Y,U,V | ... One pixel is represented by 3 bytes. There is no padding between the pixels.

Destination data has 3 or 4 channels:

  • R,G,B
  • B,G,R
  • R,G,B,Alpha
  • B,G,R,Alpha

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the start of the next row for the source data. Must not be less than 3 * width, except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideByte offset between the start of one destination row and the next. Must be at least (destination channel count) * width, unless the image has only one row.
widthNumber of pixels in a row.
heightNumber of rows in the data.

◆ kleidicv_yuv_to_rgba_u8()

kleidicv_error_t kleidicv_yuv_to_rgba_u8 ( const uint8_t *  src,
size_t  src_stride,
uint8_t *  dst,
size_t  dst_stride,
size_t  width,
size_t  height 
)

Converts a YUV image to RGB or RGBA, pixel by pixel. All channels are 8-bit wide.

Source data has 3 channels like this: | Y,U,V | Y,U,V | Y,U,V | ... One pixel is represented by 3 bytes. There is no padding between the pixels.

Destination data has 3 or 4 channels:

  • R,G,B
  • B,G,R
  • R,G,B,Alpha
  • B,G,R,Alpha

Width and height are the same for the source and for the destination. Number of pixels is limited to KLEIDICV_MAX_IMAGE_PIXELS.

Parameters
srcPointer to the source data. Must be non-null.
src_strideDistance in bytes from the start of one row to the start of the next row for the source data. Must not be less than 3 * width, except for single-row images.
dstPointer to the destination data. Must be non-null.
dst_strideByte offset between the start of one destination row and the next. Must be at least (destination channel count) * width, unless the image has only one row.
widthNumber of pixels in a row.
heightNumber of rows in the data.