| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * Copyright (c) 2026 Devin Heitmueller <dheitmueller@ltnglobal.com> | ||
| 3 | * | ||
| 4 | * This file is part of FFmpeg. | ||
| 5 | * | ||
| 6 | * FFmpeg is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License along | ||
| 17 | * with FFmpeg; if not, write to the Free Software Foundation, Inc., | ||
| 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 19 | */ | ||
| 20 | |||
| 21 | #include <string.h> | ||
| 22 | |||
| 23 | #include "libavutil/mem_internal.h" | ||
| 24 | |||
| 25 | #include "checkasm.h" | ||
| 26 | #include "libavcodec/bitpacked_dec_init.h" | ||
| 27 | |||
| 28 | #define MAX_WIDTH 3840 | ||
| 29 | |||
| 30 | 42 | static void randomize_buffers(uint8_t *src0, uint8_t *src1, int len) | |
| 31 | { | ||
| 32 |
2/2✓ Branch 0 taken 59640 times.
✓ Branch 1 taken 42 times.
|
59682 | for (int i = 0; i < len; i++) { |
| 33 | 59640 | uint8_t value = rnd(); | |
| 34 | 59640 | src0[i] = value; | |
| 35 | 59640 | src1[i] = value; | |
| 36 | } | ||
| 37 | 42 | } | |
| 38 | |||
| 39 | 14 | void checkasm_check_bitpackeddec(void) | |
| 40 | { | ||
| 41 | static const int widths[] = { 8, 16, 24, 32, 40, 48, 56, MAX_WIDTH }; | ||
| 42 | static const int tail_widths[] = { 2, 6, 10, 14, 16 }; | ||
| 43 | struct BitpackedContext h; | ||
| 44 | |||
| 45 | 14 | ff_bitpackeddec_init(&h); | |
| 46 | |||
| 47 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 2 taken 11 times.
|
14 | if (check_func(h.unpack_yuv422p10, "bitpacked_unpack_yuv422p10")) { |
| 48 | 3 | LOCAL_ALIGNED_16(uint8_t, src0, [MAX_WIDTH * 5 / 2]); | |
| 49 | 3 | LOCAL_ALIGNED_16(uint8_t, src1, [MAX_WIDTH * 5 / 2]); | |
| 50 | 3 | LOCAL_ALIGNED_16(uint16_t, y0, [MAX_WIDTH]); | |
| 51 | 3 | LOCAL_ALIGNED_16(uint16_t, y1, [MAX_WIDTH]); | |
| 52 | 3 | LOCAL_ALIGNED_16(uint16_t, u0, [MAX_WIDTH / 2]); | |
| 53 | 3 | LOCAL_ALIGNED_16(uint16_t, u1, [MAX_WIDTH / 2]); | |
| 54 | 3 | LOCAL_ALIGNED_16(uint16_t, v0, [MAX_WIDTH / 2]); | |
| 55 | 3 | LOCAL_ALIGNED_16(uint16_t, v1, [MAX_WIDTH / 2]); | |
| 56 | 3 | declare_func(void, const uint8_t *src, uint16_t *y, uint16_t *u, | |
| 57 | uint16_t *v, int width); | ||
| 58 | |||
| 59 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 3 times.
|
27 | for (int i = 0; i < FF_ARRAY_ELEMS(widths); i++) { |
| 60 | 24 | const int width = widths[i]; | |
| 61 | 24 | const int src_size = width * 5 / 2; | |
| 62 | |||
| 63 | 24 | randomize_buffers(src0, src1, src_size); | |
| 64 | 24 | memset(y0, 0, width * sizeof(*y0)); | |
| 65 | 24 | memset(y1, 0, width * sizeof(*y1)); | |
| 66 | 24 | memset(u0, 0, width / 2 * sizeof(*u0)); | |
| 67 | 24 | memset(u1, 0, width / 2 * sizeof(*u1)); | |
| 68 | 24 | memset(v0, 0, width / 2 * sizeof(*v0)); | |
| 69 | 24 | memset(v1, 0, width / 2 * sizeof(*v1)); | |
| 70 | |||
| 71 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
|
24 | call_ref(src0, y0, u0, v0, width); |
| 72 | 24 | call_new(src1, y1, u1, v1, width); | |
| 73 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if (memcmp(src0, src1, src_size) || |
| 74 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | memcmp(y0, y1, width * sizeof(*y0)) || |
| 75 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | memcmp(u0, u1, width / 2 * sizeof(*u0)) || |
| 76 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | memcmp(v0, v1, width / 2 * sizeof(*v0))) |
| 77 | ✗ | fail(); | |
| 78 | } | ||
| 79 | |||
| 80 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 3 times.
|
18 | for (int i = 0; i < FF_ARRAY_ELEMS(tail_widths); i++) { |
| 81 | 15 | const int width = tail_widths[i]; | |
| 82 | 15 | const int bulk = width & ~7; | |
| 83 | 15 | const int src_size = width * 5 / 2; | |
| 84 | |||
| 85 | 15 | randomize_buffers(src0, src1, src_size); | |
| 86 | 15 | bitpacked_unpack_yuv422p10_c(src0, y0, u0, v0, width); | |
| 87 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 6 times.
|
15 | if (bulk) |
| 88 | 9 | h.unpack_yuv422p10(src1, y1, u1, v1, bulk); | |
| 89 | 15 | bitpacked_unpack_yuv422p10_c(src1 + bulk * 5 / 2, | |
| 90 | 15 | y1 + bulk, u1 + bulk / 2, v1 + bulk / 2, | |
| 91 | width - bulk); | ||
| 92 |
1/2✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
|
15 | if (memcmp(src0, src1, src_size) || |
| 93 |
1/2✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
|
15 | memcmp(y0, y1, width * sizeof(*y0)) || |
| 94 |
1/2✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
|
15 | memcmp(u0, u1, width / 2 * sizeof(*u0)) || |
| 95 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
|
15 | memcmp(v0, v1, width / 2 * sizeof(*v0))) |
| 96 | ✗ | fail(); | |
| 97 | } | ||
| 98 | |||
| 99 | 3 | randomize_buffers(src0, src1, MAX_WIDTH * 5 / 2); | |
| 100 |
1/18✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
|
3 | bench_new(src1, y1, u1, v1, MAX_WIDTH); |
| 101 | } | ||
| 102 | 14 | report("bitpacked_unpack_yuv422p10"); | |
| 103 | 14 | } | |
| 104 |