KleidiCV Coverage Report


Directory: ./
File: kleidicv/src/conversions/rgb_to_rgb_api.cpp
Date: 2025-09-25 14:13:34
Exec Total Coverage
Lines: 26 26 100.0%
Functions: 8 8 100.0%
Branches: 52 52 100.0%

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 #include "kleidicv/conversions/rgb_to_rgb.h"
6 #include "kleidicv/dispatch.h"
7 #include "kleidicv/kleidicv.h"
8 #include "kleidicv/types.h"
9
10 #define KLEIDICV_DEFINE_C_API(name, partialname) \
11 KLEIDICV_MULTIVERSION_C_API( \
12 name, &kleidicv::neon::partialname, \
13 KLEIDICV_SVE2_IMPL_IF(&kleidicv::sve2::partialname), \
14 &kleidicv::sme::partialname, nullptr)
15
16
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
8 KLEIDICV_DEFINE_C_API(kleidicv_rgb_to_bgr_u8, rgb_to_bgr_u8);
17
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
8 KLEIDICV_DEFINE_C_API(kleidicv_rgba_to_bgra_u8, rgba_to_bgra_u8);
18
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
8 KLEIDICV_DEFINE_C_API(kleidicv_rgb_to_bgra_u8, rgb_to_bgra_u8);
19
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
8 KLEIDICV_DEFINE_C_API(kleidicv_rgb_to_rgba_u8, rgb_to_rgba_u8);
20
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
8 KLEIDICV_DEFINE_C_API(kleidicv_rgba_to_bgr_u8, rgba_to_bgr_u8);
21
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
8 KLEIDICV_DEFINE_C_API(kleidicv_rgba_to_rgb_u8, rgba_to_rgb_u8);
22
23 extern "C" {
24
25 using KLEIDICV_TARGET_NAMESPACE::CopyRows;
26 using KLEIDICV_TARGET_NAMESPACE::Rectangle;
27 using KLEIDICV_TARGET_NAMESPACE::Rows;
28
29 211 static kleidicv_error_t kleidicv_rgb_to_rgb_u8_impl(
30 const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride,
31 size_t width, size_t height) {
32
4/4
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 207 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 207 times.
211 CHECK_POINTER_AND_STRIDE(src, src_stride, height);
33
4/4
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 203 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 203 times.
207 CHECK_POINTER_AND_STRIDE(dst, dst_stride, height);
34
6/6
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 199 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 195 times.
✓ Branch 4 taken 8 times.
✓ Branch 5 taken 195 times.
203 CHECK_IMAGE_SIZE(width, height);
35
36 195 Rectangle rect{width, height};
37 195 Rows<const uint8_t> src_rows{src, src_stride, 3 /* RGB */};
38 195 Rows<uint8_t> dst_rows{dst, dst_stride, 3 /* BGR */};
39 195 CopyRows<uint8_t>::copy_rows(rect, src_rows, dst_rows);
40 195 return KLEIDICV_OK;
41 211 }
42
43 decltype(kleidicv_rgb_to_rgb_u8_impl) *kleidicv_rgb_to_rgb_u8 =
44 kleidicv_rgb_to_rgb_u8_impl;
45
46 211 static kleidicv_error_t kleidicv_rgba_to_rgba_u8_impl(
47 const uint8_t *src, size_t src_stride, uint8_t *dst, size_t dst_stride,
48 size_t width, size_t height) {
49
4/4
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 207 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 207 times.
211 CHECK_POINTER_AND_STRIDE(src, src_stride, height);
50
4/4
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 203 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 203 times.
207 CHECK_POINTER_AND_STRIDE(dst, dst_stride, height);
51
6/6
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 199 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 195 times.
✓ Branch 4 taken 8 times.
✓ Branch 5 taken 195 times.
203 CHECK_IMAGE_SIZE(width, height);
52
53 195 Rectangle rect{width, height};
54 195 Rows<const uint8_t> src_rows{src, src_stride, 4 /* RGBA */};
55 195 Rows<uint8_t> dst_rows{dst, dst_stride, 4 /* RGBA */};
56 195 CopyRows<uint8_t>::copy_rows(rect, src_rows, dst_rows);
57 195 return KLEIDICV_OK;
58 211 }
59
60 decltype(kleidicv_rgba_to_rgba_u8_impl) *kleidicv_rgba_to_rgba_u8 =
61 kleidicv_rgba_to_rgba_u8_impl;
62
63 } // extern "C"
64