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