| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // SPDX-FileCopyrightText: 2024 Arm Limited and/or its affiliates <open-source-office@arm.com> | ||
| 2 | // | ||
| 3 | // SPDX-License-Identifier: Apache-2.0 | ||
| 4 | |||
| 5 | #ifndef KLEIDICV_FILTERS_SEPARABLE_FILTER_2D_H | ||
| 6 | #define KLEIDICV_FILTERS_SEPARABLE_FILTER_2D_H | ||
| 7 | |||
| 8 | #include "kleidicv/config.h" | ||
| 9 | #include "kleidicv/kleidicv.h" | ||
| 10 | #include "kleidicv/types.h" | ||
| 11 | #include "kleidicv/workspace/border_types.h" | ||
| 12 | |||
| 13 | extern "C" { | ||
| 14 | // For internal use only. See instead kleidicv_separable_filter_2d_u8. | ||
| 15 | // Filter a horizontal stripe across an image. The stripe is defined by the | ||
| 16 | // range (y_begin, y_end]. | ||
| 17 | KLEIDICV_API_DECLARATION(kleidicv_separable_filter_2d_stripe_u8, | ||
| 18 | const uint8_t *src, size_t src_stride, uint8_t *dst, | ||
| 19 | size_t dst_stride, size_t width, size_t height, | ||
| 20 | size_t y_begin, size_t y_end, size_t channels, | ||
| 21 | const uint8_t *kernel_x, size_t kernel_width, | ||
| 22 | const uint8_t *kernel_y, size_t kernel_height, | ||
| 23 | kleidicv::FixedBorderType border_type, | ||
| 24 | kleidicv_filter_context_t *context); | ||
| 25 | // For internal use only. See instead kleidicv_separable_filter_2d_u16. | ||
| 26 | // Filter a horizontal stripe across an image. The stripe is defined by the | ||
| 27 | // range (y_begin, y_end]. | ||
| 28 | KLEIDICV_API_DECLARATION(kleidicv_separable_filter_2d_stripe_u16, | ||
| 29 | const uint16_t *src, size_t src_stride, uint16_t *dst, | ||
| 30 | size_t dst_stride, size_t width, size_t height, | ||
| 31 | size_t y_begin, size_t y_end, size_t channels, | ||
| 32 | const uint16_t *kernel_x, size_t kernel_width, | ||
| 33 | const uint16_t *kernel_y, size_t kernel_height, | ||
| 34 | kleidicv::FixedBorderType border_type, | ||
| 35 | kleidicv_filter_context_t *context); | ||
| 36 | // For internal use only. See instead kleidicv_separable_filter_2d_s16. | ||
| 37 | // Filter a horizontal stripe across an image. The stripe is defined by the | ||
| 38 | // range (y_begin, y_end]. | ||
| 39 | KLEIDICV_API_DECLARATION(kleidicv_separable_filter_2d_stripe_s16, | ||
| 40 | const int16_t *src, size_t src_stride, int16_t *dst, | ||
| 41 | size_t dst_stride, size_t width, size_t height, | ||
| 42 | size_t y_begin, size_t y_end, size_t channels, | ||
| 43 | const int16_t *kernel_x, size_t kernel_width, | ||
| 44 | const int16_t *kernel_y, size_t kernel_height, | ||
| 45 | kleidicv::FixedBorderType border_type, | ||
| 46 | kleidicv_filter_context_t *context); | ||
| 47 | } | ||
| 48 | |||
| 49 | namespace kleidicv { | ||
| 50 | |||
| 51 | 1328 | inline bool separable_filter_2d_is_implemented(size_t width, size_t height, | |
| 52 | size_t kernel_width, | ||
| 53 | size_t kernel_height) { | ||
| 54 |
4/4✓ Branch 0 taken 1316 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 12 times.
✓ Branch 3 taken 1304 times.
|
1328 | if (kernel_width != 5 || kernel_height != 5) { |
| 55 | 24 | return false; | |
| 56 | } | ||
| 57 | |||
| 58 |
4/4✓ Branch 0 taken 824 times.
✓ Branch 1 taken 480 times.
✓ Branch 2 taken 24 times.
✓ Branch 3 taken 800 times.
|
1304 | if (width < kernel_width - 1 || height < kernel_width - 1) { |
| 59 | 504 | return false; | |
| 60 | } | ||
| 61 | |||
| 62 | 800 | return true; | |
| 63 | 1328 | } | |
| 64 | |||
| 65 | } // namespace kleidicv | ||
| 66 | |||
| 67 | #endif // KLEIDICV_FILTERS_SEPARABLE_FILTER_2D_H | ||
| 68 |