| 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 | 552 | kleidicv_error_t rgb_to_yuv420sp_stripe_u8( | |
| 14 | const uint8_t *src, size_t src_stride, uint8_t *y_dst, size_t y_stride, | ||
| 15 | uint8_t *uv_dst, size_t uv_stride, size_t width, size_t height, | ||
| 16 | kleidicv_color_conversion_t color_format, size_t begin, size_t end) { | ||
| 17 |
4/4✓ Branch 0 taken 8 times.
✓ Branch 1 taken 544 times.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 544 times.
|
552 | CHECK_POINTER_AND_STRIDE(src, src_stride, height); |
| 18 |
4/4✓ Branch 0 taken 8 times.
✓ Branch 1 taken 536 times.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 536 times.
|
544 | CHECK_POINTER_AND_STRIDE(y_dst, y_stride, height); |
| 19 |
4/4✓ Branch 0 taken 8 times.
✓ Branch 1 taken 528 times.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 528 times.
|
536 | CHECK_POINTER_AND_STRIDE(uv_dst, uv_stride, (height + 1) / 2); |
| 20 |
6/6✓ Branch 0 taken 16 times.
✓ Branch 1 taken 512 times.
✓ Branch 2 taken 16 times.
✓ Branch 3 taken 496 times.
✓ Branch 4 taken 32 times.
✓ Branch 5 taken 496 times.
|
528 | CHECK_IMAGE_SIZE(width, height); |
| 21 |
9/9✓ Branch 0 taken 56 times.
✓ Branch 1 taken 56 times.
✓ Branch 2 taken 56 times.
✓ Branch 3 taken 56 times.
✓ Branch 4 taken 56 times.
✓ Branch 5 taken 56 times.
✓ Branch 6 taken 56 times.
✓ Branch 7 taken 48 times.
✓ Branch 8 taken 56 times.
|
496 | switch (color_format) { |
| 22 | case KLEIDICV_BGR_TO_NV21: { | ||
| 23 | 56 | return RGBxorBGRxToYUV420<false, false, true>::rgb2yuv420_operation( | |
| 24 | 56 | src, src_stride, y_dst, y_stride, uv_dst, uv_stride, width, height, | |
| 25 | 56 | true, begin, end); | |
| 26 | } | ||
| 27 | |||
| 28 | case KLEIDICV_RGB_TO_NV21: { | ||
| 29 | 56 | return RGBxorBGRxToYUV420<false, true, true>::rgb2yuv420_operation( | |
| 30 | 56 | src, src_stride, y_dst, y_stride, uv_dst, uv_stride, width, height, | |
| 31 | 56 | true, begin, end); | |
| 32 | } | ||
| 33 | |||
| 34 | case KLEIDICV_BGRA_TO_NV21: { | ||
| 35 | 56 | return RGBxorBGRxToYUV420<true, false, true>::rgb2yuv420_operation( | |
| 36 | 56 | src, src_stride, y_dst, y_stride, uv_dst, uv_stride, width, height, | |
| 37 | 56 | true, begin, end); | |
| 38 | } | ||
| 39 | |||
| 40 | case KLEIDICV_RGBA_TO_NV21: { | ||
| 41 | 56 | return RGBxorBGRxToYUV420<true, true, true>::rgb2yuv420_operation( | |
| 42 | 56 | src, src_stride, y_dst, y_stride, uv_dst, uv_stride, width, height, | |
| 43 | 56 | true, begin, end); | |
| 44 | } | ||
| 45 | |||
| 46 | case KLEIDICV_BGR_TO_NV12: { | ||
| 47 | 56 | return RGBxorBGRxToYUV420<false, false, true>::rgb2yuv420_operation( | |
| 48 | 56 | src, src_stride, y_dst, y_stride, uv_dst, uv_stride, width, height, | |
| 49 | 56 | false, begin, end); | |
| 50 | } | ||
| 51 | |||
| 52 | case KLEIDICV_RGB_TO_NV12: { | ||
| 53 | 56 | return RGBxorBGRxToYUV420<false, true, true>::rgb2yuv420_operation( | |
| 54 | 56 | src, src_stride, y_dst, y_stride, uv_dst, uv_stride, width, height, | |
| 55 | 56 | false, begin, end); | |
| 56 | } | ||
| 57 | |||
| 58 | case KLEIDICV_BGRA_TO_NV12: { | ||
| 59 | 56 | return RGBxorBGRxToYUV420<true, false, true>::rgb2yuv420_operation( | |
| 60 | 56 | src, src_stride, y_dst, y_stride, uv_dst, uv_stride, width, height, | |
| 61 | 56 | false, begin, end); | |
| 62 | } | ||
| 63 | |||
| 64 | case KLEIDICV_RGBA_TO_NV12: { | ||
| 65 | 56 | return RGBxorBGRxToYUV420<true, true, true>::rgb2yuv420_operation( | |
| 66 | 56 | src, src_stride, y_dst, y_stride, uv_dst, uv_stride, width, height, | |
| 67 | 56 | false, begin, end); | |
| 68 | } | ||
| 69 | |||
| 70 | default: | ||
| 71 | 48 | return KLEIDICV_ERROR_NOT_IMPLEMENTED; | |
| 72 | } | ||
| 73 | |||
| 74 | return KLEIDICV_ERROR_NOT_IMPLEMENTED; | ||
| 75 | 552 | } | |
| 76 | |||
| 77 | } // namespace kleidicv::neon | ||
| 78 |