| 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 | #include "kleidicv/conversions/rgb_to_yuv.h" | ||
| 6 | #include "rgb_to_yuv420_sc.h" | ||
| 7 | |||
| 8 | namespace kleidicv::sme { | ||
| 9 | |||
| 10 | KLEIDICV_LOCALLY_STREAMING KLEIDICV_TARGET_FN_ATTRS kleidicv_error_t | ||
| 11 | 553 | rgb_to_yuv420p_stripe_u8(const uint8_t *src, size_t src_stride, uint8_t *dst, | |
| 12 | size_t dst_stride, size_t width, size_t height, | ||
| 13 | kleidicv_color_conversion_t color_format, size_t begin, | ||
| 14 | size_t end) { | ||
| 15 |
4/4✓ Branch 0 taken 8 times.
✓ Branch 1 taken 545 times.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 545 times.
|
553 | CHECK_POINTER_AND_STRIDE(src, src_stride, height); |
| 16 |
4/4✓ Branch 0 taken 8 times.
✓ Branch 1 taken 537 times.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 537 times.
|
545 | CHECK_POINTER_AND_STRIDE(dst, dst_stride, (height * 3 + 1) / 2); |
| 17 |
6/6✓ Branch 0 taken 16 times.
✓ Branch 1 taken 521 times.
✓ Branch 2 taken 16 times.
✓ Branch 3 taken 505 times.
✓ Branch 4 taken 32 times.
✓ Branch 5 taken 505 times.
|
537 | CHECK_IMAGE_SIZE(width, height); |
| 18 | 505 | uint8_t *uv_dst = dst + dst_stride * height; | |
| 19 | |||
| 20 |
9/9✓ Branch 0 taken 54 times.
✓ Branch 1 taken 54 times.
✓ Branch 2 taken 54 times.
✓ Branch 3 taken 54 times.
✓ Branch 4 taken 54 times.
✓ Branch 5 taken 54 times.
✓ Branch 6 taken 54 times.
✓ Branch 7 taken 73 times.
✓ Branch 8 taken 54 times.
|
505 | switch (color_format) { |
| 21 | case KLEIDICV_BGR_TO_YV12: { | ||
| 22 | 54 | return RGBxorBGRxToYUV420<false, false, false>::rgb2yuv420_operation_sc( | |
| 23 | 54 | src, src_stride, dst, dst_stride, uv_dst, dst_stride, width, height, | |
| 24 | 54 | true, begin, end); | |
| 25 | } | ||
| 26 | |||
| 27 | case KLEIDICV_RGB_TO_YV12: { | ||
| 28 | 54 | return RGBxorBGRxToYUV420<false, true, false>::rgb2yuv420_operation_sc( | |
| 29 | 54 | src, src_stride, dst, dst_stride, uv_dst, dst_stride, width, height, | |
| 30 | 54 | true, begin, end); | |
| 31 | } | ||
| 32 | |||
| 33 | case KLEIDICV_BGRA_TO_YV12: { | ||
| 34 | 54 | return RGBxorBGRxToYUV420<true, false, false>::rgb2yuv420_operation_sc( | |
| 35 | 54 | src, src_stride, dst, dst_stride, uv_dst, dst_stride, width, height, | |
| 36 | 54 | true, begin, end); | |
| 37 | } | ||
| 38 | |||
| 39 | case KLEIDICV_RGBA_TO_YV12: { | ||
| 40 | 54 | return RGBxorBGRxToYUV420<true, true, false>::rgb2yuv420_operation_sc( | |
| 41 | 54 | src, src_stride, dst, dst_stride, uv_dst, dst_stride, width, height, | |
| 42 | 54 | true, begin, end); | |
| 43 | } | ||
| 44 | |||
| 45 | case KLEIDICV_BGR_TO_IYUV: { | ||
| 46 | 54 | return RGBxorBGRxToYUV420<false, false, false>::rgb2yuv420_operation_sc( | |
| 47 | 54 | src, src_stride, dst, dst_stride, uv_dst, dst_stride, width, height, | |
| 48 | 54 | false, begin, end); | |
| 49 | } | ||
| 50 | |||
| 51 | case KLEIDICV_RGB_TO_IYUV: { | ||
| 52 | 54 | return RGBxorBGRxToYUV420<false, true, false>::rgb2yuv420_operation_sc( | |
| 53 | 54 | src, src_stride, dst, dst_stride, uv_dst, dst_stride, width, height, | |
| 54 | 54 | false, begin, end); | |
| 55 | } | ||
| 56 | |||
| 57 | case KLEIDICV_BGRA_TO_IYUV: { | ||
| 58 | 54 | return RGBxorBGRxToYUV420<true, false, false>::rgb2yuv420_operation_sc( | |
| 59 | 54 | src, src_stride, dst, dst_stride, uv_dst, dst_stride, width, height, | |
| 60 | 54 | false, begin, end); | |
| 61 | } | ||
| 62 | |||
| 63 | case KLEIDICV_RGBA_TO_IYUV: { | ||
| 64 | 54 | return RGBxorBGRxToYUV420<true, true, false>::rgb2yuv420_operation_sc( | |
| 65 | 54 | src, src_stride, dst, dst_stride, uv_dst, dst_stride, width, height, | |
| 66 | 54 | false, begin, end); | |
| 67 | } | ||
| 68 | |||
| 69 | default: | ||
| 70 | 73 | return KLEIDICV_ERROR_NOT_IMPLEMENTED; | |
| 71 | } | ||
| 72 | |||
| 73 | return KLEIDICV_ERROR_NOT_IMPLEMENTED; | ||
| 74 | 553 | } | |
| 75 | |||
| 76 | } // namespace kleidicv::sme | ||
| 77 |