| 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 2 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
|
10 | KLEIDICV_DEFINE_C_API(kleidicv_rgb_to_bgr_u8, rgb_to_bgr_u8); |
| 17 |
4/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
|
10 | KLEIDICV_DEFINE_C_API(kleidicv_rgba_to_bgra_u8, rgba_to_bgra_u8); |
| 18 |
4/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
|
10 | KLEIDICV_DEFINE_C_API(kleidicv_rgb_to_bgra_u8, rgb_to_bgra_u8); |
| 19 |
4/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
|
10 | KLEIDICV_DEFINE_C_API(kleidicv_rgb_to_rgba_u8, rgb_to_rgba_u8); |
| 20 |
4/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
|
10 | KLEIDICV_DEFINE_C_API(kleidicv_rgba_to_bgr_u8, rgba_to_bgr_u8); |
| 21 |
4/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
|
10 | 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 | 279 | 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 5 times.
✓ Branch 1 taken 274 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 274 times.
|
279 | CHECK_POINTER_AND_STRIDE(src, src_stride, height); |
| 33 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 269 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 269 times.
|
274 | CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); |
| 34 |
6/6✓ Branch 0 taken 5 times.
✓ Branch 1 taken 264 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 259 times.
✓ Branch 4 taken 10 times.
✓ Branch 5 taken 259 times.
|
269 | CHECK_IMAGE_SIZE(width, height); |
| 35 | |||
| 36 | 259 | Rectangle rect{width, height}; | |
| 37 | 259 | Rows<const uint8_t> src_rows{src, src_stride, 3 /* RGB */}; | |
| 38 | 259 | Rows<uint8_t> dst_rows{dst, dst_stride, 3 /* BGR */}; | |
| 39 | 259 | CopyRows<uint8_t>::copy_rows(rect, src_rows, dst_rows); | |
| 40 | 259 | return KLEIDICV_OK; | |
| 41 | 279 | } | |
| 42 | |||
| 43 | decltype(kleidicv_rgb_to_rgb_u8_impl) *kleidicv_rgb_to_rgb_u8 = | ||
| 44 | kleidicv_rgb_to_rgb_u8_impl; | ||
| 45 | |||
| 46 | 279 | 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 5 times.
✓ Branch 1 taken 274 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 274 times.
|
279 | CHECK_POINTER_AND_STRIDE(src, src_stride, height); |
| 50 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 269 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 269 times.
|
274 | CHECK_POINTER_AND_STRIDE(dst, dst_stride, height); |
| 51 |
6/6✓ Branch 0 taken 5 times.
✓ Branch 1 taken 264 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 259 times.
✓ Branch 4 taken 10 times.
✓ Branch 5 taken 259 times.
|
269 | CHECK_IMAGE_SIZE(width, height); |
| 52 | |||
| 53 | 259 | Rectangle rect{width, height}; | |
| 54 | 259 | Rows<const uint8_t> src_rows{src, src_stride, 4 /* RGBA */}; | |
| 55 | 259 | Rows<uint8_t> dst_rows{dst, dst_stride, 4 /* RGBA */}; | |
| 56 | 259 | CopyRows<uint8_t>::copy_rows(rect, src_rows, dst_rows); | |
| 57 | 259 | return KLEIDICV_OK; | |
| 58 | 279 | } | |
| 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 |