| 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 ADD_SC_H | ||
| 6 | #define ADD_SC_H | ||
| 7 | |||
| 8 | #include "kleidicv/sve2.h" | ||
| 9 | |||
| 10 | namespace KLEIDICV_TARGET_NAMESPACE { | ||
| 11 | |||
| 12 | template <typename ScalarType> | ||
| 13 | class SaturatingAdd final : public UnrollTwice { | ||
| 14 | public: | ||
| 15 | using ContextType = Context; | ||
| 16 | using VecTraits = KLEIDICV_TARGET_NAMESPACE::VecTraits<ScalarType>; | ||
| 17 | using VectorType = typename VecTraits::VectorType; | ||
| 18 | |||
| 19 | 25612 | VectorType vector_path(ContextType ctx, VectorType src_a, | |
| 20 | VectorType src_b) KLEIDICV_STREAMING { | ||
| 21 | 25612 | return svqadd_m(ctx.predicate(), src_a, src_b); | |
| 22 | } | ||
| 23 | }; // end of class SaturatingAdd<ScalarType> | ||
| 24 | |||
| 25 | template <typename T> | ||
| 26 | 1926 | static kleidicv_error_t saturating_add_sc(const T *src_a, size_t src_a_stride, | |
| 27 | const T *src_b, size_t src_b_stride, | ||
| 28 | T *dst, size_t dst_stride, | ||
| 29 | size_t width, | ||
| 30 | size_t height) KLEIDICV_STREAMING { | ||
| 31 |
32/32✓ Branch 0 taken 3 times.
✓ Branch 1 taken 231 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 231 times.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 231 times.
✓ Branch 6 taken 3 times.
✓ Branch 7 taken 231 times.
✓ Branch 8 taken 6 times.
✓ Branch 9 taken 237 times.
✓ Branch 10 taken 6 times.
✓ Branch 11 taken 237 times.
✓ Branch 12 taken 6 times.
✓ Branch 13 taken 237 times.
✓ Branch 14 taken 6 times.
✓ Branch 15 taken 237 times.
✓ Branch 16 taken 6 times.
✓ Branch 17 taken 237 times.
✓ Branch 18 taken 6 times.
✓ Branch 19 taken 237 times.
✓ Branch 20 taken 6 times.
✓ Branch 21 taken 237 times.
✓ Branch 22 taken 6 times.
✓ Branch 23 taken 237 times.
✓ Branch 24 taken 6 times.
✓ Branch 25 taken 237 times.
✓ Branch 26 taken 6 times.
✓ Branch 27 taken 237 times.
✓ Branch 28 taken 6 times.
✓ Branch 29 taken 237 times.
✓ Branch 30 taken 6 times.
✓ Branch 31 taken 237 times.
|
1926 | CHECK_POINTER_AND_STRIDE(src_a, src_a_stride, height); |
| 32 |
32/32✓ Branch 0 taken 3 times.
✓ Branch 1 taken 228 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 228 times.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 228 times.
✓ Branch 6 taken 3 times.
✓ Branch 7 taken 228 times.
✓ Branch 8 taken 6 times.
✓ Branch 9 taken 231 times.
✓ Branch 10 taken 6 times.
✓ Branch 11 taken 231 times.
✓ Branch 12 taken 6 times.
✓ Branch 13 taken 231 times.
✓ Branch 14 taken 6 times.
✓ Branch 15 taken 231 times.
✓ Branch 16 taken 6 times.
✓ Branch 17 taken 231 times.
✓ Branch 18 taken 6 times.
✓ Branch 19 taken 231 times.
✓ Branch 20 taken 6 times.
✓ Branch 21 taken 231 times.
✓ Branch 22 taken 6 times.
✓ Branch 23 taken 231 times.
✓ Branch 24 taken 6 times.
✓ Branch 25 taken 231 times.
✓ Branch 26 taken 6 times.
✓ Branch 27 taken 231 times.
✓ Branch 28 taken 6 times.
✓ Branch 29 taken 231 times.
✓ Branch 30 taken 6 times.
✓ Branch 31 taken 231 times.
|
1884 | CHECK_POINTER_AND_STRIDE(src_b, src_b_stride, height); |
| 33 |
32/32✓ Branch 0 taken 3 times.
✓ Branch 1 taken 225 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 225 times.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 225 times.
✓ Branch 6 taken 3 times.
✓ Branch 7 taken 225 times.
✓ Branch 8 taken 6 times.
✓ Branch 9 taken 225 times.
✓ Branch 10 taken 6 times.
✓ Branch 11 taken 225 times.
✓ Branch 12 taken 6 times.
✓ Branch 13 taken 225 times.
✓ Branch 14 taken 6 times.
✓ Branch 15 taken 225 times.
✓ Branch 16 taken 6 times.
✓ Branch 17 taken 225 times.
✓ Branch 18 taken 6 times.
✓ Branch 19 taken 225 times.
✓ Branch 20 taken 6 times.
✓ Branch 21 taken 225 times.
✓ Branch 22 taken 6 times.
✓ Branch 23 taken 225 times.
✓ Branch 24 taken 6 times.
✓ Branch 25 taken 225 times.
✓ Branch 26 taken 6 times.
✓ Branch 27 taken 225 times.
✓ Branch 28 taken 6 times.
✓ Branch 29 taken 225 times.
✓ Branch 30 taken 6 times.
✓ Branch 31 taken 225 times.
|
1842 | CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); |
| 34 |
48/48✓ Branch 0 taken 3 times.
✓ Branch 1 taken 222 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 219 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 219 times.
✓ Branch 6 taken 3 times.
✓ Branch 7 taken 222 times.
✓ Branch 8 taken 3 times.
✓ Branch 9 taken 219 times.
✓ Branch 10 taken 6 times.
✓ Branch 11 taken 219 times.
✓ Branch 12 taken 3 times.
✓ Branch 13 taken 222 times.
✓ Branch 14 taken 3 times.
✓ Branch 15 taken 219 times.
✓ Branch 16 taken 6 times.
✓ Branch 17 taken 219 times.
✓ Branch 18 taken 3 times.
✓ Branch 19 taken 222 times.
✓ Branch 20 taken 3 times.
✓ Branch 21 taken 219 times.
✓ Branch 22 taken 6 times.
✓ Branch 23 taken 219 times.
✓ Branch 24 taken 3 times.
✓ Branch 25 taken 222 times.
✓ Branch 26 taken 3 times.
✓ Branch 27 taken 219 times.
✓ Branch 28 taken 6 times.
✓ Branch 29 taken 219 times.
✓ Branch 30 taken 3 times.
✓ Branch 31 taken 222 times.
✓ Branch 32 taken 3 times.
✓ Branch 33 taken 219 times.
✓ Branch 34 taken 6 times.
✓ Branch 35 taken 219 times.
✓ Branch 36 taken 3 times.
✓ Branch 37 taken 222 times.
✓ Branch 38 taken 3 times.
✓ Branch 39 taken 219 times.
✓ Branch 40 taken 6 times.
✓ Branch 41 taken 219 times.
✓ Branch 42 taken 3 times.
✓ Branch 43 taken 222 times.
✓ Branch 44 taken 3 times.
✓ Branch 45 taken 219 times.
✓ Branch 46 taken 6 times.
✓ Branch 47 taken 219 times.
|
1800 | CHECK_IMAGE_SIZE(width, height); |
| 35 | |||
| 36 | 1752 | SaturatingAdd<T> operation; | |
| 37 | 1752 | Rectangle rect{width, height}; | |
| 38 | 1752 | Rows<const T> src_a_rows{src_a, src_a_stride}; | |
| 39 | 1752 | Rows<const T> src_b_rows{src_b, src_b_stride}; | |
| 40 | 1752 | Rows<T> dst_rows{dst, dst_stride}; | |
| 41 | 1752 | apply_operation_by_rows(operation, rect, src_a_rows, src_b_rows, dst_rows); | |
| 42 | 1752 | return KLEIDICV_OK; | |
| 43 | 1926 | } | |
| 44 | |||
| 45 | } // namespace KLEIDICV_TARGET_NAMESPACE | ||
| 46 | |||
| 47 | #endif // ADD_SC_H | ||
| 48 |