| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // SPDX-FileCopyrightText: 2024 - 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/yuv_to_rgb.h" | ||
| 6 | #include "kleidicv/dispatch.h" | ||
| 7 | #include "kleidicv/kleidicv.h" | ||
| 8 | |||
| 9 | #define KLEIDICV_DEFINE_C_API_WITH_SME2(name, partialname) \ | ||
| 10 | KLEIDICV_MULTIVERSION_C_API( \ | ||
| 11 | name, &kleidicv::neon::partialname, &kleidicv::sve2::partialname, \ | ||
| 12 | &kleidicv::sme::partialname, &kleidicv::sme2::partialname) | ||
| 13 | |||
| 14 | #define KLEIDICV_DEFINE_C_API_WITHOUT_SME2(name, partialname) \ | ||
| 15 | KLEIDICV_MULTIVERSION_C_API(name, &kleidicv::neon::partialname, \ | ||
| 16 | &kleidicv::sve2::partialname, \ | ||
| 17 | &kleidicv::sme::partialname, nullptr) | ||
| 18 | |||
| 19 |
6/6✓ Branch 0 taken 1 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 1 times.
|
10 | KLEIDICV_DEFINE_C_API_WITH_SME2(kleidicv_yuv420p_to_rgb_stripe_u8, |
| 20 | yuv420p_to_rgb_stripe_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_WITHOUT_SME2(kleidicv_yuv444_to_rgb_u8, yuv444_to_rgb_u8); |
| 22 |
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_WITHOUT_SME2(kleidicv_yuv422_to_rgb_u8, yuv422_to_rgb_u8); |
| 23 |
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_WITHOUT_SME2(kleidicv_yuv_semiplanar_to_rgb_u8, |
| 24 | yuv420sp_to_rgb_u8) | ||
| 25 | |||
| 26 | extern "C" { | ||
| 27 | |||
| 28 | 3346 | kleidicv_error_t kleidicv_yuv_to_rgb_u8( | |
| 29 | const uint8_t* src, size_t src_stride, uint8_t* dst, size_t dst_stride, | ||
| 30 | size_t width, size_t height, kleidicv_color_conversion_t color_format) { | ||
| 31 | // Extract the base format | ||
| 32 | 6692 | const size_t base_format = static_cast<size_t>( | |
| 33 | 3346 | color_format & KLEIDICV_COLOR_CONVERSION_YUV_FMT_MASK); | |
| 34 | |||
| 35 |
2/2✓ Branch 0 taken 940 times.
✓ Branch 1 taken 2406 times.
|
3346 | if (base_format == KLEIDICV_COLOR_CONVERSION_FMT_YUV444) { |
| 36 | 1880 | return kleidicv_yuv444_to_rgb_u8(src, src_stride, dst, dst_stride, width, | |
| 37 | 940 | height, color_format); | |
| 38 | } | ||
| 39 | |||
| 40 |
2/2✓ Branch 0 taken 1464 times.
✓ Branch 1 taken 942 times.
|
2406 | if (base_format == KLEIDICV_COLOR_CONVERSION_FMT_YUV420P) { |
| 41 | // YUV420 relies on 2x2 chroma blocks shared between lines, so the stripe | ||
| 42 | // API ensures each invocation receives contiguous rows to preserve that | ||
| 43 | // neighborhood context and compute the correct per-plane offsets for the | ||
| 44 | // current stripe. | ||
| 45 | 2928 | return kleidicv_yuv420p_to_rgb_stripe_u8(src, src_stride, dst, dst_stride, | |
| 46 | 1464 | width, height, color_format, 0, | |
| 47 | 1464 | height); | |
| 48 | } | ||
| 49 | |||
| 50 | 1884 | return kleidicv_yuv422_to_rgb_u8(src, src_stride, dst, dst_stride, width, | |
| 51 | 942 | height, color_format); | |
| 52 | 3346 | } | |
| 53 | |||
| 54 | } // extern "C" | ||
| 55 |