Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | * Copyright (c) 2015 Henrik Gramner | ||
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 | #include "checkasm.h" | ||
23 | #include "libavcodec/v210enc_init.h" | ||
24 | #include "libavutil/common.h" | ||
25 | #include "libavutil/internal.h" | ||
26 | #include "libavutil/intreadwrite.h" | ||
27 | #include "libavutil/mem_internal.h" | ||
28 | |||
29 | #define BUF_SIZE 512 | ||
30 | |||
31 | #define randomize_buffers(mask) \ | ||
32 | do { \ | ||
33 | int i, size = sizeof(*y0); \ | ||
34 | for (i = 0; i < BUF_SIZE; i += 4 / size) { \ | ||
35 | uint32_t r = rnd() & mask; \ | ||
36 | AV_WN32A(y0 + i, r); \ | ||
37 | AV_WN32A(y1 + i, r); \ | ||
38 | } \ | ||
39 | for (i = 0; i < BUF_SIZE / 2; i += 4 / size) { \ | ||
40 | uint32_t r = rnd() & mask; \ | ||
41 | AV_WN32A(u0 + i, r); \ | ||
42 | AV_WN32A(u1 + i, r); \ | ||
43 | r = rnd() & mask; \ | ||
44 | AV_WN32A(v0 + i, r); \ | ||
45 | AV_WN32A(v1 + i, r); \ | ||
46 | } \ | ||
47 | for (i = 0; i < width * 8 / 3; i += 4) { \ | ||
48 | uint32_t r = rnd(); \ | ||
49 | AV_WN32A(dst0 + i, r); \ | ||
50 | AV_WN32A(dst1 + i, r); \ | ||
51 | } \ | ||
52 | } while (0) | ||
53 | |||
54 | #define check_pack_line(type, mask) \ | ||
55 | do { \ | ||
56 | LOCAL_ALIGNED_16(type, y0, [BUF_SIZE]); \ | ||
57 | LOCAL_ALIGNED_16(type, y1, [BUF_SIZE]); \ | ||
58 | LOCAL_ALIGNED_16(type, u0, [BUF_SIZE / 2]); \ | ||
59 | LOCAL_ALIGNED_16(type, u1, [BUF_SIZE / 2]); \ | ||
60 | LOCAL_ALIGNED_16(type, v0, [BUF_SIZE / 2]); \ | ||
61 | LOCAL_ALIGNED_16(type, v1, [BUF_SIZE / 2]); \ | ||
62 | LOCAL_ALIGNED_16(uint8_t, dst0, [BUF_SIZE * 8 / 3]); \ | ||
63 | LOCAL_ALIGNED_16(uint8_t, dst1, [BUF_SIZE * 8 / 3]); \ | ||
64 | \ | ||
65 | declare_func(void, const type * y, const type * u, const type * v, \ | ||
66 | uint8_t * dst, ptrdiff_t width); \ | ||
67 | ptrdiff_t width, step = 12 / sizeof(type); \ | ||
68 | \ | ||
69 | for (width = step; width < BUF_SIZE - 15; width += step) { \ | ||
70 | int y_offset = rnd() & 15; \ | ||
71 | int uv_offset = y_offset / 2; \ | ||
72 | randomize_buffers(mask); \ | ||
73 | call_ref(y0 + y_offset, u0 + uv_offset, v0 + uv_offset, dst0, width); \ | ||
74 | call_new(y1 + y_offset, u1 + uv_offset, v1 + uv_offset, dst1, width); \ | ||
75 | if (memcmp(y0, y1, BUF_SIZE * sizeof(type)) \ | ||
76 | || memcmp(u0, u1, BUF_SIZE * sizeof(type) / 2) \ | ||
77 | || memcmp(v0, v1, BUF_SIZE * sizeof(type) / 2) \ | ||
78 | || memcmp(dst0, dst1, width * 8 / 3)) \ | ||
79 | fail(); \ | ||
80 | bench_new(y1 + y_offset, u1 + uv_offset, v1 + uv_offset, dst1, width); \ | ||
81 | } \ | ||
82 | } while (0) | ||
83 | |||
84 | 13 | void checkasm_check_v210enc(void) | |
85 | { | ||
86 | V210EncContext h; | ||
87 | |||
88 | 13 | ff_v210enc_init(&h); | |
89 | |||
90 |
2/2✓ Branch 3 taken 4 times.
✓ Branch 4 taken 9 times.
|
13 | if (check_func(h.pack_line_8, "v210_planar_pack_8")) |
91 |
13/24✓ Branch 2 taken 20992 times.
✓ Branch 3 taken 164 times.
✓ Branch 6 taken 10496 times.
✓ Branch 7 taken 164 times.
✓ Branch 9 taken 27552 times.
✓ Branch 10 taken 164 times.
✓ Branch 18 taken 164 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 164 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 164 times.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✓ Branch 25 taken 164 times.
✗ Branch 29 not taken.
✓ Branch 30 taken 164 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✓ Branch 47 taken 164 times.
✓ Branch 48 taken 4 times.
|
59208 | check_pack_line(uint8_t, 0xffffffff); |
92 | |||
93 |
2/2✓ Branch 3 taken 3 times.
✓ Branch 4 taken 10 times.
|
13 | if (check_func(h.pack_line_10, "v210_planar_pack_10")) |
94 |
13/24✓ Branch 2 taken 62976 times.
✓ Branch 3 taken 246 times.
✓ Branch 6 taken 31488 times.
✓ Branch 7 taken 246 times.
✓ Branch 9 taken 40836 times.
✓ Branch 10 taken 246 times.
✓ Branch 18 taken 246 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 246 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 246 times.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✓ Branch 25 taken 246 times.
✗ Branch 29 not taken.
✓ Branch 30 taken 246 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✓ Branch 47 taken 246 times.
✓ Branch 48 taken 3 times.
|
135549 | check_pack_line(uint16_t, 0x03ff03ff); |
95 | |||
96 | 13 | report("planar_pack"); | |
97 | 13 | } | |
98 |