FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/tests/checkasm/vf_pp7.c
Date: 2026-08-30 18:45:47
Exec Total Coverage
Lines: 16 17 94.1%
Functions: 2 2 100.0%
Branches: 9 28 32.1%

Line Branch Exec Source
1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19 #include <assert.h>
20 #include <stddef.h>
21 #include <stdint.h>
22 #include <string.h>
23
24 #include "checkasm.h"
25 #include "libavfilter/vf_pp7dsp.h"
26 #include "libavutil/intreadwrite.h"
27 #include "libavutil/mem_internal.h"
28
29 #define randomize_buffer(buf) \
30 do { \
31 static_assert(!(sizeof(buf) % 4), "Tail handling needed"); \
32 for (size_t k = 0; k < sizeof(buf); k += 4) { \
33 AV_WN32A((char*)buf + k, rnd()); \
34 } \
35 } while (0)
36
37 14 static void check_dctB(const PP7DSPContext *const pp7dsp)
38 {
39 14 declare_func(void, int16_t *dst, const int16_t *src);
40
41
2/2
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 2 times.
14 if (!check_func(pp7dsp->dctB, "dctB"))
42 12 return;
43
44 DECLARE_ALIGNED(8, int16_t, src)[7 * 4];
45 DECLARE_ALIGNED(8, int16_t, dst_ref)[6 * 4];
46 DECLARE_ALIGNED(8, int16_t, dst_new)[6 * 4];
47
48
2/2
✓ Branch 1 taken 28 times.
✓ Branch 2 taken 2 times.
30 randomize_buffer(src);
49
2/2
✓ Branch 1 taken 24 times.
✓ Branch 2 taken 2 times.
26 randomize_buffer(dst_ref);
50 2 memcpy(dst_new, dst_ref, sizeof(dst_new));
51
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
2 call_ref(dst_ref, src);
52 2 call_new(dst_new, src);
53
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (memcmp(dst_new, dst_ref, sizeof(dst_new)))
54 fail();
55
56
1/18
✗ Branch 1 not taken.
✓ Branch 2 taken 2 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.
2 bench_new(dst_new, src);
57 }
58
59 14 void checkasm_check_vf_pp7(void)
60 {
61 PP7DSPContext pp7dsp;
62
63 14 ff_pp7dsp_init(&pp7dsp);
64
65 14 check_dctB(&pp7dsp);
66 14 report("dctB");
67 14 }
68