| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // SPDX-FileCopyrightText: 2024 - 2025 Arm Limited and/or its affiliates <open-source-office@arm.com> | ||
| 2 | // | ||
| 3 | // SPDX-License-Identifier: Apache-2.0 | ||
| 4 | |||
| 5 | #ifndef KLEIDICV_TRANSFORM_WARP_PERSPECTIVE_H | ||
| 6 | #define KLEIDICV_TRANSFORM_WARP_PERSPECTIVE_H | ||
| 7 | |||
| 8 | #include <limits> | ||
| 9 | #include <type_traits> | ||
| 10 | |||
| 11 | #include "kleidicv/ctypes.h" | ||
| 12 | |||
| 13 | extern "C" { | ||
| 14 | // For internal use only. See kleidicv_warp_perspective_u8 instead. | ||
| 15 | // Calculates a stripe of the `dst` image that is a transformed part of `src`. | ||
| 16 | // The stripe is defined by the range (y_begin, y_end]. | ||
| 17 | KLEIDICV_API_DECLARATION(kleidicv_warp_perspective_stripe_u8, | ||
| 18 | const uint8_t *src, size_t src_stride, | ||
| 19 | size_t src_width, size_t src_height, uint8_t *dst, | ||
| 20 | size_t dst_stride, size_t dst_width, size_t dst_height, | ||
| 21 | size_t y_begin, size_t y_end, | ||
| 22 | const float transformation[9], size_t channels, | ||
| 23 | kleidicv_interpolation_type_t interpolation, | ||
| 24 | kleidicv_border_type_t border_type, | ||
| 25 | const uint8_t *border_value); | ||
| 26 | } | ||
| 27 | namespace kleidicv { | ||
| 28 | |||
| 29 | template <typename T> | ||
| 30 | 540 | inline bool warp_perspective_is_implemented( | |
| 31 | size_t dst_width, size_t channels, | ||
| 32 | kleidicv_interpolation_type_t interpolation, | ||
| 33 | kleidicv_border_type_t border_type) KLEIDICV_STREAMING { | ||
| 34 | if constexpr (std::is_same<T, uint8_t>::value) { | ||
| 35 |
2/2✓ Branch 0 taken 528 times.
✓ Branch 1 taken 12 times.
|
1132 | return (dst_width >= 8 && |
| 36 |
2/2✓ Branch 0 taken 224 times.
✓ Branch 1 taken 304 times.
|
528 | (interpolation == KLEIDICV_INTERPOLATION_NEAREST || |
| 37 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 32 times.
|
224 | interpolation == KLEIDICV_INTERPOLATION_LINEAR) && |
| 38 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 516 times.
|
560 | (border_type == KLEIDICV_BORDER_TYPE_REPLICATE || |
| 39 | 44 | border_type == KLEIDICV_BORDER_TYPE_CONSTANT) && | |
| 40 | 516 | channels == 1); | |
| 41 | } else { | ||
| 42 | return false; | ||
| 43 | } | ||
| 44 | } | ||
| 45 | |||
| 46 | namespace neon { | ||
| 47 | |||
| 48 | template <typename T> | ||
| 49 | kleidicv_error_t warp_perspective_stripe( | ||
| 50 | const T *src, size_t src_stride, size_t src_width, size_t src_height, | ||
| 51 | T *dst, size_t dst_stride, size_t dst_width, size_t dst_height, | ||
| 52 | size_t y_begin, size_t y_end, const float transformation[9], | ||
| 53 | size_t channels, kleidicv_interpolation_type_t interpolation, | ||
| 54 | kleidicv_border_type_t border_type, const T *border_value); | ||
| 55 | } // namespace neon | ||
| 56 | |||
| 57 | namespace sve2 { | ||
| 58 | |||
| 59 | template <typename T> | ||
| 60 | kleidicv_error_t warp_perspective_stripe( | ||
| 61 | const T *src, size_t src_stride, size_t src_width, size_t src_height, | ||
| 62 | T *dst, size_t dst_stride, size_t dst_width, size_t dst_height, | ||
| 63 | size_t y_begin, size_t y_end, const float transformation[9], | ||
| 64 | size_t channels, kleidicv_interpolation_type_t interpolation, | ||
| 65 | kleidicv_border_type_t border_type, const T *border_value); | ||
| 66 | } // namespace sve2 | ||
| 67 | |||
| 68 | } // namespace kleidicv | ||
| 69 | |||
| 70 | #endif // KLEIDICV_TRANSFORM_WARP_PERSPECTIVE_H | ||
| 71 |