KleidiCV Coverage Report


Directory: ./
File: kleidicv/src/logical/bitwise_and_neon.cpp
Date: 2025-09-25 14:13:34
Exec Total Coverage
Lines: 17 17 100.0%
Functions: 3 3 100.0%
Branches: 18 18 100.0%

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 #include <type_traits>
6
7 #include "kleidicv/kleidicv.h"
8 #include "kleidicv/neon.h"
9
10 namespace kleidicv::neon {
11
12 template <typename ScalarType>
13 class BitwiseAnd final : public UnrollTwice {
14 public:
15 using VecTraits = neon::VecTraits<ScalarType>;
16 using VectorType = typename VecTraits::VectorType;
17
18 466 VectorType vector_path(VectorType src_a, VectorType src_b) {
19 466 return vandq(src_a, src_b);
20 }
21
22 564 ScalarType scalar_path(ScalarType src_a, ScalarType src_b) {
23 564 return src_a & src_b;
24 }
25 }; // end of class BitwiseAnd<ScalarType>
26
27 template <typename T>
28 70 kleidicv_error_t bitwise_and(const T *src_a, size_t src_a_stride,
29 const T *src_b, size_t src_b_stride, T *dst,
30 size_t dst_stride, size_t width, size_t height) {
31
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 69 times.
70 CHECK_POINTER_AND_STRIDE(src_a, src_a_stride, height);
32
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 68 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 68 times.
69 CHECK_POINTER_AND_STRIDE(src_b, src_b_stride, height);
33
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 67 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 67 times.
68 CHECK_POINTER_AND_STRIDE(dst, dst_stride, height);
34
6/6
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 66 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 65 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 65 times.
67 CHECK_IMAGE_SIZE(width, height);
35
36 65 BitwiseAnd<T> operation;
37 65 Rectangle rect{width, height};
38 65 Rows<const T> src_a_rows{src_a, src_a_stride};
39 65 Rows<const T> src_b_rows{src_b, src_b_stride};
40 65 Rows<T> dst_rows{dst, dst_stride};
41 65 neon::apply_operation_by_rows(operation, rect, src_a_rows, src_b_rows,
42 dst_rows);
43 65 return KLEIDICV_OK;
44 70 }
45
46 #define KLEIDICV_INSTANTIATE_TEMPLATE(type) \
47 template KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t bitwise_and<type>( \
48 const type *src_a, size_t src_a_stride, const type *src_b, \
49 size_t src_b_stride, type *dst, size_t dst_stride, size_t width, \
50 size_t height)
51
52 KLEIDICV_INSTANTIATE_TEMPLATE(uint8_t);
53
54 } // namespace kleidicv::neon
55