| 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 | checkasm_check(type, y0, 0, y1, 0, BUF_SIZE, 1, "y"); \ | ||
| 76 | checkasm_check(type, u0, 0, u1, 0, BUF_SIZE / 2, 1, "u"); \ | ||
| 77 | checkasm_check(type, v0, 0, v1, 0, BUF_SIZE / 2, 1, "v"); \ | ||
| 78 | checkasm_check(uint8_t, dst0, 0, dst1, 0, width * 8 / 3, 1, "dst"); \ | ||
| 79 | bench_new(y1 + y_offset, u1 + uv_offset, v1 + uv_offset, dst1, width); \ | ||
| 80 | } \ | ||
| 81 | } while (0) | ||
| 82 | |||
| 83 | 14 | void checkasm_check_v210enc(void) | |
| 84 | { | ||
| 85 | V210EncContext h; | ||
| 86 | |||
| 87 | 14 | ff_v210enc_init(&h); | |
| 88 | |||
| 89 |
2/2✓ Branch 3 taken 4 times.
✓ Branch 4 taken 10 times.
|
14 | if (check_func(h.pack_line_8, "v210_planar_pack_8")) |
| 90 |
9/16✓ 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 23 not taken.
✓ Branch 24 taken 164 times.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✓ Branch 69 taken 164 times.
✓ Branch 70 taken 4 times.
|
59208 | check_pack_line(uint8_t, 0xffffffff); |
| 91 | |||
| 92 |
2/2✓ Branch 3 taken 3 times.
✓ Branch 4 taken 11 times.
|
14 | if (check_func(h.pack_line_10, "v210_planar_pack_10")) |
| 93 |
9/16✓ 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 23 not taken.
✓ Branch 24 taken 246 times.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✓ Branch 69 taken 246 times.
✓ Branch 70 taken 3 times.
|
135549 | check_pack_line(uint16_t, 0x03ff03ff); |
| 94 | |||
| 95 | 14 | report("planar_pack"); | |
| 96 | 14 | } | |
| 97 |