| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // SPDX-FileCopyrightText: 2024 - 2026 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 | // For internal use only. See instead kleidicv_separable_filter_2d_u16. | ||
| 25 | // Filter a horizontal stripe across an image. The stripe is defined by the | ||
| 26 | // range (y_begin, y_end]. | ||
| 27 | KLEIDICV_API_DECLARATION(kleidicv_separable_filter_2d_stripe_u16, | ||
| 28 | const uint16_t *src, size_t src_stride, uint16_t *dst, | ||
| 29 | size_t dst_stride, size_t width, size_t height, | ||
| 30 | size_t y_begin, size_t y_end, size_t channels, | ||
| 31 | const uint16_t *kernel_x, size_t kernel_width, | ||
| 32 | const uint16_t *kernel_y, size_t kernel_height, | ||
| 33 | kleidicv::FixedBorderType border_type); | ||
| 34 | // For internal use only. See instead kleidicv_separable_filter_2d_s16. | ||
| 35 | // Filter a horizontal stripe across an image. The stripe is defined by the | ||
| 36 | // range (y_begin, y_end]. | ||
| 37 | KLEIDICV_API_DECLARATION(kleidicv_separable_filter_2d_stripe_s16, | ||
| 38 | const int16_t *src, size_t src_stride, int16_t *dst, | ||
| 39 | size_t dst_stride, size_t width, size_t height, | ||
| 40 | size_t y_begin, size_t y_end, size_t channels, | ||
| 41 | const int16_t *kernel_x, size_t kernel_width, | ||
| 42 | const int16_t *kernel_y, size_t kernel_height, | ||
| 43 | kleidicv::FixedBorderType border_type); | ||
| 44 | } | ||
| 45 | |||
| 46 | namespace kleidicv { | ||
| 47 | |||
| 48 | 856 | inline bool separable_filter_2d_is_implemented(size_t width, size_t height, | |
| 49 | size_t kernel_width, | ||
| 50 | size_t kernel_height) { | ||
| 51 |
4/4✓ Branch 0 taken 848 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 840 times.
|
856 | if (kernel_width != 5 || kernel_height != 5) { |
| 52 | 16 | return false; | |
| 53 | } | ||
| 54 | |||
| 55 |
4/4✓ Branch 0 taken 520 times.
✓ Branch 1 taken 320 times.
✓ Branch 2 taken 16 times.
✓ Branch 3 taken 504 times.
|
840 | if (width < kernel_width - 1 || height < kernel_width - 1) { |
| 56 | 336 | return false; | |
| 57 | } | ||
| 58 | |||
| 59 | 504 | return true; | |
| 60 | 856 | } | |
| 61 | |||
| 62 | } // namespace kleidicv | ||
| 63 | |||
| 64 | #endif // KLEIDICV_FILTERS_SEPARABLE_FILTER_2D_H | ||
| 65 |