../../../ffmpeg/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
30 / 31
96.8%
Branches:
10 / 32
31.2%
Functions:
3 / 3
100.0%

tests/checkasm/v210dec.c
Line Branch Exec Source
1 /*
2 * Copyright (c) 2019 James Darnley
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/v210dec_init.h"
24
25 2728 static uint32_t get_v210(void)
26 {
27 2728 uint32_t t0 = rnd() & 0x3ff,
28 2728 t1 = rnd() & 0x3ff,
29 2728 t2 = rnd() & 0x3ff;
30 2728 uint32_t value = t0
31 2728 | (t1 << 10)
32 2728 | (t2 << 20);
33 2728 return value;
34 }
35
36 #define NUM_SAMPLES 2048
37
38 4 static void randomize_buffers(uint32_t *src0, uint32_t *src1, int len)
39 {
40
2/2
✓ Branch 5 → 3 taken 2728 times.
✓ Branch 5 → 6 taken 4 times.
2732 for (int i = 0; i < len; i++) {
41 2728 uint32_t value = get_v210();
42 2728 src0[i] = value;
43 2728 src1[i] = value;
44 }
45 4 }
46
47 14 void checkasm_check_v210dec(void)
48 {
49 V210DecContext h;
50
51 14 h.aligned_input = 0;
52 14 ff_v210dec_init(&h);
53
54
2/2
✓ Branch 4 → 5 taken 4 times.
✓ Branch 4 → 83 taken 10 times.
14 if (check_func(h.unpack_frame, "v210_unpack")) {
55 uint32_t src0[NUM_SAMPLES/3];
56 uint32_t src1[NUM_SAMPLES/3];
57 uint16_t y0[NUM_SAMPLES/2 + 26];
58 uint16_t y1[NUM_SAMPLES/2 + 26];
59 uint16_t u0[NUM_SAMPLES/4 + 13];
60 uint16_t u1[NUM_SAMPLES/4 + 13];
61 uint16_t v0[NUM_SAMPLES/4 + 13];
62 uint16_t v1[NUM_SAMPLES/4 + 13];
63 4 declare_func(void, const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width);
64 4 const int pixels = NUM_SAMPLES / 2 / 6 * 6;
65
66 4 randomize_buffers(src0, src1, NUM_SAMPLES/3);
67
1/2
✗ Branch 8 → 9 not taken.
✓ Branch 8 → 10 taken 4 times.
4 call_ref(src0, y0, u0, v0, pixels);
68 4 call_new(src1, y1, u1, v1, pixels);
69
1/2
✓ Branch 14 → 15 taken 4 times.
✗ Branch 14 → 18 not taken.
4 if (memcmp(src0, src1, NUM_SAMPLES/3 * sizeof src0[0])
70
1/2
✓ Branch 15 → 16 taken 4 times.
✗ Branch 15 → 18 not taken.
4 || memcmp(y0, y1, pixels * sizeof y0[0])
71
1/2
✓ Branch 16 → 17 taken 4 times.
✗ Branch 16 → 18 not taken.
4 || memcmp(u0, u1, pixels/2 * sizeof u0[0])
72
1/2
✗ Branch 17 → 18 not taken.
✓ Branch 17 → 19 taken 4 times.
4 || memcmp(v0, v1, pixels/2 * sizeof v0[0]))
73 ✗ fail();
74
1/18
✗ Branch 20 → 21 not taken.
✓ Branch 20 → 79 taken 4 times.
✗ Branch 23 → 24 not taken.
✗ Branch 23 → 66 not taken.
✗ Branch 59 → 60 not taken.
✗ Branch 59 → 63 not taken.
✗ Branch 60 → 61 not taken.
✗ Branch 60 → 62 not taken.
✗ Branch 61 → 62 not taken.
✗ Branch 61 → 63 not taken.
✗ Branch 64 → 25 not taken.
✗ Branch 64 → 65 not taken.
✗ Branch 70 → 68 not taken.
✗ Branch 70 → 71 not taken.
✗ Branch 72 → 73 not taken.
✗ Branch 72 → 74 not taken.
✗ Branch 76 → 22 not taken.
✗ Branch 76 → 77 not taken.
4 bench_new(src1, y1, u1, v1, pixels);
75 }
76 14 report("v210_unpack");
77 14 }
78