Line | Branch | Exec | Source |
---|---|---|---|
1 | // SPDX-FileCopyrightText: 2023 - 2025 Arm Limited and/or its affiliates <open-source-office@arm.com> | ||
2 | // | ||
3 | // SPDX-License-Identifier: Apache-2.0 | ||
4 | |||
5 | #ifndef KLEIDICV_FILTERS_SOBEL_H | ||
6 | #define KLEIDICV_FILTERS_SOBEL_H | ||
7 | |||
8 | #include "kleidicv/kleidicv.h" | ||
9 | |||
10 | extern "C" { | ||
11 | // For internal use only. See instead kleidicv_sobel_3x3_horizontal_s16_u8. | ||
12 | // Filter a horizontal stripe across an image. The stripe is defined by the | ||
13 | // range (y_begin, y_end]. | ||
14 | KLEIDICV_API_DECLARATION(kleidicv_sobel_3x3_horizontal_stripe_s16_u8, | ||
15 | const uint8_t *src, size_t src_stride, int16_t *dst, | ||
16 | size_t dst_stride, size_t width, size_t height, | ||
17 | size_t y_begin, size_t y_end, size_t channels); | ||
18 | // For internal use only. See instead kleidicv_sobel_3x3_vertical_s16_u8. | ||
19 | // Filter a horizontal stripe across an image. The stripe is defined by the | ||
20 | // range (y_begin, y_end]. | ||
21 | KLEIDICV_API_DECLARATION(kleidicv_sobel_3x3_vertical_stripe_s16_u8, | ||
22 | const uint8_t *src, size_t src_stride, int16_t *dst, | ||
23 | size_t dst_stride, size_t width, size_t height, | ||
24 | size_t y_begin, size_t y_end, size_t channels); | ||
25 | } | ||
26 | |||
27 | namespace kleidicv { | ||
28 | |||
29 | 768 | inline bool sobel_is_implemented(size_t width, size_t height, | |
30 | size_t kernel_size) { | ||
31 |
2/2✓ Branch 0 taken 270 times.
✓ Branch 1 taken 498 times.
|
768 | return width >= kernel_size - 1 && height >= kernel_size - 1; |
32 | } | ||
33 | |||
34 | namespace neon { | ||
35 | kleidicv_error_t sobel_3x3_horizontal_stripe_s16_u8( | ||
36 | const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, | ||
37 | size_t width, size_t height, size_t y_begin, size_t y_end, size_t channels); | ||
38 | kleidicv_error_t sobel_3x3_vertical_stripe_s16_u8( | ||
39 | const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, | ||
40 | size_t width, size_t height, size_t y_begin, size_t y_end, size_t channels); | ||
41 | } // namespace neon | ||
42 | |||
43 | namespace sve2 { | ||
44 | kleidicv_error_t sobel_3x3_horizontal_stripe_s16_u8( | ||
45 | const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, | ||
46 | size_t width, size_t height, size_t y_begin, size_t y_end, size_t channels); | ||
47 | kleidicv_error_t sobel_3x3_vertical_stripe_s16_u8( | ||
48 | const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, | ||
49 | size_t width, size_t height, size_t y_begin, size_t y_end, size_t channels); | ||
50 | } // namespace sve2 | ||
51 | |||
52 | namespace sme { | ||
53 | kleidicv_error_t sobel_3x3_horizontal_stripe_s16_u8( | ||
54 | const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, | ||
55 | size_t width, size_t height, size_t y_begin, size_t y_end, size_t channels); | ||
56 | kleidicv_error_t sobel_3x3_vertical_stripe_s16_u8( | ||
57 | const uint8_t *src, size_t src_stride, int16_t *dst, size_t dst_stride, | ||
58 | size_t width, size_t height, size_t y_begin, size_t y_end, size_t channels); | ||
59 | } // namespace sme | ||
60 | |||
61 | } // namespace kleidicv | ||
62 | |||
63 | #endif // KLEIDICV_FILTERS_SOBEL_H | ||
64 |