KleidiCV Coverage Report


Directory: ./
File: kleidicv/src/arithmetics/sub_sc.h
Date: 2025-11-25 17:23:32
Exec Total Coverage
Lines: 15 15 100.0%
Functions: 48 48 100.0%
Branches: 144 144 100.0%

Line Branch Exec Source
1 // SPDX-FileCopyrightText: 2025 Arm Limited and/or its affiliates <open-source-office@arm.com>
2 //
3 // SPDX-License-Identifier: Apache-2.0
4
5 #ifndef SUB_SC_H
6 #define SUB_SC_H
7
8 #include "kleidicv/sve2.h"
9
10 namespace KLEIDICV_TARGET_NAMESPACE {
11
12 template <typename ScalarType>
13 class SaturatingSub 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 26330 VectorType vector_path(ContextType ctx, VectorType src_a,
20 VectorType src_b) KLEIDICV_STREAMING {
21 26330 return svqsub_m(ctx.predicate(), src_a, src_b);
22 }
23 }; // end of class SaturatingSub<ScalarType>
24
25 template <typename T>
26 1926 kleidicv_error_t saturating_sub_sc(const T *src_a, size_t src_a_stride,
27 const T *src_b, size_t src_b_stride, T *dst,
28 size_t dst_stride, size_t width,
29 size_t height) KLEIDICV_STREAMING {
30
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);
31
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);
32
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);
33
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);
34
35 1752 SaturatingSub<T> operation;
36 1752 Rectangle rect{width, height};
37 1752 Rows<const T> src_a_rows{src_a, src_a_stride};
38 1752 Rows<const T> src_b_rows{src_b, src_b_stride};
39 1752 Rows<T> dst_rows{dst, dst_stride};
40 1752 apply_operation_by_rows(operation, rect, src_a_rows, src_b_rows, dst_rows);
41 1752 return KLEIDICV_OK;
42 1926 }
43
44 } // namespace KLEIDICV_TARGET_NAMESPACE
45
46 #endif // SUB_SC_H
47